SP10463 PAREN - COUNT PAREN

Description

You are given a boolean expression consisting of a string of the symbols 'true', 'false', 'and', 'or', and 'xor'. Count the number of ways to parenthesize the expression such that it will evaluate to true. "and" "or" and "xor" are of the same priority.

Input Format

An integer t, 1

Output Format

For each string given at input, display a line with the number of ways to parenthesize the expression such that it will evaluate to true.