Mathematics and Brackets#4438

Mathematics and Brackets

1 second
64 megabytes
Easy

Once upon a time, three mathematicians gathered...

You are provided with the bracket sequence written by the first mathematician. Determine the number that the third mathematician declared.

A cyclic shift of a string involves moving a certain (possibly zero) number of characters from the end of the string to its beginning, while maintaining their order.

Input

The bracket sequence provided by the first mathematician is presented on a single line. The length of the sequence is greater than and does not exceed characters.

Output

Output the number of cyclic shifts that convert the given bracket sequence into a valid one.

Examples

Example 1

Loading
Loading