The planet of XANDOR was famous in the intergalactic empire for being home to the Carden - a race of super-intelligent computer scientists that were held in high regard for their achievements in the Intergalactic Mind Game Olympiads. The Carden decided to build a huge computer to answer questions related to Life, the Universe and Everything. They decided to use only their best two-input, noise immune, Boolean gates for this device - AND, OR and XOR. After a lot of minimization, they arrived at a variable assignment for their gates. Just then, lightning struck and erased all the parentheses from their expression. Not willing to spend the trouble parenthesizing the huge expression again, they outsourced the work to Earth.

As a consultant to XANDOR, you need to create a computer program that parenthesizes the Boolean expression in such a manner that the expression results in a true value and report the number of ways possible to do it. In case it is not possible to do so, you need to return 0. 


Input
An unparenthesized Boolean expression containing literals T and F which are connected via gates represented as . (dot) for an AND gate, + (plus) for an OR gate and * (star) for an XOR gate. There will be at least one literal in input line. Maximum number of literals i.e. T or F will be 15.

Output
Line 1: A single value C >= 0 representing the number of true parenthesizations possible.

Example

Input:
T.F+T*F

Output:
5



Description
The 5 values correspond to the parenthesizations (((T.F)+T)*F), ((T.F)+(T*F)), ((T.(F+T))*F, (T.((F+T)*F)), (T.(F+(T*F))) - all of which evaluate to true.
#!/usr/bin/python

s=raw_input()
dp = [ [ 0 for j in xrange(20)] for i in xrange(20) ]
op = [ '_' for i in xrange(20) ]
n = len(s)
m = 0
f = [0, 1]
for i in xrange(2,20):
    f.append(0)
    for j in xrange(1,i):
        f[i] += f[j] * f[i-j]
for i in xrange(n):
    if i%2 == 0 and s[i] == 'T':
        dp[i/2][1] = 1
    else: op[i/2] = s[i]
n = (n+1)/2
for l in xrange(2,n+1):
    for i in xrange(n+1-l):
        for k in xrange(i,i+l-1):
            la,lb = k+1-i,l+i-k-1
            if op[k] == '.': dp[i][l] += dp[i][la] * dp[k+1][lb]
            if op[k] == '+':
                dp[i][l] += f[la] * f[lb]
                dp[i][l] -= (f[la] - dp[i][la]) * (f[lb] - dp[k+1][lb])
            if op[k] == '*':
                dp[i][l] += dp[i][la] * (f[lb] - dp[k+1][lb])
                dp[i][l] += (f[la] - dp[i][la]) * dp[k+1][lb]
print dp[0][n]