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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Stack;
import java.util.TreeMap;

public class ArrayListEx {
	public static void main(String args[]) {
        InputReader sc = new InputReader(System.in);
        PrintWriter in = new PrintWriter(System.out);
        String s = sc.readString();
        int length=0,count=0,prelength=0,res=0;
        Stack<Integer> st = new Stack<Integer>();
        TreeMap<Integer,Integer> ct = new TreeMap<Integer,Integer>();
        st.push(-1);
        for(int i=0; i<s.length(); i++){
             if(s.charAt(i) == '(')
            	 st.push(i);
             else if(s.charAt(i) == ')') {
            	 st.pop();
            	 if(!st.empty()) {
            		 prelength = length;
            		 length = i-st.peek();
            		 res = Math.max(res, length);
            		 Integer c = ct.get(res);
            		 if(ct.get(res) == null) 
            			 ct.put(res, 1);
            		 else if(length>=res) {
            			 ct.put(res,++c);
//            			 in.println(res +" "+ c);
            		 }
            		 if(res>prelength) {
            			 ct.remove(prelength);
//            			 in.println(prelength);
            		 }
            	 }
            	 else {
            		 st.push(i);
            	 }
             }
        }
//        if(ct.lastKey()==0)
//        	in.println("0 1");
//        else {
        	try {
        		in.println(ct.lastKey()+" "+ct.get(ct.lastKey()));
        	}catch(Exception e) {
        		in.println("0 1");
        	}
//        }
        in.close();
    }
}

class InputReader {

	private final InputStream st;
	private final byte[] buf = new byte[8192];
	private int cc, sc;
	private SpaceCharFilter f;

	public InputReader(InputStream st) {
		this.st = st;
	}

	public int t() {
		if (sc == -1)
			throw new InputMismatchException();
		if (cc >= sc) {
			cc = 0;
			try {
				sc = st.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (sc <= 0)
				return -1;
		}
		return buf[cc++];
	}

	public int nextInt() {
		int c = t();
		while (isSpaceChar(c)) {
			c = t();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = t();
		}
		int res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = t();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = t();
		while (isSpaceChar(c)) {
			c = t();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = t();
		}
		long res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = t();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}

	public String readString() {
		int c = t();
		while (isSpaceChar(c)) {
			c = t();
		}
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = t();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public String nextLine() {
		int c = t();
		while (isSpaceChar(c))
			c = t();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = t();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (f != null)
			return f.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}