How can I do math on fields?
Drupal modules are basically PHP code, and because PHP is on the server side, you cannot do mathematical actions upon user's input without submitting your data to the server(Which will refresh your page).

The only solution to do what you want is to add some Javasciprt to do it for you.

Here is a tutorial explaining how to add JS to Drupal

https://www.drupal.org/node/756722