DP: boolean parenthesization