#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int longest = 0;
  int cnt = 0, c = 0, l = 0, p = 0;
  for (int i = 0; i < seq.size(); i++) {
    if (seq[i] == ')') c--;
    else c++, l++;
    if (c < 0) l = 0, c = 0, p = 0;
    else {
      if (2*(l - c) + p == longest) cnt++;
      else if (2*(l-c) + p > longest) longest = 2*(l-c) + p, cnt = 1;
    }
    if (c == 0) {p = 2*(l-c) + p;l = 0;}
  }
  if (!longest) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
}


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int longest = 0;
  int cnt = 0, c = 0, l = 0, p = 0;
  for (int i = 0; i < seq.size(); i++) {
    bool flag = false;
    if (seq[i] == ')') {c--, flag = true;}
    else c++, l++;
    if (c < 0) l = 0, c = 0, p = 0;
    else if (flag) {
      if (2*(l - c) + p == longest) cnt++;
      else if (2*(l-c) + p > longest) longest = 2*(l-c) + p, cnt = 1;
    }
    if (c == 0) {p = 2*(l-c) + p;l = 0;}
  }
  if (!longest) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
}


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int stack[1000001], top = 0;
  int longest = 0, cnt = 0;
  for (int i = 0; i < seq.size(); i++) {
    if (seq[i] == '(') {
      stack[++top] = 1;
      continue;
    }
    int c = 1;
    int popped = 0;
    while (top) {
      c += stack[top];
      if (stack[top] == 1) break;
      popped++;
      top--;
    }
    if (!top && popped <= 1) continue;
    if (c == longest) cnt++;
    if (c > longest) longest = c, cnt = 1;
    if (top) stack[top] = c;
  }
  int c = 0;
  int popped = 0;
  while (top) {
    c += stack[top];
    if (stack[top] == 1 && popped > 1) {
      c--;
      if (c == longest) cnt++;
      if (c > longest) longest = c, cnt = 1;
      c = 0;
      popped = 0;
    }
    popped++;
    top--;
  }
  if (popped > 1) {
    if (c == longest) cnt++;
    if (c > longest) longest = c, cnt = 1;
  }
  if (!longest) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
  }


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int longest = 0;
  int cnt = 0, c = 0, l = 0;
  for (int i = 0; i < seq.size(); i++) {
    if (seq[i] == ')') c--;
    else c++, l++;
    if (c < 0) l = 0, c = 0;
    else {
      if (2*(l - c) == longest) cnt++;
      else if (2*(l-c) > longest) longest = 2*(l-c), cnt = 1;
    }
    if (c == 0) l = 0;
  }
  if (!longest) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
}


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int stack[1000001], top = 0;
  int longest = 0, cnt = 0;
  for (int i = 0; i < seq.size(); i++) {
    if (seq[i] == '(') {
      stack[++top] = 1;
      continue;
    }
    int c = 1;
    int popped = 0;
    while (top) {
      c += stack[top];
      if (stack[top] == 1) break;
      popped++;
      top--;
    }
    if (!top && popped <= 1) continue;
    if (c == longest) cnt++;
    if (c > longest) longest = c, cnt = 1;
    if (top) stack[top] = c;
  }
  int c = 0;
  int popped = 0;
  //  for (int i = 1; i <= top; i++) cout<<stack[i]<<" ";
  //  cout<<endl;
  while (top) {
    c += stack[top];
    popped++;
    if (stack[top] == 1) {
      c--;
      if (popped > 2) {
	if (c == longest) cnt++;
	if (c > longest) longest = c, cnt = 1;
      }
      c = 0;
      popped = 0;
    }
    top--;
  }
  if (popped > 1) {
    if (c == longest) cnt++;
    if (c > longest) longest = c, cnt = 1;
  }
  if (!longest) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
  }


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int stack[1000001], top = 0;
  int longest = 0, cnt = 0;
  for (int i = 0; i < seq.size(); i++) {
    if (seq[i] == '(') {
      stack[++top] = 1;
      continue;
    }
    int c = 1;
    while (top) {
      c += stack[top];
      if (stack[top] == 1) break;
      top--;
    }
    if (!top) c = 0;
    else stack[top] = c;
    if (c == longest) cnt++;
    if (c > longest) longest = c, cnt = 1;
  }
  cout<<longest<<" "<<cnt<<endl;
  return 0;
  }


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int stack[1000001], top = 0;
  int longest = 0, cnt = 0;
  for (int i = 0; i < seq.size(); i++) {
    if (seq[i] == '(') {
      stack[++top] = 1;
      continue;
    }
    int c = 1;
    while (top) {
      c += stack[top];
      if (stack[top] == 1) break;
      top--;
    }
    if (!top) c = 0;
    else stack[top] = c;
    if (c == longest) cnt++;
    if (c > longest) longest = c, cnt = 1;
  }
  int c = 0;

  while (top) {
    c += stack[top];
    if (stack[top] == 1) {
      c--;
      if (c == longest) cnt++;
      if (c > longest) longest = c, cnt = 1;
      c = 0;
    }
    top--;
  }
  if (c == longest) cnt++;
  if (c > longest) longest = c, cnt = 1;
  if (!longest) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
  }


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int stack[1000001], top = 0;
  int longest = 0, cnt = 0;
  for (int i = 0; i < seq.size(); i++) {
    if (seq[i] == '(') {
      stack[++top] = 1;
      continue;
    }
    int c = 1;
    while (top) {
      c += stack[top];
      if (stack[top] == 1) break;
      top--;
    }
    if (c == longest) cnt++;
    if (c > longest) longest = c, cnt = 1;
    if (top) stack[top] = c;
  }
  int c = 0;
  while (top) {
    c += stack[top];
    if (stack[top] == 1) {
      c--;
      if (c == longest) cnt++;
      if (c > longest) longest = c, cnt = 1;
      c = 0;
    }
    top--;
  }
   if (c == longest) cnt++;
   if (c > longest) longest = c, cnt = 1;
  if (!longest) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
  }


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int longest = 0;
  int cnt = 0, c = 0, l = 0, p = 0;
  for (int i = 0; i < seq.size(); i++) {
    bool flag = false;
    if (seq[i] == ')') {c--, flag = true;}
    else c++, l++;
    if (c < 0) l = 0, c = 0, p = 0;
    else if (flag) {
      if (2*(l - c) + p == longest) cnt++;
      else if (2*(l-c) + p > longest) longest = 2*(l-c) + p, cnt = 1;
    }
    if (c == 0) {p = 2*(l-c) + p;l = 0;}
  }
  if (longest == 0) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
}


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int stack[1000001], top = 0;
  int longest = 0, cnt = 0;
  for (int i = 0; i < seq.size(); i++) {
    if (seq[i] == '(') {
      stack[++top] = 1;
      continue;
    }
    int c = 1;
    int popped = 0;
    while (top) {
      c += stack[top];
      if (stack[top] == 1) break;
      popped++;
      top--;
    }
    if (!top && popped <= 1) continue;
    if (!top) c--;
    if (c == longest) cnt++;
    if (c > longest) longest = c, cnt = 1;
    if (top) stack[top] = c;
  }
  int c = 0;
  int popped = 0;
  //  for (int i = 1; i <= top; i++) cout<<stack[i]<<" ";
  //  cout<<endl;
  while (top) {
    c += stack[top];
    popped++;
    if (stack[top] == 1) {
      c--;
      if (popped > 2) {
	if (c == longest) cnt++;
	if (c > longest) longest = c, cnt = 1;
      }
      c = 0;
      popped = 0;
    }
    top--;
  }
  if (popped > 1) {
    if (c == longest) cnt++;
    if (c > longest) longest = c, cnt = 1;
  }
  if (!longest) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
  }


#include<iostream>
#include<string>
using namespace std;

int main()
{
  string seq;
  cin>>seq;
  int longest = 0;
  int cnt = 0, c = 0, l = 0;
  for (int i = 0; i < seq.size(); i++) {
    if (seq[i] == ')') c--;
    else c++;
    l++;
    if (c < 0) l = 0, c = 0;
    if (c == 0) {
      if (l == longest) cnt++;
      else if (l > longest) cnt = 1, longest = l;
    }
  }
  if (!longest) cnt = 1;
  cout<<longest<<" "<<cnt<<endl;
  return 0;
}


#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef set<int> si;

const int N = 1000*1000 + 2;
int main()
{
	char * s = new char [N];
	cin>>s;
	int l = strlen(s);
	vi st;
	int mx = 0, c = 0;
	bool td = false;
	int len = 0;
	for (int i=0; i<l; i++)
	{
		if (s[i] == '(')
			st.push_back(i);
		else
		{
			if (st.size())
			{
				int d=st[st.size()-1];
				st.pop_back();
				len+=2;
				if (len>mx)
					mx = len;
			}
			else
				c+= (len!=0),len=0;
		}
	}
	c+=( len !=0);
	if (c==0)
		c = 1;
	cout<<mx<<" "<<c+td<<endl;
	return 0;
}


#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef set<int> si;

const int N = 1000*1000 + 2;
int main()
{
	char * s = new char [N];
	cin>>s;
	int l = strlen(s);
	vi st;
	int mx = 0, c = 0;
	bool td = false;
	int len = 0;
	for (int i=0; i<l; i++)
	{
		if (s[i] == '(')
			st.push_back(i), len++;
		else
		{
			if (st.size())
			{
				int d=st[st.size()-1];
				st.pop_back();
				len++;
				if (len>mx)
					mx = len;
			}
			else
				c+= (len!=0),len=0;
		}
	}
	c+=(len!=0);
	if (c==0)
		c = 1;
	cout<<mx<<" "<<c+td<<endl;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
#include <set>

using namespace std;

#define DB(n) cout<<#n<<" = "<<n<<" "
#define DBN(n) cout<<#n<<" = "<<n<<"\n"

typedef long long ll;
typedef pair<int, int> pii;

const int INF = 1000000000;
int d[1000001];

int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin>>s;

    int bal = 0;
    int mxlen = 0;
    int mxnum = 1;
    for (int i=0, e = s.length(); i<e; i++)
        d[i] = INF;

    for (int i=0, e = s.length(); i<e; i++) {
        if (s[i] == '(')
        {
           bal++;
           d[bal] = min(d[bal], i);
        }
        else if (bal > 0)
        {
             int len = i-d[bal]+1;
             d[bal] = INF;
             if (len > mxlen)
                mxlen = len, mxnum = 1;
             else if (len == mxlen)
                  mxnum++;
             bal--;
        }
        else
            d[0] = INF;
    }

    cout<<mxlen<<" "<<mxnum<<endl;

    {int n; cin>>n;}
    return 0;
}


#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef set<int> si;

const int N = 1000*1000 + 2;
int main()
{
	char * s = new char [N];
	cin>>s;
	int l = strlen(s);
	vi st;
	int mx = 0, c = 0;
	bool td = false;
	int len = 0;
	for (int i=0; i<l; i++)
	{
		if (s[i] == '(')
			st.push_back(i), len++;
		else
		{
			if (st.size())
			{
				int d=st[st.size()-1];
				st.pop_back();
				len++;
				if (len>mx)
					mx = len;
			}
			else
				c+= (len!=0);
		}
	}
	if (c==0)
		c = 1;
	cout<<mx<<" "<<c+td<<endl;
	return 0;
}


