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.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Stack;
import java.util.StringTokenizer;

public class LongestRegularBracketSequence {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		ArrayList<Integer> a = new ArrayList<>();
		int right = 0;
		int max = 0;
		int curL = 0;
		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (c == '(')
				stack.push(0);
			else {
				if (stack.isEmpty())
					continue;
				int x = stack.pop();
				if (x == 0) {
					if (stack.isEmpty())
						stack.push(2);
					else if (stack.peek() == 0)
						stack.push(2);
					else
						stack.push(stack.pop() + 2);

					if (stack.peek() >= max) {
						max = Math.max(max, stack.peek());
						a.add(max);
					}

				} else {
					if (stack.isEmpty()) {
						continue;
					} else {
						int sum = 0;
						if (stack.peek() == 0)
							stack.pop();

						while (!stack.isEmpty() && stack.peek() != 0)
							sum += stack.pop();

						stack.push(sum + x + 2);

						if (stack.peek() >= max) {
							max = Math.max(max, stack.peek());
							a.add(max);
						}
					}

				}
			}

		}

		// System.out.println(max + " " + right);
		// System.out.println(begin + " " + (end + 1));
		if (max == 0)
			System.out.println(0 + " " + 1);
		else {
			int count = 0;
			for (int i = 0; i < a.size(); i++) {
				if (a.get(i) == max)
					count++;
			}
			System.out.println(max + " " + count);
		}

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}