Time

12:38:17
23 May 2012
Version for print

Brackets

Given an expression consisting only of letters a digits and the operations + and *. Write a program that computes the number of ways of placing a full set of brackets in this expression so that each pair of brackets contain a single character operation and two operands, each of which is either a letter or an expression in parentheses. Value of the expression at the same time should remain unchanged, ie must first run the operations of multiplication and then addition. For example, the expression а+а+а*а*а there are 4 ways to placement of brackets:

(а+(а+(а*(а*а))))

(а+(а+((а*а)*а)))

((а+а)+((а*а)*а))

((а+а)+(а*(а*а)))


Specifications

Input

In the first line of the input file contains a valid expression containing no more than 25 characters of operations.

Output

In the output file display one number - the number of ways of placing parentheses.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 6.25
Complexity: 69% 5/16

Example

Example input

а+а+а*а*а

Example output

4


← XML-converter Problems Counterfeit check →