14482 - Function Composition   

Description

There are three functions:

f(x) = 7x + 1

g(x, y) = 4x + 9y - 2

h(x, y, z) = x - 3y + z - 9

You will be given a expression of these three functions.

For example:

h g f 1 4 1 f 2

which represent:

h(g(f(1), 4), 1, f(2))

= h(g(8, 4), 1, 15)

= h(66, 1, 15)

= 69

Input

A single line with numbers of characters, all the characters are separated with a whitespace.

It is guarantee that the characters contains only f g h and numbers from 0 to 9.

It is guarantee that all the number throughout the entire calculation won't exceed the range of long long.

It is guarantee that the number of characters (excluding whitespace) won't exceed 100.

There won't be any - .

There won't be any adjacent numbers, which means all the numbers are single-digit.

To be clear, the following examples won't appear in the testcase.

h g f 1 4 1 f 23 (two-digit number 23)

h g f -1 4 1 f 2 (negative number -1)

Output

Output the answer of the given expression.

Note that you do NOT need to print '\n' at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss