Homework

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Little Helena recently finished her first year of primary school. She is a model student, has straight A’s, and has a huge passion for mathematics. She is currently on a well-deserved vacation with her family, but she’s starting to miss her daily math homework. Luckily, her older brother decided to quench her intellectual thirst, and gave her the following problem.

A valid expression is defined recursively as follows:

  • the string ? is a valid expression which represents a number.
  • if AA and BB are valid expressions, then so are min(AA,BB) and max(AA,BB), where the former represents a function returning the smaller of its two arguments, while the latter represents a function returning the larger of its two arguments.

For example, expressions min(min(?,?),min(?,?)) and max(?,max(?,min(?,?))) are valid according to the definition above, but expressions ??, max(min(?)) and min(?,?,?)are not.

Helena is given a valid expression containing a total of NN question marks. Each question mark is to be replaced with a number from the set 1,2,,N{1, 2, \dots, N} in such a way that each number from this set appears exactly once in the expression. In other words, the question marks are replaced by a permutation of the numbers from 11 to NN.

Once the question marks have been replaced by numbers, the expression can be evaluated and its value will be an integer between 11 and NN. Considering all the ways of assigning numbers to question marks, how many different values can Helena obtain after evaluating the expression?

입력

The first and only line contains a single valid expression.

출력

Output a single integer between 11 and NN, the number of different values obtainable by evaluating the expression.

제한

In all subtasks it holds that 2N1,000,0002 ≤ N ≤ 1\\,000\\,000.