Characteristic#10028

Characteristic

1 second
64 megabytes
Medium

A correct bracket expression, denoted as **<CBV>**, is defined by the following rules:

**<CBV> ::= | (<CBV>) | [<CBV>] | {<CBV>} | <CBV><CBV>**

An empty string is also considered a correct bracket expression.

Let's use the notation: represents any correct bracket expression, while and represent any two non-empty correct bracket expressions. The characteristic of a correct bracket expression is determined by a numerical function applied to the string representing the expression. This function is calculated using the following rules:

F("") = 1

F("("+A+")") = F(A) + 1

F("["+A+"]") = F(A) + 2

F("\{"+A+"\}") = F(A) + 3

F(B + C) = F(B) \cdot F(C)

Here, the **"+"** sign indicates string concatenation.

For a given string, compute and output the value of the function if the string is a correct bracket sequence. If it is not, output the message **"The first mistake in position"**, followed by the position number of the first error in the string (positions are numbered starting from ). If the string ends with unmatched brackets, the error is considered to be at the position equal to the string's length plus (as if a bracket is missing, as shown in the fifth example).

The string's length does not exceed characters and may only contain brackets.

Input

A single line containing the input string.

Output

A single line with the result of the task.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading

Example 4

Loading
Loading