Fix parenthesis logic in math operation