#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef set<int> si;

const int N = 1000*1000 + 2;
int main()
{
	char * s = new char [N];
	cin>>s;
	int l = strlen(s);
	vi st;
	int mx = 0, c = 0;
	bool td = false;
	for (int i=0; i<l; i++)
	{
		if (s[i] == '(')
			st.push_back(i);
		else
		{
			if (st.size())
			{
				int d=st[st.size()-1];
				st.pop_back();
				int len = i-d+1;
				if (len>mx)
					mx = len;
				td = true;
			}
			else
				c+=td,td=false;
		}
	}
	if (c==0)
		c = 1;
	cout<<mx<<" "<<c+td<<endl;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
#include <set>

using namespace std;

#define DB(n) cout<<#n<<" = "<<n<<" "
#define DBN(n) cout<<#n<<" = "<<n<<"\n"

typedef long long ll;
typedef pair<int, int> pii;

const int INF = 1000000000;
int d[1000001];

int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin>>s;

    int bal = 0;
    int mxlen = 0;
    int mxnum = 1;
    for (int i=0, e = s.length(); i<e; i++)
        d[i] = INF;

    for (int i=0, e = s.length(); i<e; i++) {
        if (s[i] == '(')
        {
           d[bal] = min(d[bal], i);
           bal++;
        }
        else if (bal > 0)
        {
             d[bal] = INF;
             bal--;
             int len = i-d[bal]+1;
             if (len > mxlen)
                mxlen = len, mxnum = 1;
             else if (len == mxlen)
                  mxnum++;
        }
        else
            d[0] = INF;
    }

    cout<<mxlen<<" "<<mxnum<<endl;

    {int n; cin>>n;}
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
#include <set>

using namespace std;

#define DB(n) cout<<#n<<" = "<<n<<" "
#define DBN(n) cout<<#n<<" = "<<n<<"\n"

typedef long long ll;
typedef pair<int, int> pii;

const int INF = 1000000000;
int d[1000001];

int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin>>s;

    int bal = 0;
    int mxlen = 0;
    int mxnum = 1;

    for (int i=0, e = s.length(); i<e; i++) {
        if (s[i] == '(')
        {
           bal++;
           d[bal] = i;
        }
        else if (bal > 0)
        {
             int len = i-d[bal]+1;
             if (len > mxlen)
                mxlen = len, mxnum = 1;
             else if (len == mxlen)
                  mxnum++;
             bal--;
        }
    }

    cout<<mxlen<<" "<<mxnum<<endl;

    {int n; cin>>n;}
    return 0;
}


#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef set<int> si;

const int N = 1000*1000 + 2;
int main()
{
	char * s = new char [N];
	cin>>s;
	int l = strlen(s);
	vi st;
	int mx = 0, c = 0;
	bool td = false;
	int a = 0;
	int b = 0;
	for (int i=0; i<l; i++)
	{
		if (s[i] == '(')
			st.push_back(i), a++;
		else
		{
			if (st.size())
			{
				int d=st[st.size()-1];
				st.pop_back();
				b++;
				if (min(a,b)*2>mx)
					mx = min(a,b)*2;
			}
			else
				c+= (min(a,b)!=0),a=0,b=0;
		}
	}
	c+=( min(a,b) !=0);
	if (c==0)
		c = 1;
	cout<<mx<<" "<<c+td<<endl;
	return 0;
}


#include <iostream>
#include <stack>
using namespace std;

stack<int> s;
string p;
int len = 0, c = 0, currentLen = 0;

int main() {
    cin >> p;
    for(int i = 0; i < p.size(); i++) {
        if(p[i] == '(')
           s.push(1);
        if(p[i] == ')' && !s.empty()) {
            currentLen++;
            s.pop();
        }
        if(s.empty() && p[i] == ')') {
            if((currentLen * 2) > len) {
                len = currentLen * 2;
                c = 1;
            }
            else if(currentLen * 2 == len) {
                c++;
            }
            currentLen = 0;
        }
    }
    cout << len << " " << (len > 0 ? c : 1) << endl;
}


#include <iostream>
#include <stack>
using namespace std;

stack<int> s;
string p;
int len = 0, c = 0, currentLen = 0, invalid = 0;

int main() {
    cin >> p;
    for(int i = 0; i < p.size(); i++) {
        if(p[i] == '(')
           s.push(1);
        if(p[i] == ')' && !s.empty()) {
            currentLen++;
            s.pop();
            invalid = 0;
        }
        if(s.empty() && p[i] == ')') {
            if((currentLen * 2) > len && !invalid) {
                len = currentLen * 2;
                c = 1;
            }
            else if(currentLen * 2 == len && !invalid) {
                c++;
            }
            if(invalid)
                currentLen = 0;
            invalid++;
        }
    }
    cout << len << " " << (len > 0 ? c : 1) << endl;
}


#include <iostream>
#include <stack>
using namespace std;

stack<int> s;
string p;
int len = 0, c = 0, currentLen = 0, invalid = 0;

int main() {
    cin >> p;
    s.push(-1);
    for(int i = 0; i < p.size(); i++) {
        if(p[i] == '(') {
                s.push(i);
        }
        else {
            s.pop();
            if(!s.empty()) {
                currentLen = i - s.top();
                if(currentLen >= len) {
                    if(len == currentLen)
                        c++;
                    else {
                        len = currentLen;
                        c = 1;
                    }
                }
            }
            else {
                s.push(i);
            }
        }
    }
    cout << len << " " << c << endl;
}


#include <iostream>
#include <stack>
using namespace std;

stack<int> s;
string p;
int len = 0, c = 1, currentLen = 0, invalid = 0;

int main() {
    cin >> p;
    s.push(-1);
    for(int i = 0; i < p.size(); i++) {
        if(p[i] == '(') {
                s.push(i);
        }
        else {
            s.pop();
            if(!s.empty()) {
                currentLen = i - s.top();
                if(currentLen >= len) {
                    if(len == currentLen)
                        c++;
                    else {
                        len = currentLen;
                        c = 1;
                    }
                }
            }
            else {
                s.push(i);
            }
        }
    }
    cout << len << " " << c << endl;
}


#include <iostream>
#include <stack>
using namespace std;

stack<int> s;
string p;
int len = 0, c = 0, currentLen = 0, invalid = 0;

int main() {
    cin >> p;
    for(int i = 0; i < p.size(); i++) {
        if(p[i] == '(')
           s.push(1);
        if(p[i] == ')' && !s.empty()) {
            currentLen++;
            s.pop();
            invalid = 0;
            if((currentLen * 2) > len) {
                len = currentLen * 2;
                c = 1;
            }
            else if(currentLen * 2 == len) {
                c++;
            }
        }
        else if(p[i] == ')' && s.empty()) {
            currentLen = 0;
        }
    }
    cout << len << " " << (len > 0 ? c : 1) << endl;
}


#include <iostream>
#include <stack>
using namespace std;

stack<int> s;
string p;
int len = 0, c = 1, currentLen = 0;

int main() {
    cin >> p;
    for(int i = 0; i < p.size(); i++) {
        if(p[i] == '(')
           s.push(1);
        if(p[i] == ')' && !s.empty()) {
            currentLen++;
            s.pop();
        }
        if(s.empty() && p[i] == ')') {
            if((currentLen * 2) > len) {
                len = currentLen * 2;
                c = 1;
            }
            else if(currentLen * 2 == len) {
                c++;
            }
            currentLen = 0;
        }
    }
    printf("%d %d\n", len, c);
}


#include <iostream>
#include <stack>
using namespace std;

stack<int> s;
string p;
int len = 0, c = 0, currentLen = 0, invalid = 0;

int main() {
    cin >> p;
    for(int i = 0; i < p.size(); i++) {
        if(p[i] == '(')
           s.push(1);
        if(p[i] == ')' && !s.empty()) {
            currentLen++;
            s.pop();
            invalid = 0;
            if((currentLen * 2) > len) {
                len = currentLen * 2;
                c = 1;
            }
            else if(currentLen * 2 == len) {
                c++;
            }
            if(p[i] == ')' && s.empty()) {
                currentLen = 0;
            }
        }
    }
    cout << len << " " << (len > 0 ? c : 1) << endl;
}


#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
long long a[1000002];
int main()
{
    char c[1000002];
    scanf("%s",&c);
    long long maxx=0,j=1;
    bool opada=false;
    int sum=0;
    long long mid=0,i;
    long long indix=0;
    memset(a,0,sizeof a);
    a[mid]=-3;
    for(i=1; i<=strlen(c); i++)
    {

        if(c[i-1]=='(')
            indix++;
        else
        {
            if(indix==0)
            {

                memset(a,0,sizeof a);

            }
            else
            {

                a[indix]+=a[indix+1]+1;
                a[indix+1]=0;
                indix--;
                 if(a[indix+1]>maxx)
                {
                    maxx=a[indix+1];
                    j=1;
                }
                else if(a[indix+1]==maxx&&maxx!=0)
                {
                    j++;

                }
            }

        }

    }
    /*
    for(i=1; i<=c.length(); i++)
    {
        if(a[i]>maxx)
        {
            maxx=a[i];
            j=1;
        }
        else if(a[i]==maxx&&maxx!=0)
        {
            j++;
        }
    }
    */
   printf("%d",2*maxx);
   printf(" %d",j);

    return 0;
}


#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
long long a[1000002];
int main()
{
    char c[1000002];
    long long maxx=0,j=1;
    bool opada=false;
    int sum=0;
    long long mid=0,i;
    long long indix=0;
    scanf("%s",&c);

    for(i=1; i<=strlen(c); i++)
    {

        if(c[i-1]=='(')
            indix++;
        else
        {
            if(indix==0)
            {
                mid=a[indix+1];
            }
            else
            {

                a[indix]+=(a[indix+1]+1-mid);
                mid=0;
                a[indix+1]=0;
                indix--;

                 if(a[indix+1]>maxx)
                {
                    maxx=a[indix+1];
                    j=1;
                }
                else if(a[indix+1]==maxx&&maxx!=0)
                {
                    j++;

                }
            }

        }

    }

   printf("%d",2*maxx);
   printf(" %d",j);

    return 0;
}


#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
stack <string> s;
long long a[1000002];
int main()
{
    string c;
    cin>>c;
    long long maxx=0,j=1;
    bool opada=false;
    int sum=0;
    long long mid=0,i;
    long long indix=0;
    memset(a,0,sizeof a);
    a[mid]=-3;
    for(i=1; i<=c.length(); i++)
    {

        if(c[i-1]=='(')
            indix++;
        else
        {
            if(indix==0)
            {

                memset(a,0,sizeof a);

            }
            else
            {

                a[indix]+=a[indix+1]+1;
                a[indix+1]=0;
                indix--;
                 if(a[indix+1]>maxx)
                {
                    maxx=a[indix+1];
                    j=1;
                    opada=true;
                }
                else if(a[indix+1]==maxx&&maxx!=0)
                {
                    j++;
                    opada=true;
                }
            }

        }

    }
    /*
    for(i=1; i<=c.length(); i++)
    {
        if(a[i]>maxx)
        {
            maxx=a[i];
            j=1;
        }
        else if(a[i]==maxx&&maxx!=0)
        {
            j++;
        }
    }
    */
    cout<<maxx*2<<" "<<j;

    return 0;
}


