Problem: This is yet another problem dealing with regular bracket sequences.

We should remind you that a bracket sequence is called regular, if by inserting «+» and «1» into it we can get a correct mathematical expression. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not. 

You are given a string of «(» and «)» characters. You are to find its longest substring that is a regular bracket sequence. You are to find the number of such substrings as well.

Input

The first line of the input file contains a non-empty string, consisting of «(» and «)» characters. Its length does not exceed 106.

Output

Print the length of the longest substring that is a regular bracket sequence, and the number of such substrings. If there are no such substrings, write the only line containing "0 1".

Examples

Input

)((())))(()())


Output

6 2


Input

))(


Output

0 1

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class LongestBracketSeq
{

	public static void main(String[] args) throws IOException
	{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		
		String brackets = in.readLine();
		
		int maxSeq = 0;
		int numOfMaxSeq = 1;
		int currentRightBracketsNeeded = 0;
		int currentStartIndex = 0;
		int currentSeqLength;
		for(int i = 0; i < brackets.length(); ++i)
		{
			if(brackets.charAt(i) == '(')
			{
				currentRightBracketsNeeded++;
			}
			else if(brackets.charAt(i) == ')')
			{
				currentRightBracketsNeeded--;
			}
			
			
			if(currentRightBracketsNeeded < 0)
			{
				currentSeqLength = i - currentStartIndex;
				if(currentSeqLength > maxSeq)
				{
					maxSeq = currentSeqLength;
					numOfMaxSeq = 1;
					
				}
				else if(currentSeqLength == maxSeq)
					numOfMaxSeq++;
				
				currentStartIndex = i + 1;
				currentRightBracketsNeeded = 0;
			}
			
			
			
		}
		
		if(currentRightBracketsNeeded == 0)
		{
			currentSeqLength = brackets.length() - currentStartIndex;
			if(currentSeqLength > maxSeq)
			{
				maxSeq = currentSeqLength;
				numOfMaxSeq = 1;
			}
			else if(currentSeqLength == maxSeq)
				numOfMaxSeq++;
		}
		
		if(currentRightBracketsNeeded > 0)
		{
//			char[] newBrackets = brackets.substring(currentStartIndex, brackets.length()).toCharArray();
//			
//			for(int i = 0; i < newBrackets.length; ++i)
//			{
//				if(newBrackets[i] == '(')
//				{
//					newBrackets[i] = ')';
//				}
//				else
//				{
//					newBrackets[i] = '(';
//				}
//			}
//			
//			currentRightBracketsNeeded = 0;
//			currentStartIndex = 0;
//			//System.out.println("new" + newBrackets);
//			
//			for(int i = 0; i < newBrackets.length; ++i)
//			{
//				if(newBrackets[i] == '(')
//				{
//					currentRightBracketsNeeded++;
//				}
//				else if(newBrackets[i] == ')')
//				{
//					currentRightBracketsNeeded--;
//				}
//				
//				
//				if(currentRightBracketsNeeded < 0)
//				{
//					currentSeqLength = i - currentStartIndex;
//					if(currentSeqLength > maxSeq)
//					{
//						maxSeq = currentSeqLength;
//						if(maxSeq == 26)
//						{
//							System.out.println("Here3");
//						}
//						numOfMaxSeq = 1;
//					}
//					else if(currentSeqLength == maxSeq)
//						numOfMaxSeq++;
//					
//					currentStartIndex = i + 1;
//					currentRightBracketsNeeded = 0;
//				}
//			}
//			
//			if(currentRightBracketsNeeded == 0)
//			{
//				currentSeqLength = newBrackets.length - currentStartIndex;
//				if(currentSeqLength > maxSeq)
//				{
//					maxSeq = currentSeqLength;
//					numOfMaxSeq = 1;
//					if(maxSeq == 26)
//					{
//						System.out.println("Here4");
//					}
//				}
//				else if(currentSeqLength == maxSeq)
//					numOfMaxSeq++;
//			}
			
			int currentLeftBracketsNeeded = 0;
			int currentEndIndex = brackets.length()-1;
			
			for(int i = brackets.length()-1; i >= currentStartIndex; --i)
			{
				if(brackets.charAt(i) == '(')
				{
					currentLeftBracketsNeeded--;
				}
				else if(brackets.charAt(i) == ')')
				{
					currentLeftBracketsNeeded++;
				}
				
				
				if(currentLeftBracketsNeeded < 0)
				{
					currentSeqLength = currentEndIndex - i;
					if(currentSeqLength > maxSeq)
					{
						maxSeq = currentSeqLength;
						numOfMaxSeq = 1;
						
					}
					else if(currentSeqLength == maxSeq)
						numOfMaxSeq++;
					
					currentEndIndex = i - 1;
					currentLeftBracketsNeeded = 0;
				}
				
				
				
			}
			
			
			
//			int endIndex = brackets.length() - 1;
//			
//			for(int i = currentStartIndex; i < brackets.length(); ++i)
//			{
//				if(brackets.charAt(i) == '(')
//				{
//					currentRightBracketsNeeded--;
//					currentStartIndex = i+1;
//					
//					for(int j = endIndex; j >= currentStartIndex; --j)
//					{
//						if(brackets.charAt(j) == ')')
//						{
//							endIndex = j;
//						}
//					}
//				}
//				
//				if(currentRightBracketsNeeded == 0)
//				{
//					currentSeqLength = endIndex - currentStartIndex;
//					if(currentSeqLength > maxSeq)
//					{
//						maxSeq = currentSeqLength;
//						numOfMaxSeq = 1;
//					}
//					else if(currentSeqLength == maxSeq)
//						numOfMaxSeq++;
//					break;
//				}
//			}
		}
		if(maxSeq == 0)
			System.out.println("0 1");
		else
			System.out.println(maxSeq + " " + numOfMaxSeq);

	}

}