#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
       long long  int a,b,c;
        cin>>a>>b>>c;
        int flag=0;
        int flag1=0;
        long long int r=0,z=0;
        for(long long int i=1;i<=b;i++)
        {
            if(a*i<c)
            {
                flag=1;
                z=i;
            }
            if(c<a*i)
            {
                flag1=1;
                r=i;
            }
            if(flag==1 && flag1==1)
            {
                break;
            }
        }
        if(flag==1 && flag1==1)
        {
            cout<<z<<" "<<r<<endl;
        }
        else if(flag1==1)
        {
            cout<<"-1"<<" "<<r<<endl;
        }
        else{
            cout<<z<<" "<<"-1"<<endl;
        }
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long int a,b,c;
        cin>>a>>b>>c;
        if(a>=c)
        {
            cout<<"-1"<<" ";
        }
        else{
            cout<<"1"<<" ";
        }
       long long int r=a*b;
        if(r<=c)
        {
            cout<<"-1";
        }
        else{
            cout<<"2";
        }
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int T;
	cin >> T;
	while (T--) {
		int a, b, c;
		cin >> a >> b >> c;
		cout << (a >= c ? -1 : 1) << ' ' << ((long long)ceil((long double)1e9 / b) * c < a * (long long) 1e9 ? (int)1e9 : -1) << '\n';
	}
}


#include <bits/stdc++.h>

using namespace std ;

const long long cons = 1e9 ;
const int MAX = 1e5 + 10 ;

int arr[MAX] ;
long long a , b , c ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	int t ;
	cin>>t ;
	while(t--)
	{
		cin>>a>>b>>c ;
		if(a < c)
			cout<<1<<" " ;
		else
			cout<<-1<<" " ;
		long long x = cons / b ;
		if(x * b * a > x * c)
			cout<<x * b<<"\n" ;
		else
			cout<<-1<<"\n" ;
	}
	return 0 ;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll t; cin >> t;
    while (t--)
    {
        ll a, b, c; cin >> a >> b >> c;
        if (a<c)
            cout << 1;
        else if (a>=c && a*b<c)
            cout << b;
        else
            cout << -1;
        cout << ' ';
        if (a*b>c)
            cout << b;
        else
            cout << -1;
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007
#define N 10000001

void solve() {
        int a, b, c; cin >> a>> b>> c;
        if (a >= c) {
                cout << "-1 ";
        } else {
                cout << "1 ";
        }
        if (a* b> c) {
                cout << b;
        } else cout << "-1";
        cout << "\n";
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int t = 1;
        cin >> t;
        while ( t-- ) {
                solve();
        }
return 0;
}


#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin >> t;
    while(t--) {
    	ll a, b, c;
    	cin >> a >> b >> c;
    	if(a >= c) {
    		cout << "-1 2\n";
    		continue;
    	}
    	ll take = 1e9;
    	ll cost1 = a * take;
    	ll req = take / b;
    	if(take % b != 0) {
    		req++;
    	}
    	ll cost2 = req * c;
    	if(cost2 < cost1) {
    		cout << "1 "<<take << "\n";
    	} else {
    		cout << "1 -1\n";
    	}
    }
}


#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
void input()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}
using namespace std;
typedef long long ll ;
const long long N = 1e6+20,OO=0x3f3f3f3f;
ll t,a,b,c;
bool can(int x){
ll ans1=x*a;
ll ans2=x/b;
if(x%b!=0)ans2++;
ans2*=c;
return ans1<ans2;
}
bool can1(ll x){
ll ans1=x*a;
ll ans2=x/b;
if(x%b!=0)ans2++;
ans2*=c;
return ans1>ans2;
}
int bs1(){
    int l=1,r=1e9,mid;
    while(l<r){
        mid=(l+r)/2;
        if(can(mid))return mid;
        else r=mid-1;
    }
    return -1;
}
int bs2(){
    int l=1,r=1e9,mid;
    while(l<r){
        mid=(l+r)/2;
        if(can1(mid))return mid;
        else r=mid-1;
    }
    return -1;
}

int main()
{
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>c;
        cout<<bs1()<<" "<<bs2()<<endl;;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define f  first
#define s second
#define Tsetso ios_base::sync_with_stdio(0) ; cin.tie(0) ;
using namespace std;
const int N = 2e6+10 , mod = 1e9+7 ;
ll dp[N][2] ;
int main()
{
    Tsetso
    int t ;
    cin >> t ;
    while(t--)
    {
        ll a , b , c ;
        cin >> a >> b >> c ;
        if ( a < c)
                cout << 1 << " " ;
        else
               cout << -1 << " " ;
        if ( (c/b) <a)
            cout <<  b << " " ;
        else
            cout << -1 << " " ;
        cout << endl;
    }
}


#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
    int T;cin>>T;
    while(T--){
        int a,b,c;
        cin>>a>>b>>c;
        int ans1=-1,ans2=-1;
        if(a<c){
            ans1=1;
        }
        int inf = 1e9;
        int t = inf/b;
        if(inf%b) t++;
        if(t*c<inf*a){
            ans2=inf;
        }
        cout<<ans1<<" "<<ans2<<endl;
    }
}


#include <bits/stdc++.h>
#define ll long long
#define fr first
#define sc second
#define mp make_pair
#define ii pair<int,int>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    int t;
    cin>>t;
    while(t--)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        if(b == 1)
        {
            if(a == c)
            {
                cout<<-1<<" "<<-1<<endl;
            }
            else if(a < c)
            {
                cout<<1<<" "<<-1<<endl;
            }
            else
            {
                cout<<-1<<" "<<1<<endl;
            }
        }
        else
        {
            if(a < c)
            {
                cout<<1<<" ";
            }
            else
                cout<<-1<<" ";
            ll temp = (b)*a;
            if(temp > c)
            {
                cout<<b<<"\n";
            }
            else
                cout<<-1<<endl;
        }
    }
    return 0 ;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<string> l;
#define all(s) s.begin(),s.end()
#define OO ll(1e9)
#define MOD ll(998244353)
#define neig(head, u, e, v) for(int v, e = head[u] ;v = to[e], e ; e = nxt[e])
const int N = 2e6 + 7, M = 2e7 + 9;
char *blank = "";

int dx[] = { 0, 1, 0, -1 };
int dy[] = { 1, 0, -1, 0 };

int main() {
	int tc;
	scanf("%d", &tc);
	while (tc--) {
		double a, b, c;
		cin >> a >> b >> c;
		if (a >= c)
			cout << "-1 ";
		else {
			cout << "1 ";
		}
		if (c < a * b)
			cout << (int) b;
		else
			cout << -1;
		cout << endl;
	}
}


#include <bits/stdc++.h>
using namespace std;

#define el '\n'
#define pb push_back
#define sp ' '
#define all(x) (x).begin(), (x).end()
#define mset(x, y) memset(x, y, sizeof(x))
#define ff first
#define ss second

// clang-format off
#ifndef ONLINE_JUDGE
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < (int)s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += el; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += el; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += el; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); }
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
#else
#define dbg(...) ;
#define dbgm(...) ;
#endif
// clang-format on

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppi;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

const int inf = 1e09 + 5e3;
const ll linf = 2e18 + 5e3;
const int mod = 1e9 + 7;
const int mxn = 1e5;