#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
stack <string> s;
long long a[1000002];
int main()
{
    string c;
    cin>>c;
    long long maxx=0,j=1;
    int sum=0;
    long long mid=0,i;
    long long indix=0;
    memset(a,0,sizeof a);
    a[mid]=-3;
    for(i=1; i<=c.length(); i++)
    {

        if(c[i-1]=='(')
            indix++;
        else
        {
            if(indix==0)
            {
                if(a[indix+1]>maxx)
                {
                    maxx=a[indix+1];
                    j=1;
                }
                else if(a[indix+1]==maxx&&maxx!=0)
                {
                    j++;
                }
                memset(a,0,sizeof a);

            }
            else
            {

                a[indix]+=a[indix+1]+1;
                a[indix+1]=0;
                indix--;
                 if(a[indix+1]>maxx)
                {
                    maxx=a[indix+1];
                    j=1;
                }
                else if(a[indix]+1==maxx&&maxx!=0)
                {
                    j++;
                }
            }

        }

    }
    /*
    for(i=1; i<=c.length(); i++)
    {
        if(a[i]>maxx)
        {
            maxx=a[i];
            j=1;
        }
        else if(a[i]==maxx&&maxx!=0)
        {
            j++;
        }
    }
    */
    cout<<maxx*2<<" "<<j;

    return 0;
}


#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
stack <string> s;
long long a[1000002];
int main()
{
    string c;
    cin>>c;
    long long maxx=0,j=1;
    bool opada=false;
    int sum=0;
    long long mid=0,i;
    long long indix=0;
    memset(a,0,sizeof a);
    a[mid]=-3;
    for(i=1; i<=c.length(); i++)
    {

        if(c[i-1]=='(')
            indix++;
        else
        {
            if(indix==0)
            {

                memset(a,0,sizeof a);

            }
            else
            {

                a[indix]+=a[indix+1]+1;
                a[indix+1]=0;
                indix--;
                 if(a[indix+1]>maxx)
                {
                    maxx=a[indix+1];
                    j=1;
                    opada=true;
                }
                else if(a[indix]+1==maxx&&maxx!=0)
                {
                    j++;
                    opada=true;
                }
            }

        }

    }
    /*
    for(i=1; i<=c.length(); i++)
    {
        if(a[i]>maxx)
        {
            maxx=a[i];
            j=1;
        }
        else if(a[i]==maxx&&maxx!=0)
        {
            j++;
        }
    }
    */
    cout<<maxx*2<<" "<<j;

    return 0;
}


