Compute balance parenthesis