I can do addition, substraction and division but i cannot do multiplication
Now that you have identified the solution, I'll help you understand why.

You are multiplying a 7-bit number with a maximum value of 127 by an 8-bit number with a maximum value of 255. If you do the math you find that the maximum value of the product is 32,385 which needs at least 15 bits to be represented as a binary number.

The actual value that you used for coef2 was 32, so for small values of c you got the correct value for f. If you know that the coefficient will actually fit in 6 bits then you would only need 13 bits for the product.