Will my shares be changed to shares of B company or will I be paid an amount of the share before the transaction with some additional amount based on transaction?
What happen depends on the nature of the agreement between the two companies.
They can give all stockholders of the company A cash at a specified price level. During the time between the announcement and the closing of the deal the market price of your shares could go up or down.
The stockholders of company A could be given a mix of shares and cash. If you have 100 shares at $5 a share, and the other company is worth $15 a share; you will get 33 shares in the new company, and $5 cash.
They can decide to get rid of all the small investors by doing a complicated maneuver involving reverse splits, resulting in every small investor getting cash.
This can get quite complicated because the actual steps may be designed to create specific conditions to minimize corporate taxes.
Before the transaction is approved all the details regarding your class of stocks will be provided to you.