LearnPy Hub
← Arena
AdvancedRating 1800

Ways to Make It True

The expression alternates T/F symbols with operators & (and), | (or) and ^ (xor), like T|F&T. Count the ways to put brackets so the whole thing evaluates to True, modulo 1 000 000 007.

Input

One expression (up to 99 symbols).

Output

One integer.

Sample 1

Input
T|F&T
Output
2

Sample 2

Input
T^F|F
Output
2
solution.py
Output appears here
Ways to Make It True · Python Arena problem · LearnPy Hub