Page not loading? Try clicking here.
Placeholder

#2604

Bowl 1s 128MB

Problems

A single bowl has a height of 10 cm when placed on the floor.

  • If two bowls are stacked in the same direction, the height increases by 5 cm per additional bowl.

  • If bowls are stacked in opposite directions, the height increases by the full bowl height (10 cm) per bowl.

To describe the stacking, we use parentheses. Assume bowls are stacked from left to right:

  • ( represents a bowl placed upright on the floor.

  • ) represents a bowl placed upside down.

For example:

  • If the stacking pattern is ((((, the total height is 25 cm. This is because the first bowl is 10 cm, and three additional bowls stacked in the same direction add 5+5+5=15 cm.

  • If the stacking pattern is ()()()(), the total height is 40 cm, since each bowl adds the full 10 cm height.

Given a string representing the bowl stacking pattern, calculate the total height. The direction of each bowl in the input cannot be changed.


Input

A single line containing a string of parentheses.

  • ( indicates an upright bowl.

  • ) indicates an upside-down bowl.

  • The length of the string is between 3 and 50 inclusive.


Output

Print a single integer: the total height of the bowls stacked according to the given pattern.


Example #1

((((
25

Example #2

()()()))(
80


Source

KOI 본선 2013 초1

You must sign in to write code.