Insert Parentheses#7311

Insert Parentheses

1 second
128 megabytes
Very easy

Milhouse needs to solve a school assignment by tomorrow and requires your help. Here is the task:

You are given a string consisting of parentheses. You must turn it into a well-formed string by inserting as few parentheses as possible, at any position (you cannot delete or modify any of the existing parentheses).

A string of parentheses is considered well-formed if it satisfies the following conditions:

For example, "(()())", "" and "(())()" are well-formed, while "())(", "()(" and ")" are not.

Input

The input consists of a string of parentheses with length from to characters inclusive.

Output

Output the minimum number of parentheses that must be inserted to make the given string well-formed.

Examples

Example 1

Loading
Loading