Smart contracts are high-level programs that are translated into EVM byte code and then deployed to the Ethereum blockchain for execution. Solidity mathematic procedures are similar to other programming languages. The following arithmetic operations are applicable to Solidity: Addition, Subtraction, Multiplication, Division (x / y), Modulus (x% y), Exponential (x**y) In the case of performing Integer division, Solidity may truncate the result. Hence we must multiply before dividing to prevent such loss in precision
Multiply before divide to avoid loss of precision
https://blog.solidityscan.com/precision-loss-in-arithmetic-operations-8729aea20be9