544. Score of Parentheses

0

Medium

Given a **balanced parentheses** string `s`, calculate and output the score of the string. The **score of a balanced parentheses** string is determined by the following rules: * The score of "()" is 1. * The score of AB is equal to the sum of the scores of A and B, where A and B are balanced parentheses strings. * The score of (A) is equal to 2 times the score of A, where A is a balanced parentheses string.

Input Format

The input consists of a single line containing a string s.

Output Format

Print the score of the given balanced parentheses string.

Example

Input

()((()))

Output

5

Constraints

1<= s.length <= 100
`s` consists of only '(' and ')'.
`s` is a balanced parentheses string.
Loading...

View Submissions

Console