Brackets#1025

Brackets

1 second
122.174 megabytes
Medium

Consider bracket sequences with one type of parenthesis. For the given bracket sequence, find the number of its subsequences that are valid bracket sequences.

For example, for the sequence ((())())(, there are eight such subsequences: ((())()), (())(), ((())), (()()), (()), ()(), (), and the empty sequence.

Input

The input contains a sequence of no more than round brackets.

Output

Print the number of different correct bracket subsequences for the given bracket sequence.

Examples

Example 1

Loading
Loading