#include<iostream>
#include<string>
using namespace std;
main()
{
    int i,j,p,q,r;
    string s;
    cin>>s;
    j=0;
    p=0;
    q=0;
    r=0;
    for(i=0;i<s.length();i++)
    {
        if(s[i]=='(')
        {
            j++;
        }
        else{
            j--;
            if(j>=0)
            {
                q++;
                if(q>p)
                {
                    p=q;
                    r=1;
                }
                else if(q==p)
                {
                    r++;
                }
            }
            else{j=0; q=0;}
        }
    }
    cout<<2*p<<r;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
main()
{
    int i,j,k,p,q,r;
    string s;
    cin>>s;
    vector<int> a,c;
    j=0,r=0,p=0,q=0, a.push_back(0);

    for(i=0;i<s.length();i++)
    {
    if(s[i]=='(')
    {
        if(c.size()<j+1) c.push_back(i);
       else c[j]=i; j++; a.push_back(0);
    }
    else
    {
    j--;
    if(j>=0)
    {
     q=i-c[j]+1;
     q=q+a[c[j]];
     if(q>p){r=1; p=q;}
     else if(p==q){r++; } a.push_back(q);
    }
    else
    {
        j=0; q=0; a.push_back(0);
    }
    }
    }
    if(p>0)
   cout<<p<<" "<<r; else cout<<"0 1";
    return 0;
}


#include<iostream>
#include<string>
using namespace std;
main()
{
    int i,j,p,q,r;
    string s;
    cin>>s;
    j=0;
    p=0;
    q=0;
    r=0;
    for(i=0;i<s.length();i++)
    {
        if(s[i]=='(')
        {
            j++;
        }
        else{
            j--;
            if(j>=0)
            {
                q++;
                if(q>p)
                {
                    p=q;
                    r=1;
                }
                else if(q==p)
                {
                    r++;
                }
            }
            else{j=0; q=0;}
        }
    }
    if(p>0)
    cout<<2*p<<" "<<r;
    else cout<<"0 1";
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
int pos[MAXN];
int qu[MAXN];
int top;
int main()
{
    scanf("%s",cs+1);
    cs[0]='a';
    N=strlen(cs);
    int i,j;
    int zuo=0;
    REP(i,N) pos[i]=-1;
    top=0;
    pos[0]=0;qu[top++]=0;
    int ret=0,cnt=1;
    for(i=1;i<N;i++)
    {
        if(cs[i]=='(')
        {
            zuo++;
            if(pos[zuo]==-1) pos[zuo]=i,qu[top++]=zuo;
        }
        else
        {
            zuo--;
            if(zuo<0)
            {
                REP(j,top) pos[qu[j]]=-1;
                top=0;
                zuo=0,pos[0]=i,qu[top++]=0;
            }
            else
            {
                if(ret<i-pos[zuo]) ret=i-pos[zuo],cnt=1;
                else if(ret==i-pos[zuo]) cnt++;
            }
        }
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
int pos[MAXN];
int qu[MAXN];
int top;
int main()
{
    scanf("%s",cs+1);
    cs[0]='a';
    N=strlen(cs);
    int i,j;
    int zuo=0;
    REP(i,N) pos[i]=-1;
    top=0;
    pos[0]=0;qu[top++]=0;
    int ret=0,cnt=1;
    for(i=1;i<N;i++)
    {
        if(cs[i]=='(')
        {
            zuo++;
            if(pos[zuo]==-1) pos[zuo]=i,qu[top++]=zuo;
        }
        else
        {
            zuo--;
            if(zuo<0)
            {
                REP(j,top) pos[qu[j]]=-1;
                top=0;
                zuo=0,pos[0]=i,qu[top++]=0;
            }
            else if(pos[zuo]!=-1)
            {
                if(ret<i-pos[zuo]) ret=i-pos[zuo],cnt=1;
                else if(ret==i-pos[zuo]) cnt++;
                pos[zuo+1]=-1;
            }
        }
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
typedef struct node
{
    char c;
    int pos;
}node;
node stk[MAXN];
int main()
{
    scanf("%s",cs);
    N=strlen(cs);
    int i,j;
    int ret=0,cnt=1;
    int top=0;
    REP(i,N)
    {
        if(cs[i]=='(') stk[top].c=cs[i],stk[top++].pos=i;
        else
        {
            if(top>0)
            {
                int tret=i-stk[--top].pos+1;
                if(tret>ret) ret=tret,cnt=1;
                else if(tret==ret) cnt++;
            }
        }
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
typedef struct node
{
    char c;
    int pos;
}node;
node stk[MAXN];
pair<int,int> a[MAXN];
int main()
{
    scanf("%s",cs);
    N=strlen(cs);
    int i,j;
    int ret=0,cnt=1;
    int top=0;
    int atop=0;
    REP(i,N)
    {
        if(cs[i]=='(') stk[top].c=cs[i],stk[top++].pos=i;
        else
        {
            if(top>0)
            {
                int fs=stk[--top].pos;
                int sd=i;
                for(j=atop-1;j>=0;j--)
                {
                    if(a[j].first>=fs&a[j].second<=sd) continue;
                    else break;
                }
                atop=j+1;
                a[atop].first=fs;
                a[atop++].second=sd;
            }
        }
    }
    sort(a,a+atop);
    int tl=0;
    int ted=-2;
    REP(i,atop)
    {
        if(ted+1!=a[i].first) tl=0;
        tl+=a[i].second-a[i].first+1;
        if(ret<tl) ret=tl,cnt=1;
        else if(ret==tl) cnt++;
        ted=a[i].second;
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
int pos[MAXN];
int qu[MAXN];
int top;
int main()
{
    scanf("%s",cs+1);
    cs[0]='a';
    N=strlen(cs);
    int i,j;
    int zuo=0;
    REP(i,N) pos[i]=-1;
    pos[0]=0;qu[top++]=0;
    int ret=0,cnt=1;
    for(i=1;i<N;i++)
    {
        if(cs[i]=='(')zuo++;
        else zuo--;
        if(zuo<0)
        {
            REP(j,top) pos[qu[j]]=-1;
            top=0;
            zuo=0,pos[0]=i,qu[top++]=0;
        }
        else
        {
            if(pos[zuo]!=-1)
            {
                if(ret<i-pos[zuo]) ret=i-pos[zuo],cnt=1;
                else if(ret==i-pos[zuo]) cnt++;
            }
            else pos[zuo]=i,qu[top++]=zuo;
        }
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
typedef struct node
{
    char c;
    int pos;
}node;
node stk[MAXN];
pair<int,int> a[MAXN];
int main()
{
    scanf("%s",cs);
    N=strlen(cs);
    int i,j;
    int ret=0,cnt=1;
    int top=0;
    int atop=0;
    REP(i,N)
    {
        if(cs[i]=='(') stk[top].c=cs[i],stk[top++].pos=i;
        else
        {
            if(top>0)
            {
                a[atop].first=stk[--top].pos;
                a[atop++].second=i;
            }
        }
    }
    sort(a,a+atop);
    int tl=0;
    int ted=-2;
    REP(i,atop)
    {
        if(ted+1!=a[i].first) tl=0;
        tl+=a[i].second-a[i].first+1;
        if(ret<tl) ret=tl,cnt=1;
        else if(ret==tl) cnt++;
        ted=a[i].second;
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
typedef struct node
{
    char c;
    int pos;
}node;
node stk[MAXN];
int a[MAXN];
int main()
{
    scanf("%s",cs);
    N=strlen(cs);
    int i,j;
    int ret=0,cnt=1;
    int top=1;clr(a);stk[0].pos=-1;
    REP(i,N)
    {
        if(cs[i]=='(') stk[top].c=cs[i],stk[top++].pos=i;
        else
        {
            if(top>1)
            {
                top--;
                int r=i-stk[top-1].pos;
                if(r>ret)ret=r,cnt=1;
                else if(r==ret) cnt++;
            }
            else stk[0].pos=i;
        }
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
int pos[MAXN];
int qu[MAXN];
int top;
int main()
{
    scanf("%s",cs+1);
    cs[0]='a';
    N=strlen(cs);
    int i,j;
    int zuo=0;
    REP(i,N) pos[i]=-1;
    top=0;
    pos[0]=0;qu[top++]=0;
    int ret=0,cnt=1;
    for(i=1;i<N;i++)
    {
        if(cs[i]=='(')
        {
            zuo++;
            if(pos[zuo]!=-1) pos[zuo]=i,qu[top++]=zuo;
        }
        else
        {
            zuo--;
            if(zuo<0)
            {
                REP(j,top) pos[qu[j]]=-1;
                top=0;
                zuo=0,pos[0]=i,qu[top++]=0;
            }
            else
            {
                if(ret<i-pos[zuo]) ret=i-pos[zuo],cnt=1;
                else if(ret==i-pos[zuo]) cnt++;
            }
        }
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
int pos[MAXN];
int qu[MAXN];
int top;
int main()
{
    scanf("%s",cs+1);
    cs[0]='a';
    N=strlen(cs);
    int i,j;
    int zuo=0;
    REP(i,N) pos[i]=-1;
    top=0;
    pos[0]=0;qu[top++]=0;
    int ret=0,cnt=1;
    for(i=1;i<N;i++)
    {
        if(cs[i]=='(')zuo++;
        else zuo--;
        if(zuo<0)
        {
            REP(j,top) pos[qu[j]]=-1;
            top=0;
            zuo=0,pos[0]=i,qu[top++]=0;
        }
        else
        {
            if(pos[zuo]!=-1)
            {
                if(cs[i]==')')
                {
                if(ret<i-pos[zuo]) ret=i-pos[zuo],cnt=1;
                else if(ret==i-pos[zuo]) cnt++;
                }
            }
            else pos[zuo]=i,qu[top++]=zuo;
        }
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define   max(a,b)    ((a)>(b)?(a):(b))
#define   min(a,b)    ((a)<(b)?(a):(b))
#define   sqr(a)         ((a)*(a))
#define   rep(i,a,b)  for(i=(a);i<(b);i++)
#define   per(i,a,b)  for(i=((a)-1);i>=(b);i--)
#define   PER(i,n)     per(i,n,0)
#define   REP(i,n)     rep(i,0,n)
#define   clr(a)      memset((a),0,sizeof (a));
#define   mabs(a)     ((a)>0?(a):(-(a)))
#define   inf         1000000001
#define  MAXN     1000010
#define  eps      1e-6
int N,M;
char cs[MAXN];
int pos[MAXN];
int qu[MAXN];
int top;
int main()
{
    scanf("%s",cs+1);
    cs[0]='a';
    N=strlen(cs);
    int i,j;
    int zuo=0;
    REP(i,N) pos[i]=-1;
    top=0;
    pos[0]=0;qu[top++]=0;
    int ret=0,cnt=1;
    for(i=1;i<N;i++)
    {
        if(cs[i]=='(')zuo++;
        else zuo--;
        if(zuo<0)
        {
            REP(j,top) pos[qu[j]]=-1;
            top=0;
            zuo=0,pos[0]=i,qu[top++]=0;
        }
        else
        {
            if(pos[zuo]!=-1)
            {
                if(ret<i-pos[zuo]) ret=i-pos[zuo],cnt=1;
                else if(ret==i-pos[zuo]) cnt++;
            }
            else pos[zuo]=i,qu[top++]=zuo;
        }
    }
    printf("%d %d\n",ret,cnt);
    return 0;
}


/*
        ID : pallab81
        PROG : bracket.cxx
        LANG : C++

        "I have not failed, I have just found 10000 ways that won't work.
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define  CI( x ) scanf( "%d", &x )
#define  CL( x ) scanf( "%I64d", &x )
#define  CF( x ) scanf( "%f",&x)
#define  CD( x ) scanf( "%lf",&x)

#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip char ch;\
      ch = getchar() ;
#define mk make_pair
#define f first
#define s second
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define ll long long
#define IO ifstream cin(".in") ; ofstream cout(".out");

string ss;
map< int,int,  greater<int> > mp;
int ln;
inline void in(){
        cin>>ss;
      //  ss+=')';
        ln = LN(ss);
        mp.clear();
return ;
}

inline void re(int i, int hw, stack<char>& st){
//       printf("nw indx %d , nw sign %c , nw hw %d \n",i,ss[i],hw);bip

       if(i>=ln)return ;
       if(ss[i]=='('){
                st.push('(');
                re(i+1,hw,st);
       }
       else{
                if(ss[i]==')'){
                        if(st.empty()){
//                                cout<<"found : "<<hw<<" "<<i<<"\n";bip
                                re(i+1,0,st);
                        }
                        else{
                                ++hw;
                                mp[hw*2]++;
                                st.pop();
                                re(i+1,hw,st);
                        }
                }
       }
return ;
}

int main(){
        in();
        stack<char> st;
        re(0,0,st);
        int hw = (*mp.begin()).f ;
        int many = (*mp.begin()).s ;
        if(hw==0)many=1;
        cout<< hw <<" "<< many <<"\n";
return 0;
}


/*
ID: pallab81
PROG:
LANG: C++
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <cmath>

using namespace std;
#define p system("pause")
#define MX (1<<29)
#define MN (-1*MX)
#define ABS(x) ( (x) < (0) ? -(x) : (x) )
#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define PAIR pair<int,int>
#define VP vector<PAIR >
#define fo(i,st,ed) for(int i = st; i < ed ; ++i)
#define L_P list<PAIR >
#define debug(x,y) if(x<0 || x>=y) { cerr<<x<<" Error in line : "<<__LINE__<<'\n' ; p; continue ; }
#define IO ifstream cin(".in") ; ofstream cout(".out");
#define CL(x) (double(x))/CLOCKS_PER_SEC
#define pb push_back
#define mk make_pair
#define f first
#define s second

int mx;
map<int,int> mp;

inline void input(){
    mx=0;
    mp.clear();
    queue<char>q;
    string ss="";
    getline(cin,ss);

    int pop,push,res;
    res=0;
    push=1;
    fo(i,0,(int)ss.length()){
        if(ss[i]==')'){
            if(q.empty()){
//                cout<<"Nothing is intering..."<<endl;
                continue;
            }
//            cout<<"Poping ..."<<endl;
            q.pop();
            res++;
            mp[res]++;
            mx = max(res,mx);
            push=1;
        }
        else{
//            cout<<"Pusing ..."<<endl;
            q.push(ss[i]);
            push=0;
        }

        if(!push && (int)q.size()==1){
  //          cout<<res<<endl;p;
            res=0;
        }
    }

    if(mx==0){
        cout<<0<<' '<<1<<endl;
    }
    else{
        cout<<(mx*2)<<' '<<mp[mx]<<endl;
    }
return ;
}

int main(){
    input();
//p;
return 0;
}


/*
ID: pallab81
PROG:
LANG: C++
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <cmath>

using namespace std;
#define p system("pause")
#define MX (1<<29)
#define MN (-1*MX)
#define ABS(x) ( (x) < (0) ? -(x) : (x) )
#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define PAIR pair<int,int>
#define VP vector<PAIR >
#define fo(i,st,ed) for(int i = st; i < ed ; ++i)
#define L_P list<PAIR >
#define debug(x,y) if(x<0 || x>=y) { cerr<<x<<" Error in line : "<<__LINE__<<'\n' ; p; continue ; }
#define IO ifstream cin(".in") ; ofstream cout(".out");
#define CL(x) (double(x))/CLOCKS_PER_SEC
#define pb push_back
#define mk make_pair
#define f first
#define s second

int mx;
map<int,int> mp;

inline void input(){
    mx=0;
    mp.clear();
    queue<char>q;
    string ss="";
    getline(cin,ss);

    int pop,push,res;
    res=0;
    fo(i,0,(int)ss.length()){
//        if(q.empty())res=0;
        if(ss[i]==')'){
            if(q.empty()){
                res=0;
                continue;
            }
            q.pop();
            res++;
            mp[res]++;
            mx=max(res,mx);
        }
        if( ss[i]=='('){
            q.push(ss[i]);
        }
    }

    if(mx==0){
        cout<<0<<' '<<1<<endl;
    }
    else{
        cout<<(mx*2)<<' '<<mp[mx]<<endl;
    }
return ;
}

int main(){
    input();
//p;
return 0;
}


/*
ID: pallab81
PROG:
LANG: C++
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <cmath>

using namespace std;
#define p system("pause")
#define MX (1<<29)
#define MN (-1*MX)
#define ABS(x) ( (x) < (0) ? -(x) : (x) )
#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define PAIR pair<int,int>
#define VP vector<PAIR >
#define fo(i,st,ed) for(int i = st; i < ed ; ++i)
#define L_P list<PAIR >
#define debug(x,y) if(x<0 || x>=y) { cerr<<x<<" Error in line : "<<__LINE__<<'\n' ; p; continue ; }
#define IO ifstream cin(".in") ; ofstream cout(".out");
#define CL(x) (double(x))/CLOCKS_PER_SEC
#define pb push_back
#define mk make_pair
#define f first
#define s second

int mx;

inline void input(){
    mx=0;
    map<int,int> mp;
    queue<char>q;
    string ss="";
    getline(cin,ss);

    int pop,push,res;
    res=0;
    fo(i,0,(int)ss.length()){

        if(ss[i]==')'){
            if(q.empty()){
                res=0;
                continue;
            }
            q.pop();
            res+=2;
            mp[res]++;
            mx=max(res,mx);
        }
        if( ss[i]=='('){
            q.push(ss[i]);
        }
    }

    if(mx==0){
        cout<<0<<' '<<1<<endl;
    }
    else{
        cout<<(mx)<<' '<<mp[mx]<<endl;
    }
return ;
}

int main(){
    input();
//p;
return 0;
}


/*
ID: pallab81
PROG:
LANG: C++
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <cmath>

using namespace std;
#define p system("pause")
#define MX (1<<29)
#define MN (-1*MX)
#define ABS(x) ( (x) < (0) ? -(x) : (x) )
#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define PAIR pair<int,int>
#define VP vector<PAIR >
#define fo(i,st,ed) for(int i = st; i < ed ; ++i)
#define L_P list<PAIR >
#define debug(x,y) if(x<0 || x>=y) { cerr<<x<<" Error in line : "<<__LINE__<<'\n' ; p; continue ; }
#define IO ifstream cin(".in") ; ofstream cout(".out");
#define CL(x) (double(x))/CLOCKS_PER_SEC
#define pb push_back
#define mk make_pair
#define f first
#define s second

int mx;
map<int,int> mp;

inline void input(){
    mx=0;
    mp.clear();
    queue<char>q;
    string ss="";
    getline(cin,ss);

    int pop,push,res;
    res=0;
    fo(i,0,(int)ss.length()){
        if(q.empty())res=0;
        if(ss[i]==')'){
            if(q.empty())continue;
            q.pop();
            res++;
            mp[res]++;
            mx=max(res,mx);
        }
        if( ss[i]=='('){
            q.push(ss[i]);
        }
    }

    if(mx==0){
        cout<<0<<' '<<1<<endl;
    }
    else{
        cout<<(mx*2)<<' '<<mp[mx]<<endl;
    }
return ;
}

int main(){
    input();
//p;
return 0;
}


/*
ID: pallab81
PROG:
LANG: C++
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <cmath>

using namespace std;
#define p system("pause")
#define MX (1<<29)
#define MN (-1*MX)
#define ABS(x) ( (x) < (0) ? -(x) : (x) )
#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define PAIR pair<int,int>
#define VP vector<PAIR >
#define fo(i,st,ed) for(int i = st; i < ed ; ++i)
#define L_P list<PAIR >
#define debug(x,y) if(x<0 || x>=y) { cerr<<x<<" Error in line : "<<__LINE__<<'\n' ; p; continue ; }
#define IO ifstream cin(".in") ; ofstream cout(".out");
#define CL(x) (double(x))/CLOCKS_PER_SEC
#define pb push_back
#define mk make_pair
#define f first
#define s second

int res,mx;
map<int,int> mp;

inline bool check1(queue<char> q){
    if(q.empty())return false;
return true;
}

inline void input(){
    res=mx=0;
    mp.clear();
    char ch;
    queue<char>q;
    while((ch = getchar())){

        if(q.empty() && res){
            mx=max(mx,res);
            mp[res]++;
            //cout<<"Came to and end : "<<res<<" "<<mp[res]<<endl;p;
            res=0;
        }
        if(ch=='\n')break;

        if(ch==')'){
            if(!check1(q)){
                //cout<<"Nothing is intering..."<<endl;
                continue;
            }
            //cout<<"Poping ..."<<endl;
            q.pop();
            res++;
        }
        else{
            //cout<<"Pusing ..."<<endl;
            q.push(ch);
        }

    }
    if(mx==0){
        cout<<0<<' '<<1<<endl;
        return ;
    }
    cout<<(mx*2)<<' '<<mp[mx]<<endl;
return ;
}

int main(){
    input();
return 0;
}


/*
        ID : pallab81
        PROG : bracket.cxx
        LANG : C++

        "I have not failed, I have just found 10000 ways that won't work.
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define  CI( x ) scanf( "%d", &x )
#define  CL( x ) scanf( "%I64d", &x )
#define  CF( x ) scanf( "%f",&x)
#define  CD( x ) scanf( "%lf",&x)

#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip char ch;\
      ch = getchar() ;
#define mk make_pair
#define f first
#define s second
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define ll long long
#define IO ifstream cin(".in") ; ofstream cout(".out");

string ss;
int ln;
VI dp;

inline void in(){
        cin>>ss;
        ln = LN(ss);
return ;
}
inline void process(){
        dp.assign(ln+5,-1);
        stack<int> st;

        for (int i = 0; i < ln; ++i){
                if( ss[i]=='(' ){
                        st.push(i);
                }
                else{
                        if( st.empty()==false ){
                                dp[i]=st.top();st.pop();
                                int dif = i-dp[i]+1;
                                dp[i]=dif;
                        }
                }
        }

        int sum=0;
        for (int i = ln; ; ){
                if(i<=0){
                     dp[i+sum]=sum;
                     break;
                }
                else if(dp[i]!=-1){
                      sum+=dp[i];
                      i = i-dp[i];
                }
                else{
                      dp[i+sum]=sum;
                      sum=0;
                      --i;
                }
        }

        int mx = *max_element(dp.begin(),dp.end());
        int hwMany=0;
        for (int i = 0; i < ln; ++i){
                if(dp[i]==mx)++hwMany;
        }

        if(mx>=2){
                printf("%d %d\n",mx,hwMany);
        }
        else{
                printf("0 1\n");
        }

return ;
}
int main(){
        in();
        process();
return 0;
}


/*
        ID : pallab81
        PROG : bracket.cxx
        LANG : C++

        "I have not failed, I have just found 10000 ways that won't work.
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define  CI( x ) scanf( "%d", &x )
#define  CL( x ) scanf( "%I64d", &x )
#define  CF( x ) scanf( "%f",&x)
#define  CD( x ) scanf( "%lf",&x)

#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip char ch;\
      ch = getchar() ;
#define mk make_pair
#define f first
#define s second
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define ll long long
#define IO ifstream cin(".in") ; ofstream cout(".out");

string ss;
map< int,int,  greater<int> > mp;
int ln;
inline void in(){
        cin>>ss;
      //  ss+=')';
        ln = LN(ss);
        mp.clear();
return ;
}

inline void re(int i, int hw, stack<char>& st){
//       printf("nw indx %d , nw sign %c , nw hw %d \n",i,ss[i],hw);bip

       if(i>=ln)return ;
       if(ss[i]=='('){
                st.push('(');
                re(i+1,hw,st);
       }
       else{
                if(ss[i]==')'){
                        if(st.empty()){
                                re(i+1,0,st);
                        }
                        else{
                                ++hw;
                                mp[hw*2]++;
                                st.pop();
                                if(st.empty())hw=0;
                                re(i+1,hw,st);
                        }
                }
       }
return ;
}

int main(){
        in();
        stack<char> st;
        re(0,0,st);
        int hw = (*mp.begin()).f ;
        int many = (*mp.begin()).s ;
        if(hw==0)many=1;
        cout<< hw <<" "<< many <<"\n";
return 0;
}


/*
        ID : pallab81
        PROG : bracket.cxx
        LANG : C++

        "I have not failed, I have just found 10000 ways that won't work.
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define  CI( x ) scanf( "%d", &x )
#define  CL( x ) scanf( "%I64d", &x )
#define  CF( x ) scanf( "%f",&x)
#define  CD( x ) scanf( "%lf",&x)

#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip char ch;\
      ch = getchar() ;
#define mk make_pair
#define f first
#define s second
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define ll long long
#define IO ifstream cin(".in") ; ofstream cout(".out");

string ss;
map< int,int,  greater<int> > mp;
int ln;
inline void in(){
        cin>>ss;
        ss+=')';
        ln = LN(ss);
        mp.clear();
return ;
}

inline void re(int i, int hw, stack<char>& st){
//       printf("nw indx %d , nw sign %c , nw hw %d \n",i,ss[i],hw);bip

       if(i>=ln)return ;
       if(ss[i]=='('){
                st.push('(');
                re(i+1,hw+1,st);
       }
       else{
                if(ss[i]==')'){
                        if(st.empty()){
//                                cout<<"found : "<<hw<<" "<<i<<"\n";bip
                                mp[hw]++;
                                re(i+1,0,st);
                        }
                        else{
                                st.pop();
                                re(i+1,hw+1,st);
                        }
                }
       }
return ;
}

int main(){
        in();
        stack<char> st;
        re(0,0,st);
        int hw = (*mp.begin()).f ;
        int many = (*mp.begin()).s ;
        if(hw==0)many=1;
        cout<< hw <<" "<< many <<"\n";
return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char in[1000005]={0};
long long int d[100003]={0};
long long int c[100003]={0};
long long int t[100003]={0};
long long int stack[100003]={0};
long long int i=0,j=0,pos=0,big=-1,cnt=0;
int main () {
    cin.getline(in,1000003);
    for(i=0;i<strlen(in);i++){
        if(in[i]=='('){
            pos++;
            stack[pos]=i;
            c[i]=-1;
            d[i]=-1;
        }
        else if (in[i]==')'){
            if(pos==0){
                d[i]=-1;
                c[i]=-1;
            }
            else{
                d[i]=stack[pos];
                pos--;
                if(c[d[i]-1]!=-1&&in[d[i]-1]==')'){
                    c[i]=c[d[i]-1];
                }
                else{
                    c[i]=d[i];
                }
            }
        }
        if (c[i]!=-1)   t[i]=i-c[i]+1;
        if(t[i]>big&&t[i]>1){big=t[i];cnt=1;}
        else if(t[i]==big){cnt++;}
    }
    if(big==-1){printf("0 1\n");return 0;}
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char in[1000005]={0};
long long int d[100003]={0};
long long int c[100003]={0};
long long int t[100003]={0};
long long int stack[100003]={0};
long long int i=0,j=0,pos=0,big=-1,cnt=0;
int main () {
    cin.getline(in,1000003);
    ios_base::sync_with_stdio(false);
    for(i=0;i<strlen(in);i++){
        if(in[i]=='('){
            pos++;
            stack[pos]=i;
            c[i]=-1;
            d[i]=-1;
        }
        else if (in[i]==')'){
            if(pos==0){
                d[i]=-1;
                c[i]=-1;
            }
            else{
                d[i]=stack[pos];
                pos--;
                if(c[d[i]-1]!=-1&&in[d[i]-1]==')'){
                    c[i]=c[d[i]-1];
                }
                else{
                    c[i]=d[i];
                }
            }
        }
        if (c[i]!=-1)   t[i]=i-c[i]+1;
        if(t[i]>big&&t[i]>1){big=t[i];cnt=1;}
        else if(t[i]==big){cnt++;}
    }
    if(big==-1){printf("0 1\n");return 0;}
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char in[1000005]={0};
long long int d[100003]={0};
long long int c[100003]={-1};
long long int t[100003]={0};
long long int stack[100003]={0};
long long int i=0,j=0,pos=0,big=-1,cnt=0;
int main () {
    cin.getline(in,1000003);
    for(i=0;i<strlen(in);i++){
        if(in[i]=='('){
            pos++;
            stack[pos]=i;
            c[i]=-1;
            d[i]=-1;
        }
        else if (in[i]==')'){
            if(pos==0){
                d[i]=-1;
                c[i]=-1;
            }
            else{
                d[i]=stack[pos];
                pos--;
                if(c[d[i]-1]!=-1&&in[d[i]-1]==')'){
                    c[i]=c[d[i]-1];
                }
                else{
                    c[i]=d[i];
                }
            }
        }
    }
    for(i=0;i<strlen(in);i++){

        if (c[i]!=-1)
        t[i]=i-c[i]+1;
        //printf("%d\n",t[i]);
        if(t[i]>big&&t[i]>1){big=t[i];}
    }
    for(i=0;i<strlen(in);i++){
        if(t[i]==big){cnt++;}
    }
    if(big==-1){printf("0 1\n");return 0;}
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char in[1000005]={0};
long long int d[1000003]={0};
long long int c[1000003]={0};
long long int t[1000003]={0};
long long int stack[1000003]={0};
long long int i=0,j=0,pos=0,big=-1,cnt=0,length=0;
int main () {
    cin.getline(in,1000003);
    length=strlen(in);
    for(i=0;i<length;i++){
        if(in[i]=='('){
            pos++;
            stack[pos]=i;
            c[i]=-1;
            d[i]=-1;
        }
        else if (in[i]==')'){
            if(pos==0){
                d[i]=-1;
                c[i]=-1;
            }
            else{
                d[i]=stack[pos];
                pos--;
                if(d[i]-1>-1)
                    if(c[d[i]-1]!=-1&&in[d[i]-1]==')'){
                        c[i]=c[d[i]-1];
                    }
                else{
                    c[i]=d[i];
                }
            }
        }
        if (c[i]!=-1)   t[i]=i-c[i]+1;
        if(t[i]>big&&t[i]>1){big=t[i];cnt=1;}
        else if(t[i]==big){cnt++;}
    }
    if(big==-1){printf("0 1\n");return 0;}
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char s[1000005]={0};
long long int i=0,tmp=0,length=0,tmpa=0,answer=-1,f[1000002]={0},big=-1,cnt=0,open=0,close=0;
int main () {
    cin.getline(s,1000003);
    length=strlen(s);
    for(i=0;i<=length;i++){
        tmp=i;
        open=0;
        close=0;
            if(s[tmp]=='('){open++;}
        while(open>0&&tmp<=length){
            if(s[tmp]=='('){open++;}
            else if(s[tmp]==')'){open--;}
            tmp++;
        }
        f[i]=tmp-i-1;
        if(f[i]>big&&f[i]>1){big=f[i];}
    }
    if(big==-1){printf("0 1\n");return 0;}
    for(i=0;i<length;i++){
        if(f[i]==big){
            cnt++;
            //printf("%d\n",i);
        }
    }
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char in[1000005]={0};
long long int d[100003]={0};
long long int c[100003]={-1};
long long int t[100003]={0};
long long int stack[100003]={0};
long long int i=0,j=0,pos=0,big=-1,cnt=0;
int main () {
    cin.getline(in,1000003);
    for(i=0;i<strlen(in);i++){
        if(in[i]=='('){
            pos++;
            stack[pos]=i;
            c[i]=-1;
            d[i]=-1;
        }
        else if (in[i]==')'){
            if(pos==0){
                d[i]=-1;
                c[i]=-1;
            }
            else{
                d[i]=stack[pos];
                pos--;
                if(c[d[i]-1]!=-1&&in[d[i]-1]==')'){
                    c[i]=c[d[i]-1];
                }
                else{
                    c[i]=d[i];
                }
            }
        }
        if (c[i]!=-1)   t[i]=i-c[i]+1;
        if(t[i]>big&&t[i]>1){big=t[i];cnt=1;}
        else if(t[i]==big){cnt++;}
    }
    if(big==-1){printf("0 1\n");return 0;}
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char in[1000005]={0};
long long int d[100003]={0};
long long int c[100003]={0};
long long int t[100003]={0};
long long int stack[100003]={0};
long long int i=0,j=0,pos=0,big=-1,cnt=0,length=0;
int main () {
ios_base::sync_with_stdio(false);
    cin.getline(in,1000003);
    length=strlen(in);
    for(i=0;i<length;i++){
        if(in[i]=='('){
            pos++;
            stack[pos]=i;
            c[i]=-1;
            d[i]=-1;
        }
        else if (in[i]==')'){
            if(pos==0){
                d[i]=-1;
                c[i]=-1;
            }
            else{
                d[i]=stack[pos];
                pos--;
                if(d[i]-1>-1)
                    if(c[d[i]-1]!=-1&&in[d[i]-1]==')'){
                        c[i]=c[d[i]-1];
                    }
                else{
                    c[i]=d[i];
                }
            }
        }
        if (c[i]!=-1)   t[i]=i-c[i]+1;
        if(t[i]>big&&t[i]>1){big=t[i];cnt=1;}
        else if(t[i]==big){cnt++;}
    }
    if(big==-1){printf("0 1\n");return 0;}
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char in[1000005]={0};
long long int d[1000003]={0};
long long int c[1000003]={0};
long long int t[1000003]={0};
long long int stack[1000003]={0};
long long int i=0,j=0,pos=0,big=-1,cnt=0,length=0;
int main () {
ios_base::sync_with_stdio(false);
    cin.getline(in,1000003);
    length=strlen(in);
    for(i=0;i<length;i++){
        if(in[i]=='('){
            pos++;
            stack[pos]=i;
            c[i]=-1;
            d[i]=-1;
        }
        else if (in[i]==')'){
            if(pos==0){
                d[i]=-1;
                c[i]=-1;
            }
            else{
                d[i]=stack[pos];
                pos--;
                if(d[i]-1>-1)
                    if(c[d[i]-1]!=-1&&in[d[i]-1]==')'){
                        c[i]=c[d[i]-1];
                    }
                else{
                    c[i]=d[i];
                }
            }
        }
        if (c[i]!=-1)   t[i]=i-c[i]+1;
        if(t[i]>big&&t[i]>1){big=t[i];cnt=1;}
        else if(t[i]==big){cnt++;}
    }
    if(big==-1){printf("0 1\n");return 0;}
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char in[1000005]={0};
long long int d[100003]={0};
long long int c[100003]={0};
long long int t[100003]={0};
long long int stack[100003]={0};
long long int i=0,j=0,pos=0,big=-1,cnt=0,length=0;
int main () {
ios_base::sync_with_stdio(false);
    cin.getline(in,1000003);
    length=strlen(in);
    for(i=0;i<length;i++){
        if(in[i]=='('){
            pos++;
            stack[pos]=i;
            c[i]=-1;
            d[i]=-1;
        }
        else if (in[i]==')'){
            if(pos==0){
                d[i]=-1;
                c[i]=-1;
            }
            else{
                d[i]=stack[pos];
                pos--;
                if(d[i]!=0){
                    if(c[d[i]-1]!=-1&&in[d[i]-1]==')'){
                        c[i]=c[d[i]-1];
                    }
                }
                else{
                    c[i]=d[i];
                }
            }
        }
        if (c[i]!=-1)   t[i]=i-c[i]+1;
        if(t[i]>big&&t[i]>1){big=t[i];cnt=1;}
        else if(t[i]==big){cnt++;}
    }
    if(big==-1){printf("0 1\n");return 0;}
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include <fstream>
#include<cstring>
#include<cmath>
#include <string>
using namespace std;
char in[1000005]={0};
long long int d[100003]={0};
long long int c[100003]={0};
long long int t[100003]={0};
long long int stack[100003]={0};
long long int i=0,j=0,pos=0,big=-1,cnt=0,length=0;
int main () {
ios_base::sync_with_stdio(false);
    cin.getline(in,1000003);
    length=strlen(in);
    for(i=0;i<length;i++){
        if(in[i]=='('){
            pos++;
            stack[pos]=i;
            c[i]=-1;
            d[i]=-1;
        }
        else if (in[i]==')'){
            if(pos==0){
                d[i]=-1;
                c[i]=-1;
            }
            else{
                d[i]=stack[pos];
                pos--;
                if(c[d[i]-1]!=-1&&in[d[i]-1]==')'){
                    c[i]=c[d[i]-1];
                }
                else{
                    c[i]=d[i];
                }
            }
        }
        if (c[i]!=-1)   t[i]=i-c[i]+1;
        if(t[i]>big&&t[i]>1){big=t[i];cnt=1;}
        else if(t[i]==big){cnt++;}
    }
    if(big==-1){printf("0 1\n");return 0;}
    printf("%I64d %I64d\n",big,cnt);
    return 0;
}


#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;cin>>s;
    int f=0,d=0,p=0,y=0,len=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;

        if(d<p)d=p=len=0;
        else
        {
            len++;
            if(f<len&&d==p)
            {
                f=len;
                y=i;
            }
        }
    }
    if(f!=0)
    cout<<f<<" "<<y-f+2;
    else
        cout<<0<<" "<<1;
}


#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;cin>>s;
    int f=0,d=0,p=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;
        if(d<p) d=p=0;
        else if(f<2*p) f=2*p;
    }
    p=d=0;
    int g=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;
        if(d<p)d=p=0;
        else if(f==2*p)g++;
    }
    if(f!=0)
        cout<<f<<" "<<g;
    else
        cout<<0<<" "<<1;
}


#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;cin>>s;
    int f=0,d=0,p=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;
        if(d<p) d=p=0;
        else if(f<2*p) f=2*p;
    }
    p=d=0;
    int g=0,e=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;
        if(d<p)d=p=0;
        else if(e<=2*p)
        {
            e=2*p;
            if(f==2*p)g++;
        }
    }
    if(f!=0)
        cout<<f<<" "<<g;
    else
        cout<<0<<" "<<1;
}


#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;cin>>s;
    int f=0,d=0,p=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
         d++;
        if(d<p) d=p=0;
        else if(f<2*p) f=2*p;
    }
    p=d=0;
    int g=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;
        if(d<p)d=p=0;
        else
        {
            if(f==2*p){
            //  cout<<i<<" ";
                p=0;
                g++;
            }
        }
        //cout<<d<<" "<<p<<" "<<g<<endl;
    }
    if(f!=0)
        cout<<f<<" "<<g;
    else
        cout<<0<<" "<<1;
}


#include <string>
#include <vector>
#include <utility>
#include <iostream>
using namespace std;
string s;
vector<pair<char,int> >v;
int st = 1,ans = 0;
bool mark[1000000+10];
int main () {
	cin >> s;
	for(int i = 0 ; i < s.size() ; i++) {
		v.push_back(make_pair(s[i],i));
		while(v.size() > 1 && v[v.size()-1].first == ')' && v[v.size()-2].first == '(') {
		mark[v[v.size()-1].second] = 1; v.pop_back(); mark[v[v.size()-1].second] = 1; v.pop_back();
		}
	}
	for(int i = 0,j ; i < s.size(); i = j+1) {
		j = i;
		int x = 0;
		if(j < s.size() && mark[j]) { while(j < s.size() && mark[j]) j++,x++; if(x > ans) { ans = x; st = j-x+1; } j--; }
	}
	cout << ans << ' ' << st << endl;
	return 0;
}


#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;cin>>s;
    int f=0,d=0,p=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;
        if(d<p) d=p=0;
        else if(f<2*p) f=2*p;
    }
    p=d=0;
    int g=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;
        if(d<p)d=p=0;
        else
        {
            if(f==2*p){
            //  cout<<i<<" ";
                p=0;
                d=0;
                g++;
            }
        }
        //cout<<d<<" "<<p<<" "<<g<<endl;
    }
    if(f!=0)
        cout<<f<<" "<<g;
    else
        cout<<0<<" "<<1;
}


#include <string>
#include <vector>
#include <utility>
#include <iostream>
using namespace std;
string s;
vector<pair<char,int> >v;
int st = 1,ans = 0;
bool mark[1000000+10];
int main () {
    cin >> s;
    for(int i = 0 ; i < s.size() ; i++) {
        v.push_back(make_pair(s[i],i));
        while(v.size() > 1 && v[v.size()-1].first == ')' && v[v.size()-2].first == '(') {
        mark[v[v.size()-1].second] = 1; v.pop_back(); mark[v[v.size()-1].second] = 1; v.pop_back();
        }
    }
    for(int i = 0,j ; i < s.size(); i = j+1) {
        j = i;
        int x = 0;
        if(j < s.size() && mark[j]) { while(j < s.size() && mark[j]) j++,x++; if(x > ans) { ans = x; st = 1; } else if(x == ans) st++; j--; }
    }
    cout << ans << ' ' << st << endl;
    return 0;
}


#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;cin>>s;
    int f=0,d=0,p=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;
        if(d<p) d=p=0;
        else if(f<2*p) f=2*p;
    }
    p=d=0;
    int g=0,e=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==')')
            p++;
        else
            d++;
        if(d<p)d=p=0;
        else if(e<2*p)
        {
            e=2*p;
            if(f==2*p)g++;
        }
    }
    if(f!=0)
        cout<<f<<" "<<g;
    else
        cout<<0<<" "<<1;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

char str[1000001];
int len;

int main(void)
{
	scanf("%s", str);
	len=strlen(str);

	int opened=0, ans=-1, cnt=0, tempAns=0, lastAns=0, closed=0;
	bool justStart=false;
	for(int i=0;i<len;i++)
	{
		if(str[i]=='(') { opened++; tempAns++; }
		else
		{
			if(opened==0) { justStart=false; tempAns=0; closed=0; }
			else
			{
				tempAns++;
				opened--;
				closed++;

				if(opened==0)
				{
					if(justStart) tempAns+=lastAns;
					lastAns=tempAns;

					if(ans<tempAns) { ans=tempAns; cnt=1; }
					else if (ans==tempAns) cnt++;

					justStart=true;
					tempAns=0;
					closed=0;
				}
			}
		}
	}

	if(ans<closed*2) { ans=closed*2; cnt=1; }

	cout<<ans<<" "<<cnt<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

char str[1000001];
int len;

int main(void)
{
	scanf("%s", str);
	len=strlen(str);

	int opened=0, ans=-1, cnt=0, tempAns=0, lastAns=0;
	bool justStart=false;
	for(int i=0;i<len;i++)
	{
		if(str[i]=='(') { opened++; tempAns++; }
		else
		{
			if(opened==0) { justStart=false; tempAns=0; }
			else
			{
				tempAns++;
				opened--;

				if(opened==0)
				{
					if(justStart) tempAns+=lastAns;
					lastAns=tempAns;

					if(ans<tempAns) { ans=tempAns; cnt=1; }
					else if (ans==tempAns) cnt++;

					justStart=true;
				}
			}
		}
	}

	if(ans==-1) { ans=0; cnt=1; }

	cout<<ans<<" "<<cnt<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

char str[1000001];
int len;

int main(void)
{
	scanf("%s", str);
	len=strlen(str);

	int opened=0, ans=-1, cnt=0, tempAns=0, lastAns=0;
	bool justStart=false;
	for(int i=0;i<len;i++)
	{
		if(str[i]=='(') { opened++; tempAns++; }
		else
		{
			if(opened==0) { justStart=false; tempAns=0; }
			else
			{
				tempAns++;
				opened--;

				if(opened==0)
				{
					if(justStart) tempAns+=lastAns;
					lastAns=tempAns;

					if(ans<tempAns) { ans=tempAns; cnt=1; }
					else if (ans==tempAns) cnt++;

					justStart=true;
					tempAns=0;
				}
			}
		}
	}

	if(ans==-1) { ans=0; cnt=1; }

	cout<<ans<<" "<<cnt<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

char str[1000001];
bool isChecked[1000001];
int len;
stack <int> st;

int main(void)
{
	scanf("%s", str);
	len=strlen(str);

	int opened=0, ans=-1, cnt=0, tempAns=0, lastAns=0, closed=0;
	bool justStart=false;
	for(int i=0;i<len;i++)
	{
		if(str[i]=='(') { opened++; tempAns++; st.push(i); }
		else
		{
			if(opened==0) { justStart=false; tempAns=0; closed=0; }
			else
			{
				tempAns++;
				opened--;
				closed++;

				isChecked[st.top()]=true;
				isChecked[i]=true;
				st.pop();

				if(opened==0)
				{
					while(!st.empty()) st.pop();

					if(justStart) tempAns+=lastAns;
					lastAns=tempAns;

					if(ans<tempAns) { ans=tempAns; cnt=1; }
					else if (ans==tempAns) cnt++;

					justStart=true;
					tempAns=0;
					closed=0;
				}
			}
		}
	}

	int cont=0, temp=0;
	for(int i=0;i<len;i++)
	{
		if(isChecked[i]) temp++;
		else { if(cont<temp) cont=temp; temp=0; }
	}

	if(cont<temp) cont=temp;

	if(ans<cont) { ans=cont; cnt=1; }
	else if(ans==cont) cnt++;

	cout<<ans<<" "<<cnt<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

char str[1000001];
bool isChecked[1000001];
int len;
stack <int> st;

int main(void)
{
	scanf("%s", str);
	len=strlen(str);

	int opened=0, ans=-1, cnt=0, tempAns=0, lastAns=0, closed=0;
	bool justStart=false;
	for(int i=0;i<len;i++)
	{
		if(str[i]=='(') { opened++; tempAns++; st.push(i); }
		else
		{
			if(opened==0) { justStart=false; tempAns=0; closed=0; }
			else
			{
				tempAns++;
				opened--;
				closed++;

				isChecked[st.top()]=true;
				isChecked[i]=true;
				st.pop();

				if(opened==0)
				{
					while(!st.empty()) st.pop();

					if(justStart) tempAns+=lastAns;
					lastAns=tempAns;

					if(ans<tempAns) { ans=tempAns; cnt=1; }
					else if (ans==tempAns) cnt++;

					justStart=true;
					tempAns=0;
					closed=0;
				}
			}
		}
	}

	int cont=0, temp=0;
	for(int i=0;i<len;i++)
	{
		if(isChecked[i]) temp++;
		else { if(cont<temp) cont=temp; temp=0; }
	}

	if(cont<temp) cont=temp;

	if(ans<cont) { ans=cont; cnt=1; }
	else if(ans==cont && opened) cnt++;

	cout<<ans<<" "<<cnt<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

char str[1000001];
bool isChecked[1000001];
int len;
stack <int> st;

int main(void)
{
	scanf("%s", str);
	len=strlen(str);

	int opened=0, ans=-1, cnt=0, tempAns=0, lastAns=0, closed=0;
	bool justStart=false;
/*	for(int i=0;i<len;i++)
	{
		if(str[i]=='(') { opened++; tempAns++; st.push(i); }
		else
		{
			if(opened==0) { justStart=false; tempAns=0; closed=0; }
			else
			{
				tempAns++;
				opened--;
				closed++;

				isChecked[st.top()]=true;
				isChecked[i]=true;
				st.pop();

				if(opened==0)
				{
					while(!st.empty()) st.pop();

					if(justStart) tempAns+=lastAns;
					lastAns=tempAns;

					if(ans<tempAns) { ans=tempAns; cnt=1; }
					else if (ans==tempAns) cnt++;

					justStart=true;
					tempAns=0;
					closed=0;
				}
			}
		}
	}*/

	for(int i=0;i<len;i++)
	{
		if(str[i]=='(') st.push(i);
		else
		{
			if(!st.empty())
			{
				isChecked[st.top()]=true;
				st.pop();
				isChecked[i]=true;
			}
		}
	}

	int cont=0, temp=0;
	for(int i=0;i<len;i++)
	{
		if(isChecked[i]) temp++;
		else { if(cont<temp) { cont=temp; cnt=1; } else if (cont==temp) cnt++; temp=0; }
	}

	if(cont<temp) { cont=temp; cnt=1; }
	else if (cont==temp) cnt++;

	if(cont==0) cnt=1;

	cout<<cont<<" "<<cnt<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

char str[1000001];
int len;

int main(void)
{
	scanf("%s", str);
	len=strlen(str);

	int opened=0, ans=-1, cnt=0, tempAns=0, lastAns=0, closed=0;
	bool justStart=false;
	for(int i=0;i<len;i++)
	{
		if(str[i]=='(') { opened++; tempAns++; }
		else
		{
			if(opened==0) { justStart=false; tempAns=0; closed=0; }
			else
			{
				tempAns++;
				opened--;
				closed++;

				if(opened==0)
				{
					if(justStart) tempAns+=lastAns;
					lastAns=tempAns;

					if(ans<tempAns) { ans=tempAns; cnt=1; }
					else if (ans==tempAns) cnt++;

					justStart=true;
					tempAns=0;
					closed=0;
				}
			}
		}
	}

	if(ans<closed*2) { ans=closed*2; cnt=1; }
	else if (ans==closed*2) cnt++;

	cout<<ans<<" "<<cnt<<endl;

	return 0;
}


// C. Longest Regular Bracket Sequence
#include <cstdio>

using namespace std;

int main(int argc, char *argv[])
{
    static char s[1000100], *p;
    static int t[1000100];
    int i, j, k = -1, best = 0, n = 1;

    scanf("%s", s);
    for (i = j = 0; s[i]; i++)
        if (s[i] == '(') {
            t[j++] = i;
        } else if (j > 0) {
            --j;
            int c = i - (j > 0 ? t[j - 1] : k);
            if (c == best) n++;
            else if (c > best) best = c, n = 1;
        } else {
            k = i;
        }

    printf("%d %d\n", best, n);

    return 0;
}


// C. Longest Regular Bracket Sequence
#include <cstdio>

using namespace std;

int main(int argc, char *argv[])
{
    static char s[1000100], *p;
    static int t[1000100];
    int i, j, k = -1, best = 0, n = 1;

    scanf("%s", s);
    for (i = j = 0; s[i]; i++)
        if (s[i] == '(') {
            t[j++] = i;
        } else if (j > 0) {
            --j;
            int c = i - (j > 0 ? t[j] : k);
            if (c == best) n++;
            else if (c > best) best = c, n = 1;
        } else {
            k = i;
        }

    printf("%d %d\n", best, n);

    return 0;
}


// C. Longest Regular Bracket Sequence
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main(int argc, char *argv[])
{
	static char s[1000100], *p;
	int i, j;

	scanf("%s", s);
	for (i = j = 0; s[j]; j++)
		if (s[j] == '(')
			i = j;
		else if (s[j] == ')')
			for ( ; i >= 0; i--)
				if (s[i] == '(') {
					s[i] = s[j] = '*';
					break;
				}
	s[j++] = ' ';
	s[j] = '\0';

	int best = 0, n = 1;
	for (i = 0, j = -1; s[i]; i++)
		if (s[i] == '*') {
			if (j < 0) j = i;
		} else {
			if (j >= 0) {
				if (i - j == best) {
					n++;
				} else if (i - j > best) {
					best = i - j;
					n = 1;
				}
				j = -1;
			}
		}

	printf("%d %d\n", best, n);

	return 0;
}


// C. Longest Regular Bracket Sequence
#include <cstdio>

using namespace std;

int main(int argc, char *argv[])
{
    static char s[1000100], *p;
    static int t[1000100];
    int i, j, best = 0, n = 1;

    scanf("%s", s);
    t[0] = -1;
    for (i = j = 0; s[i]; i++)
        if (s[i] == ')' && j > 0 && s[t[j]] == '(') {
            int c = i - t[--j];
            if (c == best) n++;
            else if (c > best) best = c, n = 1;
        } else
            t[++j] = i;

    printf("%d %d\n", best, n);

    return 0;
}


// C. Longest Regular Bracket Sequence
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main(int argc, char *argv[])
{
    static char s[1000001], *p;
    static char a[1000001];
    int n, i, j;

    scanf("%s", s);
    for (p = &s[0]; *p == ')'; p++) {}

    a[0] = 0;
    for (n = 0; p[n]; n++)
        a[n + 1] = a[n] + (p[n] == '(' ? 1 : -1);

    int best = 0, count = 1;
    for (i = 0, j = 1; j <= n; j++)
        if (a[j] < a[i]) {
            i = j;
        } else if (a[j] == a[i]) {
            if (j - i == best) {
                count++;
            } else if (j - i > best) {
                best = j - i;
                count = 1;
            }
            i = ++j;
        }

    printf("%d %d\n", best, count);

    return 0;
}


// C. Longest Regular Bracket Sequence
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main(int argc, char *argv[])
{
    static char s[1000100], *p;
    static int t[1000100];
    int i, j;

    scanf("%s", s);
    for (i = j = 0; s[i]; i++)
        if (s[i] == '(')
            t[j++] = i;
        else
            if (j > 0) {
                --j;
                s[t[j]] = s[i] = '*';
            }

    s[i++] = ' ';
    s[i] = '\0';

    int best = 0, n = 1;
    for (i = 0, j = -1; s[i]; i++)
        if (s[i] == '*') {
            if (j < 0) j = i;
        } else {
            if (j >= 0) {
                if (i - j == best) {
                    n++;
                } else if (i - j > best) {
                    best = i - j;
                    n = 1;
                }
                j = -1;
            }
        }

    printf("%d %d\n", best, n);

    return 0;
}


// C. Longest Regular Bracket Sequence
#include <cstdio>

using namespace std;

int main(int argc, char *argv[])
{
    static char s[1000100], *p;
    static int t[1000100];
    int i, j, best = 0, n = 1;

    scanf("%s", s);
    for (i = j = 0; s[i]; i++)
        if (s[i] == '(') {
            t[j++] = i;
        } else if (j > 0) {
            int c = i - t[--j] + 1;
            if (c == best) n++;
            else if (c > best) best = c, n = 1;
        }

    printf("%d %d\n", best, n);

    return 0;
}


// C. Longest Regular Bracket Sequence
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main(int argc, char *argv[])
{
    static char s[1000100], *p;
    static int t[1000100];
    int i, j;

    scanf("%s", s);
    for (i = j = 0; s[i]; i++)
        if (s[i] == '(')
            t[j++] = i;
        else
            if (j > 0) {
                --j;
                s[t[j]] = s[i] = '*';
            }

    s[i++] = ' ';
    s[i] = '\0';

    printf("%s\n", s);

    int best = 0, n = 1;
    for (i = 0, j = -1; s[i]; i++)
        if (s[i] == '*') {
            if (j < 0) j = i;
        } else {
            if (j >= 0) {
                if (i - j == best) {
                    n++;
                } else if (i - j > best) {
                    best = i - j;
                    n = 1;
                }
                j = -1;
            }
        }

    printf("%d %d\n", best, n);

    return 0;
}


// C. Longest Regular Bracket Sequence
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main(int argc, char *argv[])
{
    static char s[1000001], *p;
    static char a[1000001];
    int n, i, j;

    scanf("%s", s);
    for (p = &s[0]; *p == ')'; p++) {}

    a[0] = 0;
    for (n = 0; p[n]; n++)
        a[n + 1] = a[n] + (p[n] == '(' ? 1 : -1);

    int best = 0, count = 1;
    for (i = 0, j = 1; j <= n; j++)
        if (a[j] < a[i]) {
            i = j;
        } else if (a[j] == a[i]) {
            if (j - i == best) {
                count++;
            } else if (j - i > best) {
                best = j - i;
                count = 1;
            }
        }

    printf("%d %d\n", best, count);

    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    //freopen("C:\\Users\\bhavini\\Documents\\input.txt","r",stdin);
    //freopen("C:\\Users\\bhavini\\Documents\\output.txt","w",stdout);
    string s;
    while(cin>>s)
    {
        int l,max_length=0,lengt=0,cnt=0,op=0,cl=0,i;
        l=s.length();
        for(i=0;i<l;i++)
        {
            if(s[i]=='(')
               op++;
            else if(s[i]==')')
              cl++;
              if(cl>op)
              {
                  if(lengt>max_length)
                  {
                      max_length=lengt;
                      lengt=0;
                      cnt=0;
                      op=0;
                      cl=0;
                  }
                  if(lengt!=0 && lengt==max_length)
                  {
                      cnt++;
                      op=0;
                      cl=0;
                  }
              }
              else
              {
                  lengt++;
              }
        }
        if(cl==op)
        {
            if(lengt>max_length)
                  {
                      max_length=lengt-1;
                      lengt=0;
                      cnt=0;
                      op=0;
                      cl=0;
                  }
                  if(lengt!=0 && lengt==max_length)
                  {
                      cnt++;
                      op=0;
                      cl=0;
                  }

        }
        if(max_length==0)
        cout<<"0 1"<<endl;
        else
        cout<<max_length+1<<" "<<cnt+1<<endl;
    }
}


#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int dp[1000001];
char s[1000001];
int main()
{
    //freopen("C:\\Users\\bhavini\\Documents\\input.txt","r",stdin);
    //freopen("C:\\Users\\bhavini\\Documents\\output.txt","w",stdout);

    while(scanf("%s",&s)!=EOF)
    {
        int l,maxim=0,lengt=0,cnt=0,op=0,cl=0,i,j,sum=0;
        //s='('+s+')';
        l=strlen(s);
        //cout<<l<<endl;
        for(i=0;i<l;i++)
        dp[i]=0;
        for(i=0;i<l;i++)
        {//cout<<s[i];
            if(s[i]==')')
            {
                //cout<<"i"<<i<<endl;
                j=i-1;
                while(j>=0  && (s[j]!='(') && dp[j]!=0)
                {
                    sum+=dp[j];

                    j=j-dp[j];

                }
                if(j>=0 && s[j]=='(')
                dp[i]=sum+2;
                sum=0;
                //cout<<dp[i]<<" ";
            }//cout<<dp[i]<<"*";
        }
        //cout<<endl;
        for(i=0;i<l;i++)
        {j=i;
        sum=0;
        while(dp[j]!=0)
        {sum+=dp[j];
            j=j-dp[j];
        }
            if(sum>maxim)
            {
                maxim=sum;
                cnt=1;
            }
            else if(dp[i]!=0 && dp[i]==maxim)
            {
                cnt++;
            }
        }
        j=l-1;
        if(maxim==0)
        cnt=1;
        printf("%d %d\n",maxim,cnt);
    }
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
int dp[1000001];
char s[1000001];
int main()
{
    //freopen("C:\\Users\\bhavini\\Documents\\input.txt","r",stdin);
    //freopen("C:\\Users\\bhavini\\Documents\\output.txt","w",stdout);

    while(scanf("%s",&s)!=EOF)
    {
        int l,maxim=0,lengt=0,cnt=0,op=0,cl=0,i,j,sum=0;
        //s='('+s+')';
        l=strlen(s);
        //cout<<l<<endl;
        for(i=0;i<l;i++)
        dp[i]=0;
        for(i=0;i<l;i++)
        {//cout<<s[i];
            if(s[i]==')')
            {
                //cout<<"i"<<i<<endl;
                j=i-1;
                while(j>=0  && (s[j]!='(') && dp[j]!=0)
                {
                    sum+=dp[j];

                    j=j-dp[j];

                }
                if(j>=0 && s[j]=='(')
                dp[i]=sum+2;
                sum=0;
                //cout<<dp[i]<<" ";
            }//cout<<dp[i]<<"*";
        }
        //cout<<endl;
        for(i=0;i<l;i++)
        {j=i;
        sum=0;
        while(dp[j]!=0)
        {sum+=dp[j];
            j=j-dp[j];
        }
            if(sum>maxim)
            {
                maxim=sum;
                cnt=1;
            }
            else if(dp[i]!=0 && dp[i]==maxim)
            {
                cnt++;
            }
        }
        j=l-1;
        if(maxim==0)
        cnt=1;
        printf("%d %d\n",maxim,cnt);
    }
    return 0;
}


#include <cstdio>

const int mod=1000000007;
int n,chr;
int c[4];
long long a,p;

int main()
{
	scanf("%d%*c",&n);
	for (int i=0;i<n;++i)
	{
		chr=getchar();
		if (chr=='A') ++c[0];
		if (chr=='C') ++c[1];
		if (chr=='G') ++c[2];
		if (chr=='T') ++c[3];
	}
	a=c[0]+c[1]+c[2]+c[3];
	p=1;
	do
	{
		if (n&1) p=p*a%mod;
		a=a*a%mod;
	}
	while (n>>=1);
	printf("%I64d\n",p);
	return 0;
}


#include <cstdio>

const int mod=1000000007;
int n,chr;
int c[4];
long long a,p;

int main()
{
	scanf("%d%*c",&n);
	for (int i=0;i<n;++i)
	{
		chr=getchar();
		if (chr=='A') c[0]=1;
		if (chr=='C') c[1]=1;
		if (chr=='G') c[2]=1;
		if (chr=='T') c[3]=1;
	}
	a=c[0]+c[1]+c[2]+c[3];
	p=1;
	do
	{
		if (n&1) p=p*a%mod;
		a=a*a%mod;
	}
	while (n>>=1);
	printf("%I64d\n",p);
	return 0;
}


#include <cstdio>
#include <algorithm>
using std::max;
const int mod=1000000007;
int n,m,chr;
int c[4];
long long a,p;

int main()
{
	scanf("%d%*c",&n);
	for (int i=0;i<n;++i)
	{
		chr=getchar();
		if (chr=='A') ++c[0];
		if (chr=='C') ++c[1];
		if (chr=='G') ++c[2];
		if (chr=='T') ++c[3];
	}
	m=max(max(c[0],c[1]),max(c[2],c[3]));
	for (int i=0;i<4;++i) a+=c[i]==m;
	p=1;
	do
	{
		if (n&1) p=p*a%mod;
		a=a*a%mod;
	}
	while (n>>=1);
	printf("%I64d\n",p);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
const ll D = 1e9 + 7;

ll P(ll x, int y){
	ll ans = 1;
	for(int i = 0; i < y; i++)
		ans = (ans * x) % D;
	return ans;
}

int main(){
	string s;
	int n;
	set<char> S;
	cin >> n;
	cin >> s;
	for(int i = 0; i < s.size(); i++)
		S.insert(s[i]);
	cout << P((ll)S.size(), n)<<endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
const ll D = 1e9 + 7;
int a[4];

ll P(ll x, int y){
	ll ans = 1;
	for(int i = 0; i < y; i++)
		ans = (ans * x) % D;
	return ans;
}

int main(){
	string s;
	int n;
	set<char> S;
	cin >> n;
	cin >> s;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'A')
			a[0]++;
		if(s[i] == 'C')
			a[1]++;
		if(s[i] == 'G')
			a[2]++;
		if(s[i] == 'T')
			a[3]++;
	}
	sort(a, a + 4);
	reverse(a, a + 4);
	int x = 0;
	while(x < 4 and a[x] == a[0])
		x++;
	cout << P(x, s.size())<<endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
const ll D = 1e9 + 7;

ll P(ll x, int y){
	ll ans = 1;
	for(int i = 0; i < y; i++)
		ans = (ans * x) % D;
	return ans;
}

int main(){
	string s;
	int n;
	set<int> S;
	cin >> n;
	cin >> s;
	for(int i = 0; i < s.size(); i++)
		S.insert(s[i]);
	cout << P((ll)S.size(), n)<<endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
int a[26];
const ll D = 1e9 + 7;

ll P(int x, int y){
	ll ans = 1;
	for(int i = 0; i < y; i++)
		ans = (ans * x) % D;
	return ans;
}

int main(){
	string s;
	int n;
	set<int> S;
	cin >> n;
	cin >> s;
	for(int i = 0; i < s.size(); i++)
		S.insert(s[i]);
	cout << P(S.size(), n)<<endl;
}