void solve()
{
    ll a, b, c;
    cin >> a >> b >> c;
    if (c <= a)
    {
        cout << -1 << sp << 2 << el;
    }
    else
    {
        if (a * b > c)
        {
            cout << 1 << sp << b << el;
        }
        else
            cout << 1 << sp << -1 << el;
    }
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(a<c)
	{
		x.first=1;
	}
	else
	{
		x.first=-1;

	}
	if(c<=a*b)
	{
		x.second=b;
	}
	else
	{
		x.second=-1;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;

		x.first=1|rand()%c;
	}
	else if (a>=c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;

		x.first=1|rand()%c;
	}
	else if (a>=c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		if(c/a==c)
		{
			x.first--;
		}
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;

		x.first=1+rand()%c;
	}
	else if (a>=c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		if(c/a==c)
		{
			x.first--;
		}
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;

		x.first=rand()%c;
		if(x.first==0)
			x.first++;
	}
	else if (a>=c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		if(c/a==c)
		{
			x.first--;
		}
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(a<c)
	{
		x.first=1;
	}
	else
	{
		x.first=-1;

	}
	if(c/a<b)
	{
		x.second=b;
	}
	else
	{
		x.second=-1;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;
		x.first=10*rand();
	}
	else if (a>c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;
		x.first=10*rand();
	}
	else if (a>c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(a<c)
	{
		x.first=1;
	}
	else
	{
		x.first=-1;

	}
	if(c<a*b)
	{
		x.second=b;
	}
	else
	{
		x.second=-1;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;
		x.first=10*rand();
	}
	else if (a>c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<x.second;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;
		x.first=rand()%c;
	}
	else if (a>c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(a<c)
	{
		x.first=1;
	}
	else
	{
		x.first=-1;

	}
	if(c<a*b)
	{
		x.second=b;
	}
	else
	{
		x.second=-1;
	}

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;

		x.first=1|rand()%c;
	}
	else if (a>=c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		if(c/a==b)
			x.first--;
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;

		x.first=rand()%c;
	}
	else if (a>c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;

		x.first=1|rand()%c;
	}
	else if (a>=c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		if(c/a==c)
			x.first--;
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;

		x.first=rand()%c;
	}
	else if (a>=c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


#include<bits/stdc++.h>

using namespace std;

pair<int,int> donuts(int a,int b,int c)
{
	pair<int,int> x;

	if(c/b>=a)
	{
		x.second=-1;

		x.first=1;
	}
	else if (a>=c && c>=1)
	{
		x.first=-1;
		x.second=b;
	}
	else
	{
		x.first=c/a;
		if(c/a==c)
		{
			x.first--;
		}
		x.second=b;
	}
	return x;

}

int main()
{
	int t;
	long int a,b,c;
	pair<int,int> x;

	cin>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a>>b>>c;
		x=donuts(a,b,c);
		cout<<x.first<<" "<<x.second<<endl;
	}
	return (0);
}


# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <stack>

using namespace std;

typedef pair<int, int> ii;

stack<int> s;
int len,ans,ans1,i,j;
int a[1000005];
char str[1000005];

int main()
{
	ans=ans1=0;

//	freopen("c.txt", "r", stdin);

	scanf("%s", str);

	len=strlen(str);

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

	i=j=0;

	while (i<len)
	{
		while (i<len && a[i]==0) i++;

		if (i>=len) break;
		j=a[i]+1;

		while (j<len && a[j]!=0) j=a[j]+1;

		a[i]=j-i;
		if (a[i]>ans) ans=a[i];
		i=j;
	}

	for (int i=0; i<len; i++)
		if (a[i]==ans) ans1++;

	if (ans==0) printf("0 1\n"); else printf("%d %d\n", ans, ans1);
}


# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <stack>

using namespace std;

typedef pair<int, int> ii;

stack<int> s;
int len,ans,ans1,i,j;
int a[1000005];
char str[1000005];

int main()
{
	ans=ans1=0;

//	freopen("c.txt", "r", stdin);

	scanf("%s", str);

	len=strlen(str);

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

	i=j=0;

	while (i<len)
	{
		while (i<len && a[i]==0) i++;

		j=a[i]+1;

		while (j<len && a[j]!=0) j=a[j]+1;

		a[i]=j-i;
		if (a[i]>ans) ans=a[i];
		i=j;
	}

	for (int i=0; i<len; i++)
		if (a[i]==ans) ans1++;

	if (ans==1) printf("0 1\n"); else printf("%d %d\n", ans, ans1);
}


# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <stack>

using namespace std;

typedef pair<int, int> ii;

stack<int> s;
int len,ans,ans1,i,j;
int a[1000005], b[1000005];
char str[1000005];

int main()
{
	ans=ans1=0;

//	freopen("c.txt", "r", stdin);

	scanf("%s", str);

	len=strlen(str);

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

	i=j=0;

	while (i<len)
	{
		while (i<len && a[i]==0) i++;

		if (i>=len) break;
		j=a[i]+1;

		while (j<len && a[j]!=0) j=a[j]+1;

		b[i]=j-i;
		if (b[i]>ans) ans=b[i];
		i=j;
	}

	for (int i=0; i<len; i++)
		if (b[i]==ans) ans1++;

	if (ans==0) printf("0 1\n"); else printf("%d %d\n", ans, ans1);
}


# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <stack>

using namespace std;

typedef pair<int, int> ii;

stack<int> s;
int len,ans,ans1;
int a[1000005];
char str[1000005];

int main()
{
	ans=ans1=0;

//	freopen("c.txt", "r", stdin);

	scanf("%s", str);

	len=strlen(str);

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

	for (int i=0; i<len; i++)
	{
		if (a[i]-i+1>ans) ans=a[i]-i+1;
	}

	for (int i=0; i<len; i++)
		if (a[i]-i+1==ans) ans1++;

	if (ans==1) printf("0 1\n"); else printf("%d %d\n", ans, ans1);
}


#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<stdlib.h>
#include<ctime>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<cstdlib>
#include<bitset>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(1.0)

using namespace std;

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

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

typedef map<int ,int > mf;
typedef map<int ,vpp > mv;
typedef map<int ,v1 > ad;

int const siz = 1e9,bound = 5e5,mod = siz+7;
ll const cnt=1e18;

int main() {
//	freopen("o.txt","w",stdout);
//	freopen("in.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie();
	stack<int > rel;
	string s;
	int mx=0,tr=0,len=0;
	cin>>s;
	fn(i,s.size()){
		if(s[i]=='(')rel.push(i);
		else{
			if(rel.empty()){
				if(len>mx){
					mx=len;
					tr=1;
				}else if(len==mx)tr++;
				len=0;
				continue;
			}
			int r=rel.top();
			rel.pop();
			len+=2;
		}
	}
	if(len>mx){
		mx=len;
		tr=1;
	}else if(len==mx)tr++;

	if(mx==0)tr=1;
	printf("%d %d\n",mx,tr);
	return 0;
}


#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<stdlib.h>
#include<ctime>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<cstdlib>
#include<bitset>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(1.0)

using namespace std;

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

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

typedef map<int ,int > mf;
typedef map<int ,vpp > mv;
typedef map<int ,v1 > ad;

int const siz = 1e9,bound = 5e5,mod = siz+7;
ll const cnt=1e18;

int main() {
//	freopen("o.txt","w",stdout);
//	freopen("in.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie();
	string s;
	cin>>s;
	int op=-1,len=0,ans=0,mx=0;
	fn(i,s.size()){
		if(s[i]==')'){
			if(op==1){
				len++;
				op--;
				if(len>mx){
					mx=len;
					ans=1;
				}else if(len==mx){
					ans++;
				}
				len=0;
			}else if(op>1){
				op--;
				len++;
			}
		}else{
			if(op==-1)op=0;
			op++;
			len++;
		}
	}
	if(mx==0)ans=1;
	printf("%d %d\n",mx,ans);
	return 0;
}


#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<stdlib.h>
#include<ctime>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<cstdlib>
#include<bitset>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(1.0)

using namespace std;

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

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

typedef map<int ,int > mf;
typedef map<int ,vpp > mv;
typedef map<int ,v1 > ad;

int const siz = 1e9,bound = 5e5,mod = siz+7;
ll const cnt=1e18;

int main() {
//	freopen("o.txt","w",stdout);
//	freopen("in.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie();
	stack<int > rel;
	string s;
	int mx=0,tr=0;
	cin>>s;
	fn(i,s.size()){
		if(s[i]=='(')rel.push(i);
		else{
			if(rel.empty())continue;
			int r=rel.top();
			rel.pop();
			if(i-r+1>mx){
				mx=i-r+1;
				tr=1;
			}else if(i-r+1==mx)tr++;
		}
	}
	if(mx==0)tr=1;
	printf("%d %d\n",mx,tr);
	return 0;
}


#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<stdlib.h>
#include<ctime>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<cstdlib>
#include<bitset>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(1.0)

using namespace std;

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

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

typedef map<int ,int > mf;
typedef map<int ,vpp > mv;
typedef map<int ,v1 > ad;

int const siz = 1e9,bound = 5e5,mod = siz+7;
ll const cnt=1e18;

int main() {
//	freopen("o.txt","w",stdout);
//	freopen("in.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie();
	stack<int > rel;
	string s;
	int mx=0,tr=0,len=0,pre=-1;
	cin>>s;
	fn(i,s.size()){
		if(s[i]=='(')rel.push(i);
		else{
			if(rel.empty()){
				if(len>mx){
					mx=len;
					tr=1;
				}else if(len==mx)tr++;
				len=0;
				continue;
			}
			int r=rel.top();
			rel.pop();
			if(pre==-1)
				len=2;
			else if(pre==i||pre==r)
				len+=2;
			else{
				if(len>mx){
					mx=len;
					tr=1;
				}else if(len==mx)tr++;
				len=2;
			}
			pre=i+1;
		}
	}
	if(len>mx){
		mx=len;
		tr=1;
	}else if(len==mx)tr++;

	if(mx==0)tr=1;
	printf("%d %d\n",mx,tr);
	return 0;
}


#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<stdlib.h>
#include<ctime>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<cstdlib>
#include<bitset>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(1.0)

using namespace std;

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

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

typedef map<int ,int > mf;
typedef map<int ,vpp > mv;
typedef map<int ,v1 > ad;

int const siz = 1e9,bound = 5e5,mod = siz+7;
ll const cnt=1e18;

v1 twins;
int main() {
//	freopen("o.txt","w",stdout);
	freopen("in.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie();
	stack<int >  rr;
	string s;
	cin>>s;
	fn(i,s.size()){
		if(s[i]=='(')rr.push(i);
		else{
			if(rr.empty())continue;
			twins.push_back(rr.top());
			twins.push_back(i);
			rr.pop();
		}
	}
	if(twins.empty()){
		cout<<"0 1\n";
		return 0;
	}
	sort(twins.begin(),twins.end());
	int mx=0,tr=0,pre=twins[0];
	f1n(i,(int)twins.size()-1){
		if(twins[i]-1!=twins[i-1]){
			if(twins[i-1]-pre+1>mx){
				mx=twins[i-1]-pre+1;
				tr=1;
			}else if(twins[i-1]-pre+1==mx)tr++;
			pre=twins[i];
		}
	}

	if(twins.back()-pre+1>mx){
		mx=twins.back()-pre+1;
		tr=1;
	}else if(twins.back()-pre+1==mx)tr++;
	if(mx==0)tr=1;
	cout<<mx<<" "<<tr;
	return 0;
}


#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<stdlib.h>
#include<ctime>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<cstdlib>
#include<bitset>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(1.0)

using namespace std;

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

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

typedef map<int ,int > mf;
typedef map<int ,vpp > mv;
typedef map<int ,v1 > ad;

int const siz = 1e9,bound = 5e5,mod = siz+7;
ll const cnt=1e18;

int main() {
//	freopen("o.txt","w",stdout);
	freopen("in.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie();
	stack<int > rel;
	string s;
	int mx=0,tr=0,len=0,pre=-1;
	cin>>s;
	fn(i,s.size()){
		if(s[i]=='(')rel.push(i);
		else{
			if(rel.empty()){
				if(len>mx){
					mx=len;
					tr=1;
				}else if(len==mx)tr++;
				len=0;
				continue;
			}
			int r=rel.top();
			rel.pop();
			if(pre==-1)
				len=2;
			else if(pre==i||pre==r)
				len+=2;
			else{
				if(len>mx){
					mx=len;
					tr=1;
				}else if(len==mx)tr++;
				len=2;
			}
			pre=i+1;
		}
	}
	if(len>mx){
		mx=len;
		tr=1;
	}else if(len==mx)tr++;

	if(mx==0)tr=1;
	printf("%d %d\n",mx,tr);
	return 0;
}


#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <cmath>
#include <vector>
#include<cctype>
#include<algorithm>
#include<set>
#include<stack>
#include<map>
#include<stdlib.h>
#include<ctime>
#include<iterator>
#include <deque>
#include <sstream>
#include<queue>
#include<cstdlib>
#include<bitset>

#define fn(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define f1n(i,n) for(int (i) = 1;(i) <= (n);(i)++)
#define mk(f,s) make_pair((f),(s))

#define defV(dp,e) memset(dp,e,sizeof dp)

#define ri(n) scanf("%d",&n)
#define rl(n) scanf("%lld",&n)
#define rs(s) scanf("%s",s)

#define PI acos(1.0)

using namespace std;

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

typedef vector<int  > v1;
typedef vector<ll  > vl;
typedef vector<pp  > vpp;
typedef vector<bool  > vb;
typedef vector<char > vc;
typedef vector<v1 > v2;

typedef map<int ,int > mf;
typedef map<int ,vpp > mv;
typedef map<int ,v1 > ad;

int const siz = 1e9,bound = 5e5,mod = siz+7;
ll const cnt=1e18;

v1 twins;
int main() {
//	freopen("o.txt","w",stdout);
//	freopen("in.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie();
	stack<int >  rr;
	string s;
	cin>>s;
	fn(i,s.size()){
		if(s[i]=='(')rr.push(i);
		else{
			if(rr.empty())continue;
			twins.push_back(rr.top());
			twins.push_back(i);
			rr.pop();
		}
	}
	if(twins.empty()){
		cout<<"0 1\n";
		return 0;
	}
	sort(twins.begin(),twins.end());
	int mx=0,tr=0,pre=twins[0];
	f1n(i,(int)twins.size()-1){
		if(twins[i]-1!=twins[i-1]){
			if(twins[i-1]-pre+1>mx){
				mx=twins[i-1]-pre+1;
				tr=1;
			}else if(twins[i-1]-pre+1==mx)tr++;
			pre=twins[i];
		}
	}

	if(twins.back()-pre+1>mx){
		mx=twins.back()-pre+1;
		tr=1;
	}else if(twins.back()-pre+1==mx)tr++;
	if(mx==0)tr=1;
	cout<<mx<<" "<<tr;
	return 0;
}


#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <algorithm>

using namespace std;

const int MAXM=1000010;

int res=0,num=1,len,tail;
char c[MAXM];
int q[MAXM];

void update()
{
    int i,sum=0;
    i=tail-1;
    while(q[i]!=-1 && i>=0)
    {
        sum+=q[i];
        i--;
    }
    if(i==-1) tail=0;
    else
    {
        tail=i;
        sum+=2;
        if(res<sum)
        {
            res=sum;
            num=1;
        }
        else if(res==sum) num++;
        q[tail++]=sum;
    }
}

int main()
{
    scanf("%s",c);
    len=strlen(c);
    int i;
    tail=0;
    for(i=0;i<len;i++)
    {
        if(c[i]=='(') q[tail++]=-1;
        else if(c[i]==')') update();
    }
    printf("%d %d\n",res,num);
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <algorithm>

using namespace std;

const int MAXM=1000010;

int res=0,num=1,len,tail;
char c[MAXM];
int q[MAXM];

void update()
{
    int i,sum=0;
    i=tail-1;
    while(q[i]!=-1 && i>=0)
    {
        sum+=q[i];
        i--;
    }
    if(i==-1) tail=0;
    else
    {
        tail=i-1;
        while(q[tail]!=-1 && tail>=0)
        {
            sum+=q[tail];
            tail--;
        }
        tail++;
        sum+=2;
        if(res<sum)
        {
            res=sum;
            num=1;
        }
        else if(res==sum) num++;
        q[tail++]=sum;
    }
}

int main()
{
    scanf("%s",c);
    len=strlen(c);
    int i;
    tail=0;
    for(i=0;i<len;i++)
    {
        if(c[i]=='(') q[tail++]=-1;
        else if(c[i]==')') update();
    }
    printf("%d %d\n",res,num);
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <algorithm>

using namespace std;

const int MAXM=1000010;

int res=0,num=1,len;
char c[MAXM];

int main()
{
    scanf("%s",c);
    len=strlen(c);
    int i,l=0,r=0;
    for(i=0;i<len;i++)
    {
        if(c[i]=='(') l++;
        else if(c[i]==')')
        {
            r++;
            if(r>l) l=r=0;
            else
            {
                if(2*r>res)
                {
                    res=2*r;
                    num=1;
                }
                else if(2*r==res) num++;
            }
        }
    }
    printf("%d %d\n",res,num);
    return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <stack>

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#pragma comment(linker,"/STACK:16777216")

using namespace std;

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r",stdin);
		freopen("output.txt", "w", stdout);
	#endif

	stack<int>mStack;

	char s[1 << 20];

	fgets(s, 1 << 20, stdin);
	int n = strlen(s);
	while (n>0 && s[n-1] != '(' && s[n-1] != ')') --n;
	s[n] = 0;

	int maxLen = 0;
	int maxCnt = 1;

	for(int i = 0; i < n; ++i)
	{
		if (s[i] != '(' && s[i] != ')')
			continue;

		if (s[i] == '(')
		{
			mStack.push(i);
		}
		else if (mStack.empty())
		{

		}
		else
		{
			int pos = mStack.top();
			mStack.pop();
			int currLen = i - pos + 1;
			if (currLen > maxLen)
			{
				maxLen = currLen;
				maxCnt = 1;
			}
			else if (currLen == maxLen)
			{
				maxCnt++;
			}
		}

	}

	while (mStack.empty() == false)mStack.pop();

	int max2Len = 0;
	int max2Cnt  =1;
	for(int i = n - 1; i >= 0; --i)
	{
		if (s[i] != '(' && s[i] != ')')
			continue;
		if (s[i] == ')')
		{
			mStack.push(i);
		}
		else if (mStack.empty())
		{

		}
		else
		{
			int pos = mStack.top();
			mStack.pop();

			int currLen = pos - i + 1;

			if (currLen > max2Len)
			{
				max2Len = currLen;
				max2Cnt = 1;
			}
			else if (currLen == max2Len)
			{
				max2Cnt++;
			}
		}

	}

	if (maxLen < max2Len)
	{
		maxLen = max2Len;
		maxCnt = max2Cnt;
	}

	cout << maxLen << " " << maxCnt << endl;

	return (0);
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <stack>

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#pragma comment(linker,"/STACK:16777216")

using namespace std;

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r",stdin);
		freopen("output.txt", "w", stdout);
	#endif

	stack<int>mStack;
	int maxLen[1 << 20];
	char s[1 << 20];

	fgets(s, 1 << 20, stdin);
	int n = strlen(s);
	while (n>0 && s[n-1] != '(' && s[n-1] != ')') --n;
	s[n] = 0;

	for(int i = 0; i < n; ++i)
	{
		if (s[i] == '(')
		{
			mStack.push(i);
			maxLen[i] = 0;
		}
		else if (mStack.empty())
		{
			maxLen[i] = 0;
		}
		else
		{
			int pos = mStack.top();
			mStack.pop();
			int currLen = i - pos + 1;

			if (pos == 0 )
				maxLen[i] = currLen;
			else
				maxLen[i] = currLen + maxLen[pos-1];
		}
	}

	int mlen = 0;
	int mcnt = 1;

	for(int i = 0; i<n;++i)
	{
		if (maxLen[i] > mlen)
		{
			mlen = maxLen[i];
			mcnt = 1;
		}
		else if (maxLen[i] == mlen && mlen > 0)
		{
			mcnt++;
		}
	}

	cout << mlen << " " << mcnt << endl;

	return (0);
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <stack>

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#pragma comment(linker,"/STACK:16777216")

using namespace std;

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r",stdin);
		freopen("output.txt", "w", stdout);
	#endif

	stack<int>mStack;

	string s;

	cin >> s;

	int maxLen = 0;
	int maxCnt = 1;

	for(size_t i = 0; i < s.length(); ++i)
	{
		if (s[i] == '(')
		{
			mStack.push(i);
		}
		else if (mStack.empty())
		{

		}
		else
		{
			int pos = mStack.top();
			mStack.pop();
			int currLen = i - pos + 1;
			if (currLen > maxLen)
			{
				maxLen = currLen;
				maxCnt = 1;
			}
			else if (currLen == maxLen)
			{
				maxCnt++;
			}
		}

	}

	cout << maxLen << " " << maxCnt << endl;

	return (0);
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <stack>

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#pragma comment(linker,"/STACK:16777216")

using namespace std;

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r",stdin);
		freopen("output.txt", "w", stdout);
	#endif

	stack<int>mStack;

	string s;

	cin >> s;

	int maxLen = 0;
	int maxCnt = 1;

	for(size_t i = 0; i < s.length(); ++i)
	{
		if (s[i] == '(')
		{
			mStack.push(i);
		}
		else if (mStack.empty())
		{

		}
		else
		{
			int pos = mStack.top();
			mStack.pop();
			int currLen = i - pos + 1;
			if (currLen > maxLen)
			{
				maxLen = currLen;
				maxCnt = 1;
			}
			else if (currLen == maxLen)
			{
				maxCnt++;
			}
		}

	}

	while (mStack.empty() == false)mStack.pop();

	int max2Len = 0;
	int max2Cnt  =1;
	for(int i = s.length()-1; i >=0; --i)
	{
		if (s[i] == ')')
		{
			mStack.push(i);
		}
		else if (mStack.empty())
		{

		}
		else
		{
			int pos = mStack.top();
			mStack.pop();

			int currLen = pos - i + 1;

			if (currLen > max2Len)
			{
				max2Len = currLen;
				max2Cnt = 1;
			}
			else if (currLen == max2Len)
			{
				max2Cnt++;
			}
		}

	}

	if (maxLen < max2Len)
	{
		maxLen = max2Len;
		maxCnt = max2Cnt;
	}

	cout << maxLen << " " << maxCnt << endl;

	return (0);
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <stack>

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#pragma comment(linker,"/STACK:16777216")

using namespace std;

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r",stdin);
		freopen("output.txt", "w", stdout);
	#endif

	stack<int>mStack;
	int maxLen[1 << 20];
	char s[1 << 20];

	fgets(s, 1 << 20, stdin);
	int n = strlen(s);
	while (n>0 && s[n-1] != '(' && s[n-1] != ')') --n;
	s[n] = 0;

	for(int i = 0; i < n; ++i)
	{
		if (s[i] == '(')
		{
			mStack.push(i);
			maxLen[i] = 0;
		}
		else if (mStack.empty())
		{
			maxLen[i] = 0;
		}
		else
		{
			int pos = mStack.top();
			mStack.pop();
			int currLen = i - pos + 1;

			if (pos == 0 )
				maxLen[i] = currLen;
			else
				maxLen[i] = currLen + maxLen[pos-1];
		}
	}

	int mlen = 0;
	int mcnt = 1;

	for(int i = 0; i<n;++i)
	{
		if (maxLen[i] > mlen)
		{
			mlen = maxLen[i];
			mcnt = 1;
		}
		else if (maxLen[i] == mlen)
		{
			mcnt++;
		}
	}

	cout << mlen << " " << mcnt << endl;

	return (0);
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <stack>

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#pragma comment(linker,"/STACK:16777216")

using namespace std;

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r",stdin);
		freopen("output.txt", "w", stdout);
	#endif

	stack<int>mStack;

	char s[1 << 20];

	fgets(s, 1 << 20, stdin);
	int n = strlen(s);
	while (n>0 && s[n-1] != '(' && s[n-1] != ')') --n;
	s[n] = 0;

	int maxLen = 0;
	int maxCnt = 1;

	for(int i = 0; i < n; ++i)
	{

		if (s[i] == '(')
		{
			mStack.push(i);
		}
		else if (mStack.empty())
		{

		}
		else
		{
			int pos = mStack.top();
			mStack.pop();
			int currLen = i - pos + 1;
			if (currLen > maxLen)
			{
				maxLen = currLen;
				maxCnt = 1;
			}
			else if (currLen == maxLen)
			{
				maxCnt++;
			}
		}

	}

	while (mStack.empty() == false)mStack.pop();

	int max2Len = 0;
	int max2Cnt  =1;
	for(int i = n - 1; i >= 0; --i)
	{
		if (s[i] == ')')
		{
			mStack.push(i);
		}
		else if (mStack.empty())
		{

		}
		else
		{
			int pos = mStack.top();
			mStack.pop();

			int currLen = pos - i + 1;

			if (currLen > max2Len)
			{
				max2Len = currLen;
				max2Cnt = 1;
			}
			else if (currLen == max2Len)
			{
				max2Cnt++;
			}
		}

	}

	if (maxLen < max2Len)
	{
		maxLen = max2Len;
		maxCnt = max2Cnt;
	}

	cout << maxLen << " " << maxCnt << endl;

	return (0);
}


#pragma comment(linker, "/STACK:64000000")
#define _CRT_SECURE_NO_DEPRECATE

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>

using namespace std;

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define FOR(i, n) for(int i = 0; i < int(n); i++)
#define FOR1(i, n) for(int i = 1; i <= int(n); i++)
#define forv(i, v) forn(i, v.size())

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define all(v) (v).begin( ), (v).end( )
#define VV vector
#define VI VV<int>
#define VS VV<string>
typedef pair<int, int> pii;
typedef long long ll;

int main()
{
#ifdef _DEBUG
	freopen(CIN_FILE, "rt", stdin);
	freopen(COUT_FILE, "wt", stdout);
#endif
	char c;
	map<int,int> st_p;
	stack<int> S;
	stack<char> Sk;
	S.push(0);
	st_p[0] = 1;
	int p = 0,mx = 0;
	while(scanf("%c",&c) != -1)
	{
		p++;
		if(c == '(')
		{
			S.push(p);
			Sk.push('(');
		}
		else if(c == ')')
		{
			if(!Sk.empty() && Sk.top() == '(')
			{
				Sk.pop();
				S.pop();
				st_p[p - S.top()]++;
				mx = max(mx,p - S.top());
			}
			else
				S.push(p);

		}
	}
	printf("%d %d",mx,st_p[mx]);
	return 0;
}


#pragma comment(linker, "/STACK:64000000")
#define _CRT_SECURE_NO_DEPRECATE

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>

using namespace std;

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define FOR(i, n) for(int i = 0; i < int(n); i++)
#define FOR1(i, n) for(int i = 1; i <= int(n); i++)
#define forv(i, v) forn(i, v.size())

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define all(v) (v).begin( ), (v).end( )
#define VV vector
#define VI VV<int>
#define VS VV<string>
typedef pair<int, int> pii;
typedef long long ll;

int main()
{
#ifdef _DEBUG
	freopen(CIN_FILE, "rt", stdin);
	freopen(COUT_FILE, "wt", stdout);
#endif
	char c;
	map<int,int> st_p;
	stack<int> S;
	S.push(0);
	st_p[0] = 1;
	int p = 0,mx = 0;
	while(scanf("%c",&c) != -1)
	{
		p++;
		if(c == '(')
			S.push(p);
		else if(c == ')')
		{
			if(S.empty() || (S.size() == 1 && S.top() == 0)) continue;
			st_p[p - S.top() + 1]++;
			mx = max(mx,p - S.top() + 1);
			S.pop();
		}
		else p--;
	}
	printf("%d %d",mx,st_p[mx]);
	return 0;
}


#pragma comment(linker, "/STACK:64000000")
#define _CRT_SECURE_NO_DEPRECATE

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>

using namespace std;

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define FOR(i, n) for(int i = 0; i < int(n); i++)
#define FOR1(i, n) for(int i = 1; i <= int(n); i++)
#define forv(i, v) forn(i, v.size())

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define all(v) (v).begin( ), (v).end( )
#define VV vector
#define VI VV<int>
#define VS VV<string>
typedef pair<int, int> pii;
typedef long long ll;

int main()
{
#ifdef _DEBUG
	freopen(CIN_FILE, "rt", stdin);
	freopen(COUT_FILE, "wt", stdout);
#endif
	char c;
	map<int,int> st_p;
	stack<int> S;
	//S.push(0);
	st_p[0] = 1;
	int p = 0,mx = 0;
	while(scanf("%c",&c) != - 1)
	{
		p++;
		if(c == '(')
		{
			S.push(p);
		}
		else if(c == ')')
		{
			if(S.empty()) continue;
			st_p[p - S.top() + 1]++;
			mx = max(mx,p - S.top() + 1);
			S.pop();
		}
		else p--;
	}
	printf("%d %d",mx,st_p[mx]);
	return 0;
}


#pragma comment(linker, "/STACK:64000000")
#define _CRT_SECURE_NO_DEPRECATE

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>

using namespace std;

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define FOR(i, n) for(int i = 0; i < int(n); i++)
#define FOR1(i, n) for(int i = 1; i <= int(n); i++)
#define forv(i, v) forn(i, v.size())

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define all(v) (v).begin( ), (v).end( )
#define VV vector
#define VI VV<int>
#define VS VV<string>
typedef pair<int, int> pii;
typedef long long ll;

int main()
{
#ifdef _DEBUG
	freopen(CIN_FILE, "rt", stdin);
	freopen(COUT_FILE, "wt", stdout);
#endif
	char c;
	map<int,int> st_p;
	stack<int> S;
	S.push(0);
	st_p[0] = 1;
	int p = 0,mx = 0;
	while(scanf("%c",&c) != - 1)
	{
		p++;
		if(c == '(')
		{
			S.push(p);
		}
		else if(c == ')')
		{
			if(S.empty() || (S.size() == 1 && S.top() == 0)) continue;
			st_p[p - S.top() + 1]++;
			mx = max(mx,p - S.top() + 1);
			S.pop();
		}
		else p--;
	}
	printf("%d %d",mx,st_p[mx]);
	return 0;
}


#pragma comment(linker, "/STACK:64000000")
#define _CRT_SECURE_NO_DEPRECATE

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>

using namespace std;

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define FOR(i, n) for(int i = 0; i < int(n); i++)
#define FOR1(i, n) for(int i = 1; i <= int(n); i++)
#define forv(i, v) forn(i, v.size())

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define all(v) (v).begin( ), (v).end( )
#define VV vector
#define VI VV<int>
#define VS VV<string>
typedef pair<int, int> pii;
typedef long long ll;

int main()
{
#ifdef _DEBUG
	freopen(CIN_FILE, "rt", stdin);
	freopen(COUT_FILE, "wt", stdout);
#endif
	char c;
	map<int,int> st_p;
	stack<int> S_pos;
	stack<char> S_b;
	S_pos.push(0);
	st_p[0] = 1;
	int p = 0,mx = 0;
	while(scanf("%c",&c) != -1)
	{
		p++;
		if(c == '(')
		{
			S_pos.push(p);
			S_b.push('(');
		}
		else if(c == ')')
		{
			if(!S_b.empty() && S_b.top() == '(')
			{
				S_b.pop();
				S_pos.pop();
				st_p[p - S_pos.top()]++;
				mx = max(mx,p - S_pos.top());
			}
			else
				S_pos.push(p);

		}
	}
	printf("%d %d",mx,st_p[mx]);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <map>
#include <algorithm>
using namespace std;
const int maxn = 1000005;
char all[maxn];
int preall[maxn], nextall[maxn];
map<int, int> ans;

int main(int argc, char *argv[]) {
	int book = 1, len = 0, maxlen, cnt, sp, j, stlen;
	scanf("%s", &all[1]);
	stlen = strlen(&all[1]);
	all[0] = 0;
	for(int i = 0; i <= stlen; i++){
		preall[i] = i-1;
		nextall[i] = i+1;
	}
	nextall[stlen] = 0;
	sp = 0;
	while(book){
		book = 0;
		for(int i = nextall[0]; i != 0; ){
			j = nextall[i];
			if(all[i]=='('){
				if(all[j] == ')'){
					all[i] = all[j] = 1;
					nextall[preall[i]] = nextall[j];
					preall[nextall[j]] = preall[i];
					if(preall[i])
						i = preall[i];
					else
						i = nextall[j];
					book = 1;
				}else
					i = j;
			}else
				i = j;
		}
	}
	for(int i = 1; i <= stlen; i++){
		if(all[i] == 1)
			len++;
		else if(len){
			if(!ans.count(len))
				ans[len] = 1;
			else
				ans[len]++;
			len = 0;
		}
	}
	if(len)
		if(!ans.count(len))
			ans[len] = 1;
		else
			ans[len]++;
	ans[0] = 1;
//	if(ans.size()){
//		maxlen = *max_element(ans.begin(), ans.end());
//		cnt = count(ans.begin(), ans.end(), maxlen);
//		printf("%d %d\n", maxlen, cnt);
//	}
//	else
//		printf("0 1\n");
//	maxlen = 0;
//	cnt = 1;
//	for(vector<int>::iterator ite = ans.begin(); ite != ans.end(); ++ite){
//		if(*ite > maxlen){
//			maxlen = *ite;
//			cnt = 1;
//		}else if(*ite == maxlen)
//			cnt++;
//	}
//	printf("%d %d\n", maxlen, cnt);
	pair<int, int> maxans = *ans.rbegin();
	printf("%d %d\n", maxans.first, maxans.second);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <list>
#include <map>
using namespace std;

const int maxn = 100005;

char all[maxn];
list<int> findall;
map<int, int> ans;

int main(int argc, char *argv[]) {
	scanf("%s", all);
	int stlen = strlen(all), book = 1, len = 0;
	for(int i = 0; i < stlen; i++)
		findall.push_back(i);
	while(book){
		book = 0;
		for(list<int>::iterator ite = findall.begin(); ite != findall.end();){
			if(all[*ite] == '('){
				if(all[*next(ite)]==')'){
					all[*ite] = all[*next(ite)] = 1;
					ite = findall.erase(ite, next(ite, 2));
					if(ite != findall.begin())
						ite--;
				}else
					ite++;
			}else
				ite++;
		}
	}
	for(int i = 0; i < stlen; i++){
		if(all[i] == 1)
			len++;
		else if(len){
			if(!ans.count(len))
				ans[len] = 1;
			else
				ans[len]++;
			len = 0;
		}
	}
	if(len)
		if(!ans.count(len))
			ans[len] = 1;
		else
			ans[len]++;
	ans[0] = 1;
	pair<int, int> maxans = *ans.rbegin();
	printf("%d %d\n", maxans.first, maxans.second);

	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 10005;
char all[maxn];
vector<int> ans;

int main(int argc, char *argv[]) {
	int book = 1, len = 0, maxlen, cnt;
	scanf("%s", all);
	while(book){
		book = 0;
		for(int i = 0; i < strlen(all); i++){
			if(all[i]=='('){
				for(int j = i+1; j < strlen(all); j++)
					if(all[j] == 1)
						continue;
					else{
						if(all[j] == ')'){
							all[i] = all[j] = 1;
							book = 1;
						}
						break;
					}
			}
		}
	}
	for(int i = 0; i < strlen(all); i++){
		if(all[i] == 1)
			len++;
		else if(len){
			ans.push_back(len);
			len = 0;
		}
	}
	if(len)
		ans.push_back(len);
//	if(ans.size()){
//		maxlen = *max_element(ans.begin(), ans.end());
//		cnt = count(ans.begin(), ans.end(), maxlen);
//		printf("%d %d\n", maxlen, cnt);
//	}
//	else
//		printf("0 1\n");
	maxlen = 0;
	cnt = 1;
	for(vector<int>::iterator ite = ans.begin(); ite != ans.end(); ++ite){
		if(*ite > maxlen){
			maxlen = *ite;
			cnt = 1;
		}else if(*ite == maxlen)
			cnt++;
	}
	printf("%d %d\n", maxlen, cnt);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 200005;
char all[maxn];
vector<int> ans;

int main(int argc, char *argv[]) {
	int book = 1, len = 0, maxlen, cnt;
	scanf("%s", all);
	while(book){
		book = 0;
		for(int i = 0; i < strlen(all); i++){
			if(all[i]=='('){
				for(int j = i+1; j < strlen(all); j++)
					if(all[j] == 1)
						continue;
					else{
						if(all[j] == ')'){
							all[i] = all[j] = 1;
							book = 1;
						}
						break;
					}
			}
		}
	}
	for(int i = 0; i < strlen(all); i++){
		if(all[i] == 1)
			len++;
		else if(len){
			ans.push_back(len);
			len = 0;
		}
	}
	if(len)
		ans.push_back(len);
//	if(ans.size()){
//		maxlen = *max_element(ans.begin(), ans.end());
//		cnt = count(ans.begin(), ans.end(), maxlen);
//		printf("%d %d\n", maxlen, cnt);
//	}
//	else
//		printf("0 1\n");
	maxlen = 0;
	cnt = 1;
	for(vector<int>::iterator ite = ans.begin(); ite != ans.end(); ++ite){
		if(*ite > maxlen){
			maxlen = *ite;
			cnt = 1;
		}else if(*ite == maxlen)
			cnt++;
	}
	printf("%d %d\n", maxlen, cnt);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <map>
#include <algorithm>
using namespace std;
const int maxn = 1000005;
char all[maxn];
int preall[maxn], nextall[maxn];
map<int, int> ans;

int main(int argc, char *argv[]) {
	int book = 1, len = 0, maxlen, cnt, j, stlen;
	scanf("%s", all);
	stlen = strlen(all);
	for(int i = 0; i < stlen; i++){
		preall[i] = i-1;
		nextall[i] = i+1;
	}
	nextall[stlen-1] = -1;
	while(book){
		book = 0;
		for(int i = 0; i != -1; i = nextall[i]){
			if(all[i]=='('){
				j = nextall[i];
				if(all[j] == ')'){
					all[i] = all[j] = 1;
					nextall[preall[i]] = nextall[j];
					preall[nextall[j]] = preall[i];
					book = 1;
				}
			}
		}
	}
	for(int i = 0; i < stlen; i++){
		if(all[i] == 1)
			len++;
		else if(len){
			if(!ans.count(len))
				ans[len] = 1;
			else
				ans[len]++;
			len = 0;
		}
	}
	if(len)
		if(!ans.count(len))
			ans[len] = 1;
		else
			ans[len]++;
	ans[0] = 1;
//	if(ans.size()){
//		maxlen = *max_element(ans.begin(), ans.end());
//		cnt = count(ans.begin(), ans.end(), maxlen);
//		printf("%d %d\n", maxlen, cnt);
//	}
//	else
//		printf("0 1\n");
//	maxlen = 0;
//	cnt = 1;
//	for(vector<int>::iterator ite = ans.begin(); ite != ans.end(); ++ite){
//		if(*ite > maxlen){
//			maxlen = *ite;
//			cnt = 1;
//		}else if(*ite == maxlen)
//			cnt++;
//	}
//	printf("%d %d\n", maxlen, cnt);
	pair<int, int> maxans = *ans.rbegin();
	printf("%d %d\n", maxans.first, maxans.second);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <list>
#include <map>
using namespace std;

const int maxn = 1000005;

char all[maxn];
list<int> findall;
map<int, int> ans;

int main(int argc, char *argv[]) {
	scanf("%s", all);
	int stlen = strlen(all), book = 1, len = 0;
	for(int i = 0; i < stlen; i++)
		findall.push_back(i);
	while(book){
		book = 0;
		for(list<int>::iterator ite = findall.begin(); ite != findall.end();){
			if(all[*ite] == '('){
				if(next(ite) != findall.end() && all[*next(ite)]==')'){
					all[*ite] = all[*next(ite)] = 1;
					ite = findall.erase(ite, next(ite, 2));
					if(ite != findall.begin())
						ite--;
				}else
					ite++;
			}else
				ite++;
		}
	}
	for(int i = 0; i < stlen; i++){
		if(all[i] == 1)
			len++;
		else if(len){
			if(!ans.count(len))
				ans[len] = 1;
			else
				ans[len]++;
			len = 0;
		}
	}
	if(len)
		if(!ans.count(len))
			ans[len] = 1;
		else
			ans[len]++;
	ans[0] = 1;
	pair<int, int> maxans = *ans.rbegin();
	printf("%d %d\n", maxans.first, maxans.second);

	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <list>
#include <map>
using namespace std;

const int maxn = 100005;

char all[maxn];
list<int> findall;
map<int, int> ans;

int main(int argc, char *argv[]) {
	scanf("%s", all);
	int stlen = strlen(all), book = 1, len = 0;
	for(int i = 0; i < stlen; i++)
		findall.push_back(i);
	while(book){
		book = 0;
		for(list<int>::iterator ite = findall.begin(); ite != findall.end();){
			if(all[*ite] == '('){
				if(next(ite) != findall.end() && all[*next(ite)]==')'){
					all[*ite] = all[*next(ite)] = 1;
					ite = findall.erase(ite, next(ite, 2));
					if(ite != findall.begin())
						ite--;
				}else
					ite++;
			}else
				ite++;
		}
	}
	for(int i = 0; i < stlen; i++){
		if(all[i] == 1)
			len++;
		else if(len){
			if(!ans.count(len))
				ans[len] = 1;
			else
				ans[len]++;
			len = 0;
		}
	}
	if(len)
		if(!ans.count(len))
			ans[len] = 1;
		else
			ans[len]++;
	ans[0] = 1;
	pair<int, int> maxans = *ans.rbegin();
	printf("%d %d\n", maxans.first, maxans.second);

	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> all;

int main(int argc, char *argv[]) {
	char c;
	int lc = 0, len = 0;
	all.clear();
	while((c = getchar()) != EOF){
		if(c == '(')
			lc++;
		else if(c == ')' && lc>0){
			len+=2;
			lc--;
		}
		if(lc==0 && len){
			all.push_back(len);
			len = 0;
		}
	}
	if(len)
		all.push_back(len);
	if(all.size())
		printf("%d %d\n", *max_element(all.begin(), all.end()), all.size());
	else
		printf("0 1\n");
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 10005;
char all[maxn];
vector<int> ans;

int main(int argc, char *argv[]) {
	int book = 1, len = 0;
	scanf("%s", all);
	while(book){
		book = 0;
		for(int i = 0; i < strlen(all); i++){
			if(all[i]=='('){
				for(int j = i+1; j < strlen(all); j++)
					if(all[j] == 1)
						continue;
					else{
						if(all[j] == ')'){
							all[i] = all[j] = 1;
							book = 1;
						}
						break;
					}
			}
		}
	}
	for(int i = 0; i < strlen(all); i++){
		if(all[i] == 1)
			len++;
		else if(len){
			ans.push_back(len);
			len = 0;
		}
	}
	if(len)
		ans.push_back(len);
	if(ans.size())
		printf("%d %d\n", *max_element(ans.begin(), ans.end()), ans.size());
	else
		printf("0 1\n");

	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <map>
#include <algorithm>
using namespace std;
const int maxn = 1000005;
char all[maxn];
map<int, int> ans;

int main(int argc, char *argv[]) {
	int book = 1, len = 0, maxlen, cnt;
	scanf("%s", all);
	while(book){
		book = 0;
		for(int i = 0; i < strlen(all); i++){
			if(all[i]=='('){
				for(int j = i+1; j < strlen(all); j++)
					if(all[j] == 1)
						continue;
					else{
						if(all[j] == ')'){
							all[i] = all[j] = 1;
							book = 1;
						}
						break;
					}
			}
		}
	}
	for(int i = 0; i < strlen(all); i++){
		if(all[i] == 1)
			len++;
		else if(len){
			if(!ans.count(len))
				ans[len] = 1;
			else
				ans[len]++;
			len = 0;
		}
	}
	if(len)
		if(!ans.count(len))
			ans[len] = 1;
		else
			ans[len]++;
	ans[0] = 1;
//	if(ans.size()){
//		maxlen = *max_element(ans.begin(), ans.end());
//		cnt = count(ans.begin(), ans.end(), maxlen);
//		printf("%d %d\n", maxlen, cnt);
//	}
//	else
//		printf("0 1\n");
//	maxlen = 0;
//	cnt = 1;
//	for(vector<int>::iterator ite = ans.begin(); ite != ans.end(); ++ite){
//		if(*ite > maxlen){
//			maxlen = *ite;
//			cnt = 1;
//		}else if(*ite == maxlen)
//			cnt++;
//	}
//	printf("%d %d\n", maxlen, cnt);
	pair<int, int> maxans = *ans.rbegin();
	printf("%d %d\n", maxans.first, maxans.second);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 100005;
char all[maxn];
vector<int> ans;

int main(int argc, char *argv[]) {
	int book = 1, len = 0, maxlen, cnt;
	scanf("%s", all);
	while(book){
		book = 0;
		for(int i = 0; i < strlen(all); i++){
			if(all[i]=='('){
				for(int j = i+1; j < strlen(all); j++)
					if(all[j] == 1)
						continue;
					else{
						if(all[j] == ')'){
							all[i] = all[j] = 1;
							book = 1;
						}
						break;
					}
			}
		}
	}
	for(int i = 0; i < strlen(all); i++){
		if(all[i] == 1)
			len++;
		else if(len){
			ans.push_back(len);
			len = 0;
		}
	}
	if(len)
		ans.push_back(len);
//	if(ans.size()){
//		maxlen = *max_element(ans.begin(), ans.end());
//		cnt = count(ans.begin(), ans.end(), maxlen);
//		printf("%d %d\n", maxlen, cnt);
//	}
//	else
//		printf("0 1\n");
	maxlen = 0;
	cnt = 1;
	for(vector<int>::iterator ite = ans.begin(); ite != ans.end(); ++ite){
		if(*ite > maxlen){
			maxlen = *ite;
			cnt = 1;
		}else if(*ite == maxlen)
			cnt++;
	}
	printf("%d %d\n", maxlen, cnt);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> all;

int main(int argc, char *argv[]) {
	char c;
	int lc = 0, len = 0;
	all.clear();
	while((c = getchar()) != EOF){
		if(c == '(')
			lc++;
		else if(c == ')'){
			if(lc>0){
				len+=2;
				lc--;
			}else if(len){
				all.push_back(len);
				len = 0;
			}
		}
	}
	if(len)
		all.push_back(len);
	if(all.size())
		printf("%d %d\n", *max_element(all.begin(), all.end()), all.size());
	else
		printf("0 1\n");
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 10005;
char all[maxn];
vector<int> ans;

int main(int argc, char *argv[]) {
	int book = 1, len = 0, maxlen, cnt;
	scanf("%s", all);
	while(book){
		book = 0;
		for(int i = 0; i < strlen(all); i++){
			if(all[i]=='('){
				for(int j = i+1; j < strlen(all); j++)
					if(all[j] == 1)
						continue;
					else{
						if(all[j] == ')'){
							all[i] = all[j] = 1;
							book = 1;
						}
						break;
					}
			}
		}
	}
	for(int i = 0; i < strlen(all); i++){
		if(all[i] == 1)
			len++;
		else if(len){
			ans.push_back(len);
			len = 0;
		}
	}
	if(len)
		ans.push_back(len);
	if(ans.size()){
		maxlen = *max_element(ans.begin(), ans.end());
		cnt = count(ans.begin(), ans.end(), maxlen);
		printf("%d %d\n", maxlen, cnt);
	}
	else
		printf("0 1\n");

	return 0;
}


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

using namespace std;

typedef pair<int,int> p;
#define mp make_pair
typedef long long ll;

string t;
int n, i, temp, maxValue;
int c[1000005]; //position of earliest opening bracket
int d[1000005]; //Position of corresponding open bracket
stack<int> openPos;
map<int, int> lenSec;

int main()
{
    ios::sync_with_stdio(false);
    cin >> t;
    n = t.size();
    maxValue = 0;
    for(i=0;i<n;i++)
    {
        if(t[i] == '(')
        {
            openPos.push(i);
        }
        else
        {
            if(openPos.empty())
            {
                c[i] = -1;
                d[i] = -1;
            }
            else
            {
                temp = openPos.top();
                openPos.pop();

                d[i] = temp;

                //If t in position d[i] - 1 is a close bracket and it has an open bracket.
                if(d[i] - 1 >= 0 && t[d[i] - 1] == ')' && c[d[i] - 1] != -1)
                    c[i] = c[d[i] - 1];
                else
                    c[i] = d[i];

                temp = i - c[i] + 1;
                maxValue = max(maxValue, temp);
                lenSec[temp] ++;
            }
        }
    }

    if(maxValue == 0)
        cout << "0 1" << endl;
    else
        cout << maxValue << " " << lenSec[maxValue] << endl;

    return 0;
}


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

using namespace std;

typedef pair<int,int> p;
#define mp make_pair
typedef long long ll;

string t;
int n, i, temp, maxValue;
stack<int> openPos;
map<int, int> lenSec;

int main()
{
    ios::sync_with_stdio(false);
    cin >> t;
    n = t.size();
    maxValue = 0;
    for(i=0;i<n;i++)
    {
        if(t[i] == '(')
        {
            openPos.push(i);
        }
        else
        {
            if(openPos.empty())
                continue;

            temp = openPos.top();
            openPos.pop();
            lenSec[i-temp+1] ++;
            maxValue = max(maxValue, i-temp+1);
        }
    }
    if(maxValue == 0)
        cout << "0 1" << endl;
    else
        cout << maxValue << " " << lenSec[maxValue] << endl;

    return 0;
}


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

using namespace std;

typedef pair<int,int> p;
#define mp make_pair
typedef long long ll;

string t;
int n, i, temp, maxValue, c[1000005], d[1000005];
stack<int> openPos;
map<int, int> lenSec;

int main()
{
    ios::sync_with_stdio(false);
    cin >> t;
    n = t.size();
    maxValue = 0;
    for(i=0;i<n;i++)
    {
        if(t[i] == '(')
        {
            openPos.push(i);
        }
        else
        {
            if(openPos.empty())
            {
                c[i] = -1;
                d[i] = -1;
            }
            else
            {
                temp = openPos.top();
                openPos.pop();

                d[i] = temp;

                if(d[i] - 1 >= 0 && t[d[i] - 1] == ')' && c[d[i] - 1] != -1)
                    c[i] = c[d[i] - 1];
                else
                    c[i] = d[i];

                temp = i - c[i] + 1;
                maxValue = max(maxValue, temp);
                lenSec[temp] ++;
            }
        }
    }

    if(maxValue == 0)
        cout << "0 1" << endl;
    else
        cout << maxValue << " " << lenSec[maxValue] << endl;

    return 0;
}


#include <stdio.h>
#include <map>

using namespace std;

map <int, int> mt;

char c;

int main()
{
	char s[200000];
	scanf("%s", &s);
	int k = 0;
	int z = 0;
	int t = 0;
	int mx = 0;
	mt[0]++;
	for( ; k < strlen(s) && s[k] != '('; ++k);
	for(int i = k; i < strlen(s); ++i)
	{
		if (s[i] == '(') ++z;
		if (s[i] == ')') --z;
		if (z >= 0) ++t;
		if (z < 0)
		{
			while (s[i] == ')') ++i;
			z = 1;
			t = 1;
		}
		if (z == 0)
		{
			mt[t]++;
			if (mx < t) mx = t;
		}
	}
	int x;
	printf("%d %d", mx, mt[mx]);
	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 <ctime>

using namespace std;

typedef long long LL;
typedef vector<int> vint;
typedef vector<vint> vvint;

const int inf = 1000 * 1000 * 1000;
const LL INF = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;

string S;
int n;
vint V;
stack<int> st;

int main()
{
	cin >> S;
	n = S.size();
	V.resize(n, -1);
	int res = 1, len = 0;
	for(int i = 0; i < n; ++i)
	{
		if (S[i] == ')')
			if (!st.empty())
				V[st.top()] = i, V[i] = st.top(), st.pop();
		if (S[i] == '(')
			st.push(i);
	}
	int cur = 0;
	int k = 0;
	while (cur < n)
	{
		if (V[cur] == -1)
		{
			if (k && k == len)
				++res;
			if (k > len)
			{
				res = 1;
				len = k;
			}
			k = 0;
		}
		else
			++k;
		++cur;
	}
	if (k && k == len)
		++res;
	if (k > len)
	{
		res = 1;
		len = k;
	}
	cout << len << " " << res << endl;
	return 0;
}


#include <stdio.h>
#include <map>

using namespace std;

map <int, int> mt;

char s[1000001];

int f(int x)
{
	x <<= 1;
	if (x > strlen(s)) return 0;
	if (!x) return 1;
	int k = 0;
	int t = 0;
	for(int i = 0; i < x; ++i)
	{
		if (s[i] == '(') ++k;
		else --k;
		if (k < 0) t = -1;
	}
	if (k == 0) ++t;
	else if (t = -1) ++t;
	bool d = 1;
	for(int i = x; i < strlen(s); ++i)
	{
		if (s[i] == '(') ++k;
		else --k;
		if (s[i - x] == ')') ++k;
		else --k;
		if (k == 0)
		{
			int temp = 0;
			for(int j = i - x + 1; j < i + 1; ++j)
			{
				if (s[j] == '(') ++temp;
				else --temp;
				if (temp < 0) d = 0;
			}
			if (d) ++t;
			d = 1;
		}
	}
	return t;
}

int main()
{

	scanf("%s", &s);
	int L = 0;
	int R = strlen(s);
	R /= 2;
	R++;
	int m = L + (R - L) / 2;
	while (!(f(m) && !f(m + 1)))
	{
		m = L + (R - L) / 2;
		if (!f(m)) R = m;
		else L = m;
	}
	printf("%d %d", m * 2, f(m));
	return 0;
}


#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>

using namespace std;

typedef vector<int> vint;

string S;
int sum[1 << 20];
int n;

inline void add(stack<pair<int, int> > & s, int x)
{
	if (s.empty())
		s.push(make_pair(x, x));
	else
		s.push(make_pair(x, min(x, s.top().second)));
}

int check(int len)
{
	stack<pair<int, int> > S1, S2;
	int cur = 0;
	int res = 0;
	for(int i = 0; i < len; ++i)
		add(S1, sum[i]);
	if (S1.top().first == 0 && S1.top().second == 0)
		++res;
	for(int i = len; i < n; ++i)
	{
		cur = sum[i - len];
		add(S1, sum[i]);
		if (S2.empty())
		{
			while (S1.size())
			{
				add(S2, S1.top().first);
				S1.pop();
			}
		}
		if (sum[i] - cur == 0)
			if (min(S1.empty() ? 0 : S1.top().second, S2.empty() ? 0 : S2.top().second) == 0)
				++res;
	}
	return res;
}

int main()
{
	memset(sum, 0, sizeof(sum));
	cin >> S;
	n = S.size();
	sum[0] = S[0] == '(' ? 1 : -1;
	for(int i = 1; i < S.size(); ++i)
		sum[i] = sum[i - 1] + (S[i] == '(' ? 1 : -1);
	int L = 0, R = n / 2 + 1;
	while (R - L > 1)
	{
		int M = (R + L) / 2;
		if (!check(2 * M))
			R = M;
		else
			L = M;
	}
	if (L == 0)
		cout << "0 1" << endl;
	else
		cout << 2 * L << " " << check(2 * L) << endl;
	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 <ctime>

using namespace std;

typedef long long LL;
typedef vector<int> vint;
typedef vector<vint> vvint;

const int inf = 1000 * 1000 * 1000;
const LL INF = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;

string S;
int sum[1 << 20];
int n;

inline void add(stack<pair<int, int> > & s, int x)
{
	if (s.empty())
		s.push(make_pair(x, x));
	else
		s.push(make_pair(x, min(x, s.top().second)));
}

int check(int len)
{
	stack<pair<int, int> > S1, S2;
	int cur = 0;
	int res = 0;
	for(int i = 0; i < len; ++i)
		add(S1, sum[i]);
	if (S1.top().first == 0 && S1.top().second == 0)
		++res;
	for(int i = len; i < n; ++i)
	{
		cur = sum[i - len];
		add(S1, sum[i]);
		if (S2.empty())
		{
			while (S1.size())
			{
				add(S2, S1.top().first);
				S1.pop();
			}
		}
		S2.pop();
		if (sum[i] - cur == 0)
			if (min(S1.empty() ? 0 : S1.top().second, S2.empty() ? 0 : S2.top().second) - cur == 0)
				++res;
	}
	return res;
}

int main()
{
	memset(sum, 0, sizeof(sum));
	cin >> S;
	n = S.size();
	sum[0] = S[0] == '(' ? 1 : -1;
	for(int i = 1; i < S.size(); ++i)
		sum[i] = sum[i - 1] + (S[i] == '(' ? 1 : -1);
	int L = 0, R = n / 2 + 1;
	while (R - L > 1)
	{
		int M = (R + L) / 2;
		if (!check(2 * M))
			R = M;
		else
			L = M;
	}
	if (L == 0)
		cout << "0 1" << endl;
	else
		cout << 2 * L << " " << check(2 * L) << endl;
	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 <ctime>

using namespace std;

typedef long long LL;
typedef vector<int> vint;
typedef vector<vint> vvint;

const int inf = 1000 * 1000 * 1000;
const LL INF = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;

string S;
int sum[1 << 20];
int n;

inline void add(stack<pair<int, int> > & s, int x)
{
	if (s.empty())
		s.push(make_pair(x, x));
	else
		s.push(make_pair(x, min(x, s.top().second)));
}

int check(int len)
{
	stack<pair<int, int> > S1, S2;
	int cur = 0;
	int res = 0;
	for(int i = 0; i < len; ++i)
		add(S1, sum[i]);
	if (S1.top().first == 0 && S1.top().second == 0)
		++res;
	for(int i = len; i < n; ++i)
	{
		cur = sum[i - len];
		add(S1, sum[i]);
		if (S2.empty())
		{
			while (S1.size())
			{
				add(S2, S1.top().first);
				S1.pop();
			}
		}
		S2.pop();
		if (sum[i] - cur == 0)
			if (min(S1.empty() ? inf : S1.top().second, S2.empty() ? inf : S2.top().second) - cur == 0)
				++res;
	}
	return res;
}

int main()
{
	memset(sum, 0, sizeof(sum));
	cin >> S;
	n = S.size();
	sum[0] = S[0] == '(' ? 1 : -1;
	for(int i = 1; i < S.size(); ++i)
		sum[i] = sum[i - 1] + (S[i] == '(' ? 1 : -1);
	int L = 0, R = n / 2 + 1;
	while (R - L > 1)
	{
		int M = (R + L) / 2;
		if (!check(2 * M))
			R = M;
		else
			L = M;
	}
	if (L == 0)
		cout << "0 1" << endl;
	else
		cout << 2 * L << " " << check(2 * L) << endl;
	return 0;
}


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

#define MAXN 1000005
#define MAXM 100005
#define MOD 10007
#define inf 100000000
#define eps 1e-9
#define pi acos(-1.0)
#define LL long long
#define I64 __int64

using namespace std;

char str[MAXN];
int a[MAXN], len;
stack<char> sta;

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt", "w", stdout);
	scanf ("%s", str);
	int tlen = strlen(str);
	int temp = 0;
	for (int i = 0; i < tlen; i++) {
		if (str[i] == '(')
			sta.push(str[i]);
		else {
			if (!sta.empty()) {
				temp += 2;
				sta.pop();
				if (sta.empty()) {
					a[len++] = temp;
					temp = 0;
				}
			}
		}
	}
	int ans = 0, cnt = 0;
	for (int i = 0; i < len; i++)
		if (a[i] > ans)
			ans = a[i];
	for (int i = 0; i < len; i++)
		if (a[i] == ans)
			cnt++;
	if (ans == 0) {
		puts("0 1");
	} else {
		printf ("%d %d\n", ans, cnt);
	}
    return 0;
}


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

#define MAXN 1000005
#define MAXM 100005
#define MOD 10007
#define inf 100000000
#define eps 1e-9
#define pi acos(-1.0)
#define LL long long
#define I64 __int64

using namespace std;

stack<int> sta;
int res[MAXN];
char str[MAXN];

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt", "w", stdout);
	scanf ("%s", str);
	int len = strlen(str);
	for (int i = 0; i <len; i++) {
		if (str[i] == ')') {
			if (!sta.empty()) {
				res[i] = i - sta.top() + 1;
				if (sta.top() > 0 && res[sta.top() - 1] != -1) {
					res[i] = res[i] + res[sta.top() - 1];
				}
				sta.pop();
			} else
				res[i] = -1;
		} else {
			res[i] = -1;
			sta.push(i);
		}
	}
	int ans = 0, cnt = 1;
	for (int i = 0; i < len; i++) {
		if (res[i] > ans) {
			ans = res[i];
			cnt = 1;
		} else if (res[i] == ans)
			cnt++;
	}
	if (ans == 0) {
		printf ("0 1\n");
		return 0;
	}
	printf ("%d %d\n", ans, cnt);
    return 0;
}


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

#define MAXN 1000005
#define MAXM 100005
#define MOD 10007
#define inf 100000000
#define eps 1e-9
#define pi acos(-1.0)
#define LL long long
#define I64 __int64

using namespace std;

char str[MAXN];
int a[MAXN], len;
stack<char> sta;

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt", "w", stdout);
	scanf ("%s", str);
	int tlen = strlen(str);
	int temp = 0;
	bool flag = true;
	for (int i = 0; i < tlen; i++) {
		if (str[i] == '(')
			sta.push(str[i]);
		else {
			if (!sta.empty()) {
				temp += 2;
				sta.pop();
				if (sta.empty()) {
					if (!flag)
						len++;
					a[len] += temp;
					temp = 0;
					if (i + 1 < tlen && str[i + 1] == '(')
						flag = true;
					else
						flag = false;
				}
			}
		}
	}
	len++;
	int ans = 0, cnt = 0;
	for (int i = 0; i < len; i++)
		if (a[i] > ans)
			ans = a[i];
	for (int i = 0; i < len; i++)
		if (a[i] == ans)
			cnt++;
	if (ans == 0) {
		puts("0 1");
	} else {
		printf ("%d %d\n", ans, cnt);
	}
    return 0;
}


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

#define MAXN 1000005
#define MAXM 100005
#define MOD 10007
#define inf 100000000
#define eps 1e-9
#define pi acos(-1.0)
#define LL long long
#define I64 __int64

using namespace std;

char str[MAXN];
int a[MAXN], len;
stack<char> sta;

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt", "w", stdout);
	scanf ("%s", str);
	int tlen = strlen(str), temp = 0;
	for (int i = 0; i < tlen; i++) {
		if (str[i] == '(')
			sta.push(str[i]);
		else {
			if (!sta.empty()) {
				a[len] += 2;
				sta.pop();
			} else
				len++;
		}
	}
	len++;
	int ans = 0, count = 0;
	for (int i = 0; i < len; i++)
		if (a[i] > ans)
			ans  = a[i];
	if (ans == 0) {
		printf ("0 1\n");
	} else {
		for (int i = 0; i < len; i++)
			if (a[i] == ans)
				count++;
		printf ("%d %d\n", ans, count);
	}
    return 0;
}


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

string str;
const int N=1000000;
bool flag[N];
stack<int> sk;
int MAX(-1),k(0);

void init(){
    cin>>str;
}

void solve(){
    for(int i=0;i<str.size();i++){
        if(str[i]=='('){
            sk.push(i);
        }else{
            if(!sk.empty()){
                flag[i]=true;
                flag[sk.top()]=true;
                sk.pop();
            }
        }
    }
    int cnt(0);
    for(int i=0;i<str.size();i++){
        if(flag[i]){
            cnt++;
        }else{
            if(cnt>MAX){
                MAX=cnt;
                k=1;
            }else if(cnt==MAX){
                k++;
            }
            cnt=0;
        }
    }
    if(cnt>MAX){
        MAX=cnt;
        k=1;
    }else if(cnt==MAX){
        k++;
    }
    if(MAX<1){
        cout<<"0 1"<<endl;
    }else{
        cout<<MAX<<" "<<k<<endl;
    }
}

int main(){
    init();
    solve();
    return 0;
}


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

int main(){
    string str;
    cin>>str;
    int counter(0);
    int cnt(0);
    int k(0);
    int max(-1);
    for(int i=0;i<str.size();i++){
        if(str[i]=='('){
            cnt++;
        }else{
            if(cnt>0){
                cnt--;
                counter+=2;
            }else{
                if(counter>max){
                    max=counter;
                    k=1;
                }else if(counter==max){
                    k++;
                }
                counter=0;
            }
        }
    }
    if(counter>max){
        max=counter;
        k=1;
    }else if(counter==max){
        k++;
    }
    if(max==0){
        cout<<"0 1"<<endl;
    }else{
        cout<<max<<" "<<k<<endl;
    }
    return 0;
}


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

int main(){
    string str;
    cin>>str;
    int counter(0);
    int cnt(0);
    int k(0);
    int max(0);
    for(int i=0;i<str.size();i++){
        if(str[i]=='('){
            cnt++;
        }else{
            if(cnt){
                cnt--;
                counter+=2;
            }else{
                if(counter>max){
                    max=counter;
                    k=1;
                }else if(counter==max){
                    k++;
                }
                counter=0;
            }
        }
    }
    if(counter>max){
        max=counter;
        k=1;
    }else if(counter==max){
        k++;
    }
    if(max==0){
        cout<<"0 1"<<endl;
    }else{
        cout<<counter<<" "<<k<<endl;
    }
    return 0;
}


// cf5c
#include <iostream>
using namespace std;

char s[1000004];
int c[1000004],d[1000004],stack[1000004];

int main()
{
  int len,sp=0,j,maxc=-1,count=0;

#ifndef ONLINE_JUDGE
  FILE *stream;
  freopen_s(&stream,"testfile","r",stdin);
#endif
  cin >> s;
  len=(int)strlen(s);
  for(j=0;j<len;j++){
    if(s[j]=='(') stack[sp++]=j ;
    else if(sp==0){
      c[j]=-1;
      d[j]=-1;
    }
    else{
      d[j]=stack[--sp];
      if(s[d[j]-1]==')' && c[d[j]-1]!=-1) c[j]=c[d[j]-1];
      else c[j]=d[j];
      maxc=max(maxc,j-c[j]);
    }
  }
  if(maxc==-1) cout << "0 1\n";
  else{
    for(j=0;j<len;j++) if(s[j]==')' && j[c]>=0 && j-c[j]==maxc) count++;
    cout << maxc+1 << ' ' << count << '\n';
  }
  return 0;
}


// cf5c
#include <iostream>
using namespace std;

char s[1000004];
int c[1000004],d[1000004],stack[1000004];

int main()
{
  int len,sp=0,j,maxc=-1,count=0;

#ifndef ONLINE_JUDGE
  FILE *stream;
  freopen_s(&stream,"testfile","r",stdin);
#endif
  cin >> s;
  len=(int)strlen(s);
  for(j=0;j<len;j++){
    if(s[j]=='(') stack[sp++]=j ;
    else if(sp==0){
      c[j]=-1;
      d[j]=-1;
    }
    else{
      d[j]=stack[--sp];
      if(s[d[j]-1]==')' && c[d[j]-1]!=-1) c[j]=c[d[j]-1];
      else c[j]=d[j];
      maxc=max(maxc,j-c[j]);
    }
  }
  if(maxc==-1) cout << "0 1\n";
  else{
    for(j=0;j<len;j++) if(s[j]==')' && j-c[j]==maxc) count++;
    cout << maxc+1 << ' ' << count << '\n';
  }
  return 0;
}


// cf5c
#include <iostream>
using namespace std;

char s[1000004];
int c[1000004],d[1000004],stack[1000004];

int main()
{
  int len,sp=0,j,maxc=-1,count=0;

#ifndef ONLINE_JUDGE
  FILE *stream;
  freopen_s(&stream,"testfile","r",stdin);
#endif
  cin >> s;
  len=(int)strlen(s);
  for(j=0;j<len;j++){
    if(s[j]=='(') stack[sp++]=j ;
    else if(sp==0){
      c[j]=-1;
      d[j]=-1;
    }
    else{
      d[j]=stack[--sp];
      if(s[d[j]-1]==')' && c[d[j]-1]!=-1) c[j]=c[d[j]-1];
      else c[j]=d[j];
      maxc=max(maxc,j-c[j]);
    }
  }
  if(maxc==-1) cout << "0 1\n";
  else{
    for(j=0;j<len;j++) if(j-c[j]==maxc) count++;
    cout << maxc+1 << ' ' << count << '\n';
  }
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
char s[3000000];
int levels[3000000];
struct elem
{
	int a;
	int index;
};
elem ab[3000000];
int mins[3000000];
struct tree
{
	int a,b;
	int min;
	tree *left,*right;
};
tree* createtree(int a,int b)
{
	tree* n=(tree*)malloc(sizeof(tree));
	n->a=a;
	n->b=b;
	if (a==b)
	{
		n->left=0;
		n->right=0;
		n->min=levels[a];
	}
	else
	{
		int a2=(a+b)/2;
		int b2=(a+b)/2+1;
		tree *t1=createtree(a,a2);
		tree *t2=createtree(b2,b);
		n->min=(t1->min>t2->min)?t2->min:t1->min;
		n->left=t1;
		n->right=t2;

	}
	return n;
}
int cmp(const void *a,const void *b)
{
	elem aa=*((elem*)a);
	elem bb=*((elem*)b);
	if (aa.a>bb.a)
		return 1;
	if (aa.a<bb.a)
		return -1;
	if (aa.index>bb.index)
		return 1;
	if (aa.index<bb.index)
		return -1;
	return 0;
}
int min(tree* root,int a,int b)
{
	if ((a<=root->a)&&(b>=root->b))
		return root->min;
	if ((root->b<a)||(root->a>b))
		return 100000000;

	int min1=min(root->left,a,b);
	int min2=min(root->right,a,b);
	if (min1>min2)
		return min2;
	else
		return min1;

}
void main()
{
	gets(s);
	/*
	for (int i=0;i<500000;i++)
		s[i]='(';
	for (int i=500000;i<1000000;i++)
		s[i]=')';
	s[1000000]=0;
	*/
	int i=1;
	int level=0;
	ab[0].a=0;
	ab[0].index=0;
	while (s[i-1])
	{

		if (s[i-1]=='(')
			level++;
		if (s[i-1]==')')
			level--;
		levels[i]=level;
		ab[i].a=level;
		ab[i].index=i;
		i++;
	}
	int n=i;
	qsort(ab,n,sizeof(elem),cmp);
	long long mnumber=0;
	int maxlen=0;
	i=0;
	tree* root=createtree(0,n);
	for (int k=0;k<n;k++)

		{
				int m=min(root,ab[k].index,ab[k+1].index);
				if (m<ab[k].a)
					mins[k]=0;
				else
					mins[k]=1;
				if (ab[k].a!=ab[k+1].a)
					mins[k]=0;
		}
	while (i<n)
	{
		int j=i;
		while ((j<n)&&(ab[i].a==ab[j].a))
			j++;
		if (j==n)
			break;
		if (j-i>1)
		{

			int e=i;
			while (e<j)
			{
				while ((mins[e]==0)&&(e<j))
					e++;
				int t=e;
				while ((mins[t]==1)&&(t<j))
					t++;
				if (ab[t].index-ab[e].index>maxlen)
				{
					maxlen=ab[t].index-ab[e].index;
					mnumber=1;
				}
				else
					if (ab[t].index-ab[e].index==maxlen)
						mnumber+=1;
				e=t+1;

			}

		}
		i=j;

	}

	if (maxlen==0)
		printf("0 1");
	else
		printf("%d %I64d",maxlen,mnumber);

}


#include <stdio.h>
#include <stdlib.h>
char s[3000000];
int levels[3000000];
struct elem
{
	int a;
	int index;
};
elem ab[3000000];
int mins[3000000];
struct tree
{
	int a,b;
	int min;
	tree *left,*right;
};
tree* createtree(int a,int b)
{
	tree* n=(tree*)malloc(sizeof(tree));
	n->a=a;
	n->b=b;
	if (a==b)
	{
		n->left=0;
		n->right=0;
		n->min=levels[a];
	}
	else
	{
		int a2=(a+b)/2;
		int b2=(a+b)/2+1;
		tree *t1=createtree(a,a2);
		tree *t2=createtree(b2,b);
		n->min=(t1->min>t2->min)?t2->min:t1->min;
		n->left=t1;
		n->right=t2;

	}
	return n;
}
int cmp(const void *a,const void *b)
{
	elem aa=*((elem*)a);
	elem bb=*((elem*)b);
	if (aa.a>bb.a)
		return 1;
	if (aa.a<bb.a)
		return -1;
	if (aa.index>bb.index)
		return 1;
	if (aa.index<bb.index)
		return -1;
	return 0;
}
int min(tree* root,int a,int b)
{
	if ((a<=root->a)&&(b>=root->b))
		return root->min;
	if ((root->b<a)||(root->a>b))
		return 100000000;

	int min1=min(root->left,a,b);
	int min2=min(root->right,a,b);
	if (min1>min2)
		return min2;
	else
		return min1;

}
void main()
{
	gets(s);
	/*
	for (int i=0;i<500000;i++)
		s[i]='(';
	for (int i=500000;i<1000000;i++)
		s[i]=')';
	s[1000000]=0;
	*/
	int i=1;
	int level=0;
	ab[0].a=0;
	ab[0].index=0;
	while (s[i-1])
	{

		if (s[i-1]=='(')
			level++;
		if (s[i-1]==')')
			level--;
		levels[i]=level;
		ab[i].a=level;
		ab[i].index=i;
		i++;
	}
	int n=i;
	qsort(ab,n,sizeof(elem),cmp);
	long long mnumber=0;
	int maxlen=0;
	i=0;
	tree* root=createtree(0,n);
	for (int k=0;k<n;k++)
		if (ab[k].a==ab[k+1].a)
		{
				int m=min(root,ab[k].index,ab[k+1].index);
				if (m<ab[k].a)
					mins[k]=0;
				else
					mins[k]=1;
		}
	while (i<n)
	{
		int j=i;
		while ((j<n)&&(ab[i].a==ab[j].a))
			j++;
		if (j==n)
			break;
		if (j-i>1)
		{

			int e=i;
			while (e<j)
			{
				while (mins[e]==0)
					e++;
				int t=e;
				while(mins[t]==1)
					t++;
				if (ab[t].index-ab[e].index>maxlen)
				{
					maxlen=ab[t].index-ab[e].index;
					mnumber=1;
				}
				else
					if (ab[t].index-ab[e].index==maxlen)
						mnumber+=1;
				e=t+1;

			}

		}
		i=j;

	}

	if (maxlen==0)
		printf("0 1");
	else
		printf("%d %I64d",maxlen,mnumber);

}


#include <stdio.h>
#include <stdlib.h>
char s[3000000];
int levels[3000000];
struct elem
{
	int a;
	int index;
};
elem ab[3000000];
int mins[3000000];
struct tree
{
	int a,b;
	int min;
	tree *left,*right;
};
tree* createtree(int a,int b)
{
	tree* n=(tree*)malloc(sizeof(tree));
	n->a=a;
	n->b=b;
	if (a==b)
	{
		n->left=0;
		n->right=0;
		n->min=levels[a];
	}
	else
	{
		int a2=(a+b)/2;
		int b2=(a+b)/2+1;
		tree *t1=createtree(a,a2);
		tree *t2=createtree(b2,b);
		n->min=(t1->min>t2->min)?t2->min:t1->min;
		n->left=t1;
		n->right=t2;

	}
	return n;
}
int cmp(const void *a,const void *b)
{
	elem aa=*((elem*)a);
	elem bb=*((elem*)b);
	if (aa.a>bb.a)
		return 1;
	if (aa.a<bb.a)
		return -1;
	if (aa.index>bb.index)
		return 1;
	if (aa.index<bb.index)
		return -1;
	return 0;
}
int min(tree* root,int a,int b)
{
	if ((a<=root->a)&&(b>=root->b))
		return root->min;
	if ((root->b<a)||(root->a>b))
		return 100000000;

	int min1=min(root->left,a,b);
	int min2=min(root->right,a,b);
	if (min1>min2)
		return min2;
	else
		return min1;

}
void main()
{
	gets(s);
	/*
	for (int i=0;i<500000;i++)
		s[i]='(';
	for (int i=500000;i<1000000;i++)
		s[i]=')';
	s[1000000]=0;
	*/
	int i=1;
	int level=0;
	ab[0].a=0;
	ab[0].index=0;
	while (s[i-1])
	{

		if (s[i-1]=='(')
			level++;
		if (s[i-1]==')')
			level--;
		levels[i]=level;
		ab[i].a=level;
		ab[i].index=i;
		i++;
	}
	int n=i;
	qsort(ab,n,sizeof(elem),cmp);
	long long mnumber=0;
	int maxlen=0;
	i=0;
	tree* root=createtree(0,n);
	for (int k=0;k<=n;k++)
		if (ab[k].a==ab[k+1].a)
		{
				int m=min(root,ab[k].index,ab[k+1].index);
				if (m<ab[k].a)
					mins[k]=0;
				else
					mins[k]=1;
		}
	while (i<n)
	{
		int j=i;
		while ((j<n)&&(ab[i].a==ab[j].a))
			j++;
		if (j==n)
			break;
		if (j-i>1)
		{

			int e=i;
			while (e<j)
			{
				while (mins[e]==0)
					e++;
				int t=e;
				while(mins[t]==1)
					t++;
				if (ab[t].index-ab[e].index>maxlen)
				{
					maxlen=ab[t].index-ab[e].index;
					mnumber=1;
				}
				else
					if (ab[t].index-ab[e].index==maxlen)
						mnumber+=1;
				e=t+1;

			}

		}
		i=j;

	}

	if (maxlen==0)
		printf("0 1");
	else
		printf("%d %I64d",maxlen,mnumber);

}


#include <stdio.h>
#include <stdlib.h>
char s[3000000];
int levels[3000000];
struct elem
{
	int a;
	int index;
};
elem ab[3000000];
int mins[3000000];
struct tree
{
	int a,b;
	int min;
	tree *left,*right;
};
tree* createtree(int a,int b)
{
	tree* n=(tree*)malloc(sizeof(tree));
	n->a=a;
	n->b=b;
	if (a==b)
	{
		n->left=0;
		n->right=0;
		n->min=levels[a];
	}
	else
	{
		int a2=(a+b)/2;
		int b2=(a+b)/2+1;
		tree *t1=createtree(a,a2);
		tree *t2=createtree(b2,b);
		n->min=(t1->min>t2->min)?t2->min:t1->min;
		n->left=t1;
		n->right=t2;

	}
	return n;
}
int cmp(const void *a,const void *b)
{
	elem aa=*((elem*)a);
	elem bb=*((elem*)b);
	if (aa.a>bb.a)
		return 1;
	if (aa.a<bb.a)
		return -1;
	if (aa.index>bb.index)
		return 1;
	if (aa.index<bb.index)
		return -1;
	return 0;
}
int min(tree* root,int a,int b)
{
	if ((a<=root->a)&&(b>=root->b))
		return root->min;
	if ((root->b<a)||(root->a>b))
		return 100000000;

	int min1=min(root->left,a,b);
	int min2=min(root->right,a,b);
	if (min1>min2)
		return min2;
	else
		return min1;

}
void main()
{
	gets(s);
	int i=1;
	int level=0;
	ab[0].a=0;
	ab[0].index=0;
	while (s[i-1])
	{

		if (s[i-1]=='(')
			level++;
		if (s[i-1]==')')
			level--;
		levels[i]=level;
		ab[i].a=level;
		ab[i].index=i;
		i++;
	}
	int n=i;
	qsort(ab,n,sizeof(elem),cmp);
	long long mnumber=0;
	int maxlen=0;
	i=0;
	tree* root=createtree(0,n);
	while (i<n)
	{
		int j=i;
		while ((j<n)&&(ab[i].a==ab[j].a))
			j++;
		if (j==n)
			break;
		if (j-i>1)
		{
			for (int k=i;k<=j-2;k++)
			{
				int m=min(root,ab[k].index,ab[k+1].index);
				if (m<ab[k].a)
					mins[k]=0;
				else
					mins[k]=1;
			}
			int e=i;
			while (e<j)
			{
				while (mins[e]==0)
					e++;
				int t=e;
				while(mins[t]==1)
					t++;
				if (ab[t].index-ab[e].index>maxlen)
				{
					maxlen=ab[t].index-ab[e].index;
					mnumber=1;
				}
				else
					if (ab[t].index-ab[e].index==maxlen)
						mnumber+=1;
				e=t+1;

			}

		}
		i=j;

	}

	if (maxlen==0)
		printf("0 1");
	else
		printf("%d %I64d",maxlen,mnumber);

}


#include <stdio.h>
#include <stdlib.h>
char s[3000000];
int levels[3000000];
struct elem
{
	int a;
	int index;
};
elem ab[3000000];
int mins[3000000];
struct tree
{
	int a,b;
	int min;
	tree *left,*right;
};
tree* createtree(int a,int b)
{
	tree* n=(tree*)malloc(sizeof(tree));
	n->a=a;
	n->b=b;
	if (a==b)
	{
		n->left=0;
		n->right=0;
		n->min=levels[a];
	}
	else
	{
		int a2=(a+b)/2;
		int b2=(a+b)/2+1;
		tree *t1=createtree(a,a2);
		tree *t2=createtree(b2,b);
		n->min=(t1->min>t2->min)?t2->min:t1->min;
		n->left=t1;
		n->right=t2;

	}
	return n;
}
int cmp(const void *a,const void *b)
{
	elem aa=*((elem*)a);
	elem bb=*((elem*)b);
	if (aa.a>bb.a)
		return 1;
	if (aa.a<bb.a)
		return -1;
	if (aa.index>bb.index)
		return 1;
	if (aa.index<bb.index)
		return -1;
	return 0;
}
int min(tree* root,int a,int b)
{
	if ((a<=root->a)&&(b>=root->b))
		return root->min;
	if ((root->b<a)||(root->a>b))
		return 100000000;

	int min1=min(root->left,a,b);
	int min2=min(root->right,a,b);
	if (min1>min2)
		return min2;
	else
		return min1;

}
void main()
{
	gets(s);
	/*
	for (int i=0;i<500000;i++)
		s[i]='(';
	for (int i=500000;i<1000000;i++)
		s[i]=')';
	s[1000000]=0;
	*/
	int i=1;
	int level=0;
	ab[0].a=0;
	ab[0].index=0;
	while (s[i-1])
	{

		if (s[i-1]=='(')
			level++;
		if (s[i-1]==')')
			level--;
		levels[i]=level;
		ab[i].a=level;
		ab[i].index=i;
		i++;
	}
	int n=i;
	qsort(ab,n,sizeof(elem),cmp);
	long long mnumber=0;
	int maxlen=0;
	i=0;
	tree* root=createtree(0,n);
	for (int k=0;k<n;k++)
		{
				int m=min(root,ab[k].index,ab[k+1].index);
				if (m<ab[k].a)
					mins[k]=0;
				else
					mins[k]=1;
		}
	while (i<n)
	{
		int j=i;
		while ((j<n)&&(ab[i].a==ab[j].a))
			j++;
		if (j==n)
			break;
		if (j-i>1)
		{

			int e=i;
			while (e<j)
			{
				while (mins[e]==0)
					e++;
				int t=e;
				while(mins[t]==1)
					t++;
				if (ab[t].index-ab[e].index>maxlen)
				{
					maxlen=ab[t].index-ab[e].index;
					mnumber=1;
				}
				else
					if (ab[t].index-ab[e].index==maxlen)
						mnumber+=1;
				e=t+1;

			}

		}
		i=j;

	}

	if (maxlen==0)
		printf("0 1");
	else
		printf("%d %I64d",maxlen,mnumber);

}


#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
using namespace std;
int main(void)
{
	int i,n,counter=0;
	string S;
	stack<char,list<char>> St;
	map<int,int,greater<int>> M;
	cin>>S;
	n=S.length();
	for (i=0;i<n;i++)
	{
		if (S[i]=='(')
		{
			St.push(S[i]);
			M[counter]++;
			counter=0;
		}
		else if (S[i]==')')
		{
			if(!St.empty() && St.top()=='(')
			{
				counter+=2;
				St.pop();
			}
			else if (St.empty())
			{
				M[counter]++;
				counter=0;
			}
		}
	}
	M[counter]++;
	if (M.empty() || M.begin()->first==0)
		cout<<"0"<<" 1\n";
	else cout<<M.begin()->first<<" "<<M.begin()->second<<endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
using namespace std;
int main(void)
{
	int i,n,counter=0;
	string S;
	stack<char,list<char>> St;
	map<int,int,greater<int>> M;
	cin>>S;
	n=S.length();
	for (i=0;i<n;i++)
	{
		if (S[i]=='(')
		{
			if (!St.empty())
				St.push(S[i]);
			else
			{
				St.push(S[i]);
				M[counter]++;
				counter=0;
			}
		}
		else if (S[i]==')')
		{
			if(!St.empty() && St.top()=='(')
			{
				counter+=2;
				St.pop();
			}
			else if (St.empty())
			{
				M[counter]++;
				counter=0;
			}
		}
	}
	M[counter]++;
	if (M.empty() || M.begin()->first==0)
		cout<<"0"<<" 1\n";
	else cout<<M.begin()->first<<" "<<M.begin()->second<<endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
using namespace std;
int main(void)
{
	int i,n,counter=0,helper=0,first=0;
	bool flag=false;
	string S;
	list<int> L1,L2;
	list<int>::iterator it,prev;
	map<int,int,greater<int>> M;
	cin>>S;
	n=S.length();
	for (i=0;i<n;i++)
	{
		if (S[i]=='(')
			L1.push_back(i);
		else if (S[i]==')')
		{
			if (!L1.empty())
				L1.pop_back();
			else if (L1.empty())
				L2.push_back(i);
		}
	}
	L1.merge(L2);
	L1.push_front(-1);
	L1.push_back(n);
	it=L1.begin();
	prev=it;
	++it;
	for (it;it!=L1.end();)
	{
		M[*it-*prev-1]++;
		prev=it;
		it++;
	}
	if (!M.empty() && M.begin()->first>=2)
		 cout<<M.begin()->first<<" "<<M.begin()->second<<endl;
	else cout<<"0 1\n"<<endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <hash_map>
#include <map>
#include <hash_set>
#include <set>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long LL;
#define mems(arr, val) memset(arr, val, sizeof(arr));
#define iterat(A) A.begin(), A.end()
#define forn(from, to) for(int i = from; i < to; ++i)
#define INF 2000000000

struct skobka
{
	char val;
	int pos;
};

pair<int, int> go(string str)
{
		stack<skobka> S;
	int max_value = -1, max_count = 0;
	int cur_count = 0;
	for (int i = 0; i < str.length(); ++i)
	{
		if (str[i] == '(')
		{
			skobka new_s;
			new_s.pos = i;
			new_s.val = '(';
			S.push(new_s);
		}
		else
		{
			if (S.size() > 0)
			{
				cur_count += 2;
				if (cur_count == max_value)
				{
					max_count++;
				}
				if (cur_count > max_value)
				{
					max_value = cur_count;
					max_count = 1;
				}
				S.pop();
			}
			else
			{
				cur_count = 0;
				cur_count = 0;
			}

		}
	}
	if (max_value == -1 && max_count == 0)
	{
		max_value = 0;
		max_count = 1;
	}
	return make_pair(max_value, max_count);
}

int main()
{
	freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
	string str;
	cin>>str;
	stack<skobka> S;

	auto p1 = go(str);
	reverse(str.begin(), str.end());
	auto p2 = go(str);

	auto p = p1.first < p2.first ? p1 : p2;

	if (p1.first == p2.first) p.second = max(p1.second, p2.second);
	cout<<p.first<<" "<<p.second;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <hash_map>
#include <map>
#include <hash_set>
#include <set>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long LL;
#define mems(arr, val) memset(arr, val, sizeof(arr));
#define iterat(A) A.begin(), A.end()
#define forn(from, to) for(int i = from; i < to; ++i)
#define INF 2000000000

struct skobka
{
	char val;
	int pos;
};

int main()
{
	//freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
	string str;
	cin>>str;
	stack<skobka> S;
	int max_value = -1, max_count = 0;
	int cur_count = 0;
	for (int i = 0; i < str.length(); ++i)
	{
		if (str[i] == '(')
		{
			skobka new_s;
			new_s.pos = i;
			new_s.val = '(';
			S.push(new_s);
		}
		else
		{
			if (S.size() > 0)
			{
				cur_count += 2;
				S.pop();
			}
			else
			{
				if (cur_count == max_value)
				{
					max_count++;
				}
				if (cur_count > max_value)
				{
					max_value = cur_count;
					max_count = 1;
				}
				cur_count = 0;
			}
			if (S.size() == 0 || i + 1 >= str.size())
			{
				if (cur_count == max_value)
				{
					max_count++;
				}
				if (cur_count > max_value)
				{
					max_value = cur_count;
					max_count = 1;
				}
			}
		}
	}
	if (max_value <= 0)
	{
		max_value = 0;
		max_count = 1;
	}

	cout<<max_value<<" "<<max_count;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <hash_map>
#include <map>
#include <hash_set>
#include <set>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long LL;
#define mems(arr, val) memset(arr, val, sizeof(arr));
#define iterat(A) A.begin(), A.end()
#define forn(from, to) for(int i = from; i < to; ++i)
#define INF 2000000000

struct skobka
{
	char val;
	int pos;
};

int main()
{
	//freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
	string str;
	cin>>str;
	stack<skobka> S;
	int max_value = -1, max_count = 0;
	for (int i = 0; i < str.length(); ++i)
	{
		if (str[i] == '(')
		{
			skobka new_s;
			new_s.pos = i;
			new_s.val = '(';
			S.push(new_s);
		}
		else
		{
			if (S.size() > 0)
			{
				int tmp_value = i - S.top().pos + 1;
				if (tmp_value == max_value)
				{
					max_count++;
				}
				if (tmp_value > max_value)
				{
					max_value = tmp_value;
					max_count = 1;
				}
				S.pop();
			}

		}
	}
	if (max_value == -1)
	{
		max_value = 0;
		max_count = 1;
	}
	cout<<max_value<<" "<<max_count;
	return 0;
}