How to perform calculation with a checkbox