Or use javascript with the webviewer to build calculations....
https://www.w3schools.com/js/js_math.asp
https://www.w3schools.com/js/js_arithmetic.asp