#include<bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define forab(i, a, b) for (int i = (a); i <= (b); i++)
#define forba(i, b, a) for (int i = (b); i >= (a); i--)
#define mset(a, x, n) memset(a, x, sizeof(a[0]) * (n))
#define updiv(x, y) (((x) + (y) - 1) / (y)) // y > 0
#define pb push_back
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#ifdef hat
#define fast
#define de(x) cout  << #x << '=' << x << ' '
#define dee(x) cout  << #x << '=' << x << endl
#else
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define de(x) ((void) 0)
#define dee(x) ((void) 0)
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> VI;

const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
ll make_compiler_happy() {return INF & maxn & mod & llINF;}
ll fpow(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll inv(ll x) {return fpow(x, mod-2);}

int f[maxn], invf[maxn];
int sum[maxn];

int c(int x, int y)
{
    return (ll)f[x] * invf[y] % mod * invf[x - y] % mod;
}

int main()
{
    fast;
    string s;
    cin >> s;
    int n = sz(s);
    f[0] = invf[0] = 1;
    forab(i, 1, n)
        f[i] = (ll)f[i - 1] * i % mod;
    invf[n] = inv(f[n]);
    forba(i, n - 1, 0)
        invf[i] = (ll)invf[i + 1] * (i + 1) % mod;
    forba(i, n - 1, 0)
        sum[i] = sum[i + 1] + (s[i] == ')');
    ll ans = 0, cnt = 0;
    forn(i, n)
    {
        if(s[i] == '(') {
            ans += c(cnt + sum[i], cnt + 1);
            ans %= mod;
            cnt++;
        }
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;

const int MX = 2e5 + 5, MOD = 1000000007;
int fact[MX], factInv[MX];
string s;

ll inv(ll a, ll b) {
	return 1 < a ? b - inv(b % a, a) * b / a : 1;
}

int f(int L, int R) {
	int ret = 0;
	ret = fact[L + R];
	ret = (ret * 1LL * factInv[L]) % MOD;
	ret = (ret * 1LL * factInv[R]) % MOD;
	--ret;
	if (ret < 0)
		ret += MOD;
	return ret;
}

int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	fact[0] = 1;
	factInv[0] = inv(1, MOD);

	for (int i = 1; i < MX; ++i) {
		fact[i] = (fact[i - 1] * 1LL * i) % MOD;
		factInv[i] = (factInv[i - 1] * 1LL * inv(i, MOD)) % MOD;
	}

	cin >> s;

	int n = sz(s);

	int L = 0, R = 0;

	for (auto& c : s)
		R += c == ')';

	int ans = 0;

	for (int i = 0; i < n; ++i) {
		R -= s[i] == ')';

		db(i, L, R);

		if (s[i] == '(') {
			if (!L) {
				ans = (ans + R) % MOD;
			} else if (R) {
				ans = (ans + f(L + 1, R - 1) + 1) % MOD;
				ans = (ans - R + MOD) % MOD;
				ans = (ans + R + MOD) % MOD;
			}
		}
		db(ans);

		L += s[i] == '(';
	}

	cout << ans << '\n';

	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;

const int MX = 2e5 + 5, MOD = 1000000007;
int fact[MX], factInv[MX];
string s;

ll inv(ll a, ll b) {
	return 1 < a ? b - inv(b % a, a) * b / a : 1;
}

int S(int z) {
	if (!z)
		return 0;
	int ret = 0;
	ret = (2LL * fact[2 * z - 1]) % MOD;
	ret = (ret * 1LL * factInv[z]) % MOD;
	ret = (ret * 1LL * factInv[z - 1]) % MOD;
	--ret;
	if (ret < 0)
		ret += MOD;
	return ret;
}

int ans(int l, int r) {
	if (l >= r)
		return 0;

	int mid = (l + r) >> 1;

	int L = 0, R = 0;

	for (int i = l; i <= mid; ++i)
		L += s[i] == '(';

	for (int i = mid + 1; i <= r; ++i)
		R += s[i] == ')';

	return (((S(min(L, R)) + ans(l, mid)) % MOD) + ans(mid + 1, r)) % MOD;
}

int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	fact[0] = 1;
	factInv[0] = inv(1, MOD);

	for (int i = 1; i < MX; ++i) {
		fact[i] = (fact[i - 1] * 1LL * i) % MOD;
		factInv[i] = (factInv[i - 1] * 1LL * inv(i, MOD)) % MOD;
	}

	cin >> s;

	cout << ans(0, sz(s) - 1) << '\n';

	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
#define forn for(int i=0;i<s.size();i++)
typedef long long int ll;

int a=0,b=0; ll ans=0; string s;

ll comb(ll n,ll r){
ll res=1;
if(r>n-r){r=n-r;}
for(int i=0;i<r;i++){
    res=res*(n-i); res=res/(i+1); res=res%INF;}
return res;
}

int main(){
cin>>s; forn{if(s[i]==')'){b++;}}
forn{
    if(s[i]=='('){
        a++;
        ans=(ans+comb(a+b-1,a))%INF;
        }
    else{b--;}
    }
cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
#define LIM 200000
#define forn for(int i=0;i<s.size();i++)
typedef long long int ll;

int a=0,b=0; ll ans=0; string s;

ll fact[LIM];

ll modpow(ll a, ll b){
ll res=1; a=a%INF;
while(b>0){
    if(b%2==1){res=(res*a)%INF; b--; }
    else{a=(a*a)%INF; b=b/2; }
    }
    return res;
}

ll comb(ll n,ll r){
if(r>n-r){r=n-r;}
if(n<0||r<0||n<r){return 0;}
else{return fact[n]*(modpow(fact[r]*fact[n-r],INF-2)%INF);
}
}

int main(){
fact[0]=1;
for(int i=1;i<LIM;i++){fact[i]=(fact[i-1]*i)%INF;}
cin>>s; forn{if(s[i]==')'){b++;}}
forn{
    if(s[i]=='('){
        a++;
        ans=(ans+comb(a+b-1,a))%INF;
        }
    else{b--;}
    }
cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
#define forn for(int i=0;i<s.size();i++)
typedef long long int ll;

int a=0,b=0; ll ans=0; string s;

ll comb(ll n,ll r){
    if(r==0){return 1;}
    else if(n==r){return 1;}
    else{return (comb(n-1,r)%INF+comb(n-1,r-1)%INF)%INF;}
}

int main(){
cin>>s; forn{if(s[i]==')'){b++;}}
forn{
    if(s[i]=='('){
        a++;
        ans=(ans+comb(a+b-1,a))%INF;
        }
    else{b--;}
    }
cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
#define forn for(int i=0;i<s.size();i++)
typedef long long int ll;

int a=0,b=0; ll ans=0; string s;

ll comb(ll n,ll r){
int res=1;
if (r>n-r){r=n-r;}
for (int i=0;i<r;i++){
    res= res*(n - i); res= res/(i + 1); res=res%INF;}
return res;
}

int main(){
cin>>s; forn{if(s[i]==')'){b++;}}
forn{
    if(s[i]=='('){
        a++;
        ans=(ans+comb(a+b-1,a))%INF;
        }
    else{b--;}
    }
cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int a, int b);
int power(int x, unsigned int y, unsigned int m);
signed modInverse(int a, int m)
{
    int g = gcd(a, m);

        return power(a, m-2, m);

}
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;

    return (y%2 == 0)? p : (x * p) % m;
}
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b%a, a);
}
signed main()
{
    // freopen ("SampleInput1.txt","r",stdin);
    // freopen ("SampleOutput1.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int i,ans=0,mod=1000000007;
    int bef[s.length()+2]={0},fact[200005]={0};
    fact[0]=1;
    for(i=1;i<=200000;i++)
    	fact[i]=((i%mod)*(fact[i-1])%mod);
    for(i=0;i<s.length();i++)
    {
    	if(s[i]=='(')
    		bef[i]=1;
    }
    for(i=1;i<s.length();i++)
    bef[i]+=bef[i-1];
	for(i=0;i<s.length();i++)
	{
		if(s[i]=='(')
		{
			int x=bef[i];
			int y=s.length()-i-1-(bef[s.length()-1]-bef[i]);
			int z=x-1+y;
			// cout<<x<<" "<<y<<" "<<z<<"\n";
			ans=(ans%mod+(fact[z]%mod*modInverse((fact[x]%mod*fact[z-x]%mod)%mod,mod)%mod)%mod)%mod;
		}
	}
	cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int a, int b);
int power(int x, unsigned int y, unsigned int m);
signed modInverse(int a, int m)
{
    int g = gcd(a, m);

        return power(a, m-2, m);

}
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;

    return (y%2 == 0)? p : (x * p) % m;
}
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b%a, a);
}
signed main()
{
    // freopen ("SampleInput1.txt","r",stdin);
    // freopen ("SampleOutput1.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int i,ans=0,mod=1000000007;
    int bef[s.length()+2]={0},fact[200005]={0};
    fact[0]=1;
    for(i=1;i<=200000;i++)
    	fact[i]=((i%mod)*(fact[i-1])%mod);
    for(i=0;i<s.length();i++)
    {
    	if(s[i]=='(')
    		bef[i]=1;
    }
    for(i=1;i<s.length();i++)
    bef[i]+=bef[i-1];
	for(i=0;i<s.length();i++)
	{
		if(s[i]=='(')
		{
			int x=bef[i];
			int y=s.length()-i-1-(bef[s.length()-1]-bef[i]);
			int z=x+y-1;
			// cout<<x<<" "<<y<<" "<<z<<"\n";
			ans=(ans%mod+(fact[z]%mod*modInverse((fact[x]%mod*fact[z-x]%mod)%mod,mod)%mod)%mod)%mod;
		}
	}
	cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int a, int b);
int power(int x, unsigned int y, unsigned int m);
signed modInverse(int a, int m)
{
    int g = gcd(a, m);

        return power(a, m-2, m);

}
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;

    return (y%2 == 0)? p : (x * p) % m;
}
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b%a, a);
}
signed main()
{
    // freopen ("SampleInput1.txt","r",stdin);
    // freopen ("SampleOutput1.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int i,ans=0,mod=1000000007;
    int bef[s.length()+2]={0},fact[200005]={0};
    fact[0]=1;
    for(i=1;i<=200000;i++)
    	fact[i]=((i%mod)*(fact[i-1])%mod);
    for(i=0;i<s.length();i++)
    {
    	if(s[i]=='(')
    		bef[i]=1;
    }
    for(i=1;i<s.length();i++)
    bef[i]+=bef[i-1];
	for(i=0;i<s.length();i++)
	{
		if(s[i]=='(')
		{
			int x=bef[i];
			int y=s.length()-i-1-(bef[s.length()-1]-bef[i]);
			int z=x+y-1;
			// cout<<x<<" "<<y<<" "<<z<<"\n";
			if(y>0)
			ans=(ans%mod+(fact[z]%mod*modInverse((fact[x]%mod*fact[z-x]%mod)%mod,mod)%mod)%mod)%mod;
		}
	}
	cout<<ans<<"\n";
}


/*
    algo:
    idea:

*/
#include <bits/stdc++.h>

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

//------------ loop macros

#define for0(i, n) for(int i=0; i<n; i++)
#define for1(i, n) for(int i=1; i<=n; i++)
#define fr(i,start, till) for(int i=start; i<=till; i++)
#define frr(i,start, till) for(int i=start; i>=till; i--)

//-------------- input macros

#define cin0(n, ara) for(int i=0; i<n; i++) {cin>>ara[i];}
#define cini0(i, n, ara) for(int i=0; i<n; i++) {cin>>ara[i];}

#define cin1(n, ara) for(int i=1; i<=n; i++) {cin>>ar[i];}
#define cini1(i, n, ara) for(int i=1; i<=n; i++) {cin>>ar[i];}

#define si(n) scanf("%d", &n);
#define sii(n, m) scanf("%d %d", &n, &m);
#define siii(n, m, k) scanf("%d %d %d", &n, &m, &k);
#define siiii(n, m, k, o) scanf("%d %d %d %d", &n, &m, &k, &o);

#define sl(n) scanf("%lld", &n);
#define sll(n, m) scanf("%lld %lld", &n, &m);
#define slll(n, m, k) scanf("%lld %lld %lld", &n, &m, &k);
#define sllll(n, m, k, o) scanf("%lld %lld %lld %lld", &n, &m, &k, &o);

#define sd(n) scanf("%lf", &n);
#define sdd(n, m) scanf("%lf %lf", &n, &m);
#define sddd(n, m, k) scanf("%lf %lf %lf", &n, &m, &k);
#define sdddd(n, m, k, o) scanf("%lf %lf %lf %lf", &n, &m, &k, &o);

#define sid(n, m) scanf("%d %lf", &n, &m);

#define scs(s) scanf("\n%s", s);
#define scss(s, ss) scanf("\n%s \n%s", s, ss);

//--------------output----------

#define pr printf
#define pri(n) printf("%d\n", n);
#define prii(n, m) printf("%d %d\n", n, m);
#define prl(n) printf("%lld\n", n);
#define prll(n, m) printf("%lld %lld\n", n, m);
#define prd(n) printf("%.10lf\n", n);
#define prs(str) printf("%s\n", str);

// ------------- BIT MANIPULATION ------------

#define CHECK(n, pos) ( (n& (1LL<<pos))>0)
#define SET(n,pos) (n | (1<<pos))
#define RESET(n,pos) (n ^ (1<<pos))
#define mem(ara, val) memset(ara, val, sizeof ara);

//--------data structures
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define pdi pair<double, int>
#define pdl pair<double, ll>
#define pid pair<int, double>
#define pld pair<ll, double>

//--------others
#define SET_TIMER double timer =(double) clock();
#define PRINT_TIMER cout<<(clock()- timer)/CLOCKS_PER_SEC<<endl;
#define PRINT_LOJ_TC printf("Case %d: ", tc);
#define pb push_back
#define mp make_pair
#define log2ceil(n) ( (ll) ceil(log2(n)))
#define pow2(n) (1<<n)
#define FAST_READ ios_base::sync_with_stdio(0); cin.tie(0);
#define FRE_IN_OUT FRE_IN FRE_OUT
#define FRE_IN freopen("in.txt", "r", stdin);
#define FRE_OUT freopen("out.txt", "w", stdout);

#define MX 2001000
#define double long double
#define mod 1000000007
#define mod2 1000000009

// ll ara[20];
// ll ncr[1000115] [20];
ll fact[MX];

int l[MX], r[MX];
char str[MX];

ll big_mod(ll n, ll pw) {

  if(pw==0)
    return 1;

  ll ret = big_mod(n, pw/2);

  ret*=ret;
  if(ret>=mod)
    ret%=mod;

  if(pw&1)
    ret*=n;

    if(ret>=mod)
      ret%=mod;

    return ret;

}

ll NCR(int n, int r) {

    // cout<<"called n "<<n<<" r "<<r<<endl;
  if(n<r)
    return 0;
  if(n==r)
    return 1;
  if(r==1)
    return n;
  if(r==0)
    return 1;

  ll ret = fact[n];

  ret = ret * big_mod((fact[r]*fact[n-r])%mod, mod-2);

  // cout<<"n "<<n<<" r "<<r<<" fact[n] "<<fact[n]<<" ret "<<ret<<endl;
  if(ret>=mod)
    ret%=mod;

  return ret;

}

int main()
{
  // FRE_IN_OUT

    fact[0]=1;

    for1(i, MX-1)
    {
      fact[i] = fact[i-1] *i;
      if(fact[i]>=mod)
        fact[i]%=mod;
      // cout<<"i "<<fact[i]<<endl;
    }

    int t=1;

    // si(t)

    int k, n;

    for1(tc, t) {
    // cout<<"aise"<<endl;

      scs(str+1)

      int len = strlen(str+1);

      // cout<<"len "<<len<<endl;

      for1(i, len)
      {
        // if(str[i]=='(')
        l[i] = l[i-1] + (str[i] == '(');
      }

      frr(i, len, 1)
      {
        // if(str[i]==')') {
          r[i] = r[i+1] + (str[i] == ')');

        // }
      }

      ll ans=0;

      for1(i, len) {
        if(str[i]=='(') {
          // cout<<"i "<<i<<" li "<<l[i]<<" ri "<<r[i]<<endl;
          ans+= NCR(l[i]+r[i], min(l[i], r[i]));
          ans= ans- NCR(l[i-1]+r[i], min(l[i-1],r[i]));

          if(ans>=mod || ans<0)
            ans= (ans+mod)%mod;
        }

      }

      // PRINT_LOJ_TC
      prl(ans)

        // pr("finished");

    }
    return 0;
}


/*
    algo:
    idea:

*/
#include <bits/stdc++.h>

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

//------------ loop macros

#define for0(i, n) for(int i=0; i<n; i++)
#define for1(i, n) for(int i=1; i<=n; i++)
#define fr(i,start, till) for(int i=start; i<=till; i++)
#define frr(i,start, till) for(int i=start; i>=till; i--)

//-------------- input macros

#define cin0(n, ara) for(int i=0; i<n; i++) {cin>>ara[i];}
#define cini0(i, n, ara) for(int i=0; i<n; i++) {cin>>ara[i];}

#define cin1(n, ara) for(int i=1; i<=n; i++) {cin>>ar[i];}
#define cini1(i, n, ara) for(int i=1; i<=n; i++) {cin>>ar[i];}

#define si(n) scanf("%d", &n);
#define sii(n, m) scanf("%d %d", &n, &m);
#define siii(n, m, k) scanf("%d %d %d", &n, &m, &k);
#define siiii(n, m, k, o) scanf("%d %d %d %d", &n, &m, &k, &o);

#define sl(n) scanf("%lld", &n);
#define sll(n, m) scanf("%lld %lld", &n, &m);
#define slll(n, m, k) scanf("%lld %lld %lld", &n, &m, &k);
#define sllll(n, m, k, o) scanf("%lld %lld %lld %lld", &n, &m, &k, &o);

#define sd(n) scanf("%lf", &n);
#define sdd(n, m) scanf("%lf %lf", &n, &m);
#define sddd(n, m, k) scanf("%lf %lf %lf", &n, &m, &k);
#define sdddd(n, m, k, o) scanf("%lf %lf %lf %lf", &n, &m, &k, &o);

#define sid(n, m) scanf("%d %lf", &n, &m);

#define scs(s) scanf("\n%s", s);
#define scss(s, ss) scanf("\n%s \n%s", s, ss);

//--------------output----------

#define pr printf
#define pri(n) printf("%d\n", n);
#define prii(n, m) printf("%d %d\n", n, m);
#define prl(n) printf("%lld\n", n);
#define prll(n, m) printf("%lld %lld\n", n, m);
#define prd(n) printf("%.10lf\n", n);
#define prs(str) printf("%s\n", str);

// ------------- BIT MANIPULATION ------------

#define CHECK(n, pos) ( (n& (1LL<<pos))>0)
#define SET(n,pos) (n | (1<<pos))
#define RESET(n,pos) (n ^ (1<<pos))
#define mem(ara, val) memset(ara, val, sizeof ara);

//--------data structures
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define pdi pair<double, int>
#define pdl pair<double, ll>
#define pid pair<int, double>
#define pld pair<ll, double>

//--------others
#define SET_TIMER double timer =(double) clock();
#define PRINT_TIMER cout<<(clock()- timer)/CLOCKS_PER_SEC<<endl;
#define PRINT_LOJ_TC printf("Case %d: ", tc);
#define pb push_back
#define mp make_pair
#define log2ceil(n) ( (ll) ceil(log2(n)))
#define pow2(n) (1<<n)
#define FAST_READ ios_base::sync_with_stdio(0); cin.tie(0);
#define FRE_IN_OUT FRE_IN FRE_OUT
#define FRE_IN freopen("in.txt", "r", stdin);
#define FRE_OUT freopen("out.txt", "w", stdout);

#define MX 2001000
#define double long double
#define mod 100000007
#define mod2 1000000009

// ll ara[20];
// ll ncr[1000115] [20];
ll fact[MX];

int l[MX], r[MX];
char str[MX];

ll big_mod(ll n, ll pw) {

  if(pw==0)
    return 1;

  ll ret = big_mod(n, pw/2);

  ret*=ret;
  if(ret>=mod)
    ret%=mod;

  if(pw&1)
    ret*=n;

    if(ret>=mod)
      ret%=mod;

    return ret;

}

ll NCR(int n, int r) {

    // cout<<"called n "<<n<<" r "<<r<<endl;
  if(n<r)
    return 0;
  if(n==r)
    return 1;
  if(r==1)
    return n;
  if(r==0)
    return 1;

  ll ret = fact[n];

  ret = ret * big_mod((fact[r]*fact[n-r])%mod, mod-2);

  // cout<<"n "<<n<<" r "<<r<<" fact[n] "<<fact[n]<<" ret "<<ret<<endl;
  if(ret>=mod)
    ret%=mod;

  return ret;

}

int main()
{
  // FRE_IN_OUT

    fact[0]=1;

    for1(i, MX-1)
    {
      fact[i] = fact[i-1] *i;
      if(fact[i]>=mod)
        fact[i]%=mod;
      // cout<<"i "<<fact[i]<<endl;
    }

    int t=1;

    // si(t)

    int k, n;

    for1(tc, t) {
    // cout<<"aise"<<endl;

      scs(str+1)

      int len = strlen(str+1);

      // cout<<"len "<<len<<endl;

      for1(i, len)
      {
        // if(str[i]=='(')
        l[i] = l[i-1] + (str[i] == '(');
      }

      frr(i, len, 1)
      {
        // if(str[i]==')') {
          r[i] = r[i+1] + (str[i] == ')');

        // }
      }

      ll ans=0;

      for1(i, len) {
        if(str[i]=='(') {
          // cout<<"i "<<i<<" li "<<l[i]<<" ri "<<r[i]<<endl;
          ans+= NCR(l[i]+r[i], min(l[i], r[i]));
          ans= ans- NCR(l[i-1]+r[i], min(l[i-1],r[i]));

          if(ans>=mod || ans<0)
            ans= (ans+mod)%mod;
        }

      }

      // PRINT_LOJ_TC
      prl(ans)

        // pr("finished");

    }
    return 0;
}


/*
    algo:
    idea:

*/
#include <bits/stdc++.h>

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

//------------ loop macros

#define for0(i, n) for(int i=0; i<n; i++)
#define for1(i, n) for(int i=1; i<=n; i++)
#define fr(i,start, till) for(int i=start; i<=till; i++)
#define frr(i,start, till) for(int i=start; i>=till; i--)

//-------------- input macros

#define cin0(n, ara) for(int i=0; i<n; i++) {cin>>ara[i];}
#define cini0(i, n, ara) for(int i=0; i<n; i++) {cin>>ara[i];}

#define cin1(n, ara) for(int i=1; i<=n; i++) {cin>>ar[i];}
#define cini1(i, n, ara) for(int i=1; i<=n; i++) {cin>>ar[i];}

#define si(n) scanf("%d", &n);
#define sii(n, m) scanf("%d %d", &n, &m);
#define siii(n, m, k) scanf("%d %d %d", &n, &m, &k);
#define siiii(n, m, k, o) scanf("%d %d %d %d", &n, &m, &k, &o);

#define sl(n) scanf("%lld", &n);
#define sll(n, m) scanf("%lld %lld", &n, &m);
#define slll(n, m, k) scanf("%lld %lld %lld", &n, &m, &k);
#define sllll(n, m, k, o) scanf("%lld %lld %lld %lld", &n, &m, &k, &o);

#define sd(n) scanf("%lf", &n);
#define sdd(n, m) scanf("%lf %lf", &n, &m);
#define sddd(n, m, k) scanf("%lf %lf %lf", &n, &m, &k);
#define sdddd(n, m, k, o) scanf("%lf %lf %lf %lf", &n, &m, &k, &o);

#define sid(n, m) scanf("%d %lf", &n, &m);

#define scs(s) scanf("\n%s", s);
#define scss(s, ss) scanf("\n%s \n%s", s, ss);

//--------------output----------

#define pr printf
#define pri(n) printf("%d\n", n);
#define prii(n, m) printf("%d %d\n", n, m);
#define prl(n) printf("%lld\n", n);
#define prll(n, m) printf("%lld %lld\n", n, m);
#define prd(n) printf("%.10lf\n", n);
#define prs(str) printf("%s\n", str);

// ------------- BIT MANIPULATION ------------

#define CHECK(n, pos) ( (n& (1LL<<pos))>0)
#define SET(n,pos) (n | (1<<pos))
#define RESET(n,pos) (n ^ (1<<pos))
#define mem(ara, val) memset(ara, val, sizeof ara);

//--------data structures
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define pdi pair<double, int>
#define pdl pair<double, ll>
#define pid pair<int, double>
#define pld pair<ll, double>

//--------others
#define SET_TIMER double timer =(double) clock();
#define PRINT_TIMER cout<<(clock()- timer)/CLOCKS_PER_SEC<<endl;
#define PRINT_LOJ_TC printf("Case %d: ", tc);
#define pb push_back
#define mp make_pair
#define log2ceil(n) ( (ll) ceil(log2(n)))
#define pow2(n) (1<<n)
#define FAST_READ ios_base::sync_with_stdio(0); cin.tie(0);
#define FRE_IN_OUT FRE_IN FRE_OUT
#define FRE_IN freopen("in.txt", "r", stdin);
#define FRE_OUT freopen("out.txt", "w", stdout);

#define MX 2001000
#define double long double
#define mod 100000007
#define mod2 1000000009

// ll ara[20];
// ll ncr[1000115] [20];
ll fact[MX];

int l[MX], r[MX];
char str[MX];

ll big_mod(ll n, ll pw) {

  if(pw==0)
    return 1;

  ll ret = big_mod(n, pw/2);

  ret*=ret;
  if(ret>=mod)
    ret%=mod;

  if(pw&1)
    ret*=n;

    if(ret>=mod)
      ret%=mod;

    return ret;

}

ll NCR(int n, int r) {

    // cout<<"called n "<<n<<" r "<<r<<endl;
  if(n<r)
    return 0;
  if(n==r)
    return 1;
  if(r==1)
    return n;
  if(r==0)
    return 1;

  ll ret = fact[n];

  ret = ret * big_mod((fact[r]*fact[n-r])%mod, mod-2);

  // cout<<"n "<<n<<" r "<<r<<" fact[n] "<<fact[n]<<" ret "<<ret<<endl;
  if(ret>=mod)
    ret%=mod;

  return ret;

}

int main()
{
  // FRE_IN_OUT

    fact[0]=1;

    for1(i, MX-1)
    {
      fact[i] = fact[i-1] *i;
      if(fact[i]>=mod)
        fact[i]%=mod;
      // cout<<"i "<<fact[i]<<endl;
    }

    int t=1;

    // si(t)

    int k, n;

    for1(tc, t) {
    // cout<<"aise"<<endl;

      scs(str+1)

      int len = strlen(str+1);

      // cout<<"len "<<len<<endl;

      for1(i, len)
      {
        // if(str[i]=='(')
        l[i] = l[i-1] + (str[i] == '(');
      }

      frr(i, len, 1)
      {
        // if(str[i]==')') {
          r[i] = r[i+1] + (str[i] == ')');

        // }
      }

      ll ans=0;

      for1(i, len) {
        if(str[i]=='(') {
          // cout<<"i "<<i<<" li "<<l[i]<<" ri "<<r[i]<<endl;
          ans+= NCR(l[i]+r[i], min(l[i], r[i]));
          ans= ans- NCR(l[i-1]+r[i], min(l[i-1],r[i]));
        }

      }

      // PRINT_LOJ_TC
      prl(ans)

        // pr("finished");

    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
const int N = 1000001;
using namespace std;

// array to store inverse of 1 to N
ll factorialNumInverse[N + 1];

// array to precompute inverse of 1! to N!
ll naturalNumInverse[N + 1];

// array to store factorial of first N numbers
ll fact[N + 1];

// Function to precompute inverse of numbers
void InverseofNumber(ll p)
{
	naturalNumInverse[0] = naturalNumInverse[1] = 1;
	for (int i = 2; i <= N; i++)
		naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
// Function to precompute inverse of factorials
void InverseofFactorial(ll p)
{
	factorialNumInverse[0] = factorialNumInverse[1] = 1;

	// precompute inverse of natural numbers
	for (int i = 2; i <= N; i++)
		factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}

// Function to calculate factorial of 1 to N
void factorial(ll p)
{
	fact[0] = 1;

	// precompute factorials
	for (int i = 1; i <= N; i++) {
		fact[i] = (fact[i - 1] * i) % p;
	}
}

// Function to return nCr % p in O(1) time
ll Binomial(ll N, ll R, ll p)
{
	// n C r = n!*inverse(r!)*inverse((n-r)!)
	ll ans = ((fact[N] * factorialNumInverse[R])
			% p * factorialNumInverse[N - R])
			% p;
	return ans;
}

int main(){
	string n;
	cin>>n;
	ll a[n.length()],b[n.length()];

	if (n[0]=='(')
	{
		a[0] = 1;
	}else{
		a[0] = 0;
	}

	if (n[n.length()-1]==')')
	{
		b[n.length()-1] = 1;
	}else{
		b[n.length()-1] = 0;
	}
	for (ll i = 1; i < n.length(); ++i)
	{
		if (n[i]=='(')
		{
			a[i] = a[i-1] +1;
		}else{
			a[i] = a[i-1];
		}

		if (n[n.length()-1-i]==')')
		{
			b[n.length()-1-i] = b[n.length()-i] + 1;
		}else{
			b[n.length()-1-i] = b[n.length()-i];
		}
	}

	// for (int i = 0; i < n.length(); ++i)
	// {
	// 	cout<<a[i]<<" ";
	// }
	// cout<<endl;
	// for (int i = 0; i < n.length(); ++i)
	// {
	// 	cout<<b[i]<<" ";
	// }
	// cout<<endl;
	InverseofNumber(MOD);
    InverseofFactorial(MOD);
    factorial(MOD);

	ll ans=0;
	for (ll i = 0; i < n.length(); ++i)
	{
		ll temp = min(a[i],b[i]);
		// cout<<"temp"<<temp<<endl;
		if (n[i]=='(')
		{
			for (ll j = 1; j <= temp; j++)
			{
				// ans += Binomial(temp,j,MOD)%MOD;
				// cout<<"Binomial"<<Binomial(temp,j,MOD)<<endl;
				ll temp1,temp2;

				temp1 = Binomial(a[i]-1,j-1,MOD);
				//cout<<"temp1"<<temp1<<endl;
				temp1 = temp1==0?1:temp1;
				temp2 = Binomial(b[i],j,MOD);
				//cout<<"temp2"<<temp2<<endl;
				ans += (temp1*temp2)%MOD;

			}
		}

	}

	ans %= MOD;
	cout<<ans<<endl;

	//cout<<Binomial(0,1,MOD)<<endl;
}


#include<bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
const int N = 1000001;
using namespace std;

// array to store inverse of 1 to N
ll factorialNumInverse[N + 1];

// array to precompute inverse of 1! to N!
ll naturalNumInverse[N + 1];

// array to store factorial of first N numbers
ll fact[N + 1];

// Function to precompute inverse of numbers
void InverseofNumber(ll p)
{
	naturalNumInverse[0] = naturalNumInverse[1] = 1;
	for (int i = 2; i <= N; i++)
		naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
// Function to precompute inverse of factorials
void InverseofFactorial(ll p)
{
	factorialNumInverse[0] = factorialNumInverse[1] = 1;

	// precompute inverse of natural numbers
	for (int i = 2; i <= N; i++)
		factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}

// Function to calculate factorial of 1 to N
void factorial(ll p)
{
	fact[0] = 1;

	// precompute factorials
	for (int i = 1; i <= N; i++) {
		fact[i] = (fact[i - 1] * i) % p;
	}
}

// Function to return nCr % p in O(1) time
ll Binomial(ll N, ll R, ll p)
{
	// n C r = n!*inverse(r!)*inverse((n-r)!)
	ll ans = ((fact[N] * factorialNumInverse[R])
			% p * factorialNumInverse[N - R])
			% p;
	return ans;
}

int main(){
	string n;
	cin>>n;
	ll a[n.length()],b[n.length()];

	if (n[0]=='(')
	{
		a[0] = 1;
	}else{
		a[0] = 0;
	}

	if (n[n.length()-1]==')')
	{
		b[n.length()-1] = 1;
	}else{
		b[n.length()-1] = 0;
	}
	for (ll i = 1; i < n.length(); ++i)
	{
		if (n[i]=='(')
		{
			a[i] = a[i-1] +1;
		}else{
			a[i] = a[i-1];
		}

		if (n[n.length()-1-i]==')')
		{
			b[n.length()-1-i] = b[n.length()-i] + 1;
		}else{
			b[n.length()-1-i] = b[n.length()-i];
		}
	}

	// for (int i = 0; i < n.length(); ++i)
	// {
	// 	cout<<a[i]<<" ";
	// }
	// cout<<endl;
	// for (int i = 0; i < n.length(); ++i)
	// {
	// 	cout<<b[i]<<" ";
	// }
	// cout<<endl;
	InverseofNumber(MOD);
    InverseofFactorial(MOD);
    factorial(MOD);

	ll ans=0;
	for (ll i = 0; i < n.length(); ++i)
	{
		ll temp = min(a[i],b[i]);
		// cout<<"temp"<<temp<<endl;
		for (ll j = 1; j <= temp; j++)
		{
			// ans += Binomial(temp,j,MOD)%MOD;
			// cout<<"Binomial"<<Binomial(temp,j,MOD)<<endl;
			ll temp1,temp2;
			if (n[i]=='(')
			{
				temp1 = Binomial(a[i]-1,j-1,MOD);
				//cout<<"temp1"<<temp1<<endl;
				temp1 = temp1==0?1:temp1;
				temp2 = Binomial(b[i],j,MOD);
				//cout<<"temp2"<<temp2<<endl;
				ans += (temp1*temp2)%MOD;
			}
		}
	}

	ans %= MOD;
	cout<<ans<<endl;

	//cout<<Binomial(0,1,MOD)<<endl;
}


#include<bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
const int N = 1000001;
using namespace std;

// array to store inverse of 1 to N
ll factorialNumInverse[N + 1];

// array to precompute inverse of 1! to N!
ll naturalNumInverse[N + 1];

// array to store factorial of first N numbers
ll fact[N + 1];

// Function to precompute inverse of numbers
void InverseofNumber(ll p)
{
	naturalNumInverse[0] = naturalNumInverse[1] = 1;
	for (int i = 2; i <= N; i++)
		naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
// Function to precompute inverse of factorials
void InverseofFactorial(ll p)
{
	factorialNumInverse[0] = factorialNumInverse[1] = 1;

	// precompute inverse of natural numbers
	for (int i = 2; i <= N; i++)
		factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}

// Function to calculate factorial of 1 to N
void factorial(ll p)
{
	fact[0] = 1;

	// precompute factorials
	for (int i = 1; i <= N; i++) {
		fact[i] = (fact[i - 1] * i) % p;
	}
}

// Function to return nCr % p in O(1) time
ll Binomial(ll N, ll R, ll p)
{
	// n C r = n!*inverse(r!)*inverse((n-r)!)
	ll ans = ((fact[N] * factorialNumInverse[R])
			% p * factorialNumInverse[N - R])
			% p;
	return ans;
}

int main(){
	string n;
	cin>>n;
	ll a[n.length()],b[n.length()];

	if (n[0]=='(')
	{
		a[0] = 1;
	}else{
		a[0] = 0;
	}

	if (n[n.length()-1]==')')
	{
		b[n.length()-1] = 1;
	}else{
		b[n.length()-1] = 0;
	}
	for (ll i = 1; i < n.length(); ++i)
	{
		if (n[i]=='(')
		{
			a[i] = a[i-1] +1;
		}else{
			a[i] = a[i-1];
		}

		if (n[n.length()-1-i]==')')
		{
			b[n.length()-1-i] = b[n.length()-i] + 1;
		}else{
			b[n.length()-1-i] = b[n.length()-i];
		}
	}

	// for (int i = 0; i < n.length(); ++i)
	// {
	// 	cout<<a[i]<<" ";
	// }
	// cout<<endl;
	// for (int i = 0; i < n.length(); ++i)
	// {
	// 	cout<<b[i]<<" ";
	// }
	// cout<<endl;
	InverseofNumber(MOD);
    InverseofFactorial(MOD);
    factorial(MOD);

	ll ans=0;
	for (ll i = 0; i < n.length(); ++i)
	{
		//ll temp = min(a[i],b[i]);
		// cout<<"temp"<<temp<<endl;
		if (n[i]=='(')
		{
			// for (ll j = 1; j <= temp; j++)
			// {
			// 	// ans += Binomial(temp,j,MOD)%MOD;
			// 	// cout<<"Binomial"<<Binomial(temp,j,MOD)<<endl;
			// 	ll temp1,temp2;

			// 	temp1 = Binomial(a[i]-1,j-1,MOD);
			// 	//cout<<"temp1"<<temp1<<endl;
			// 	temp1 = temp1==0?1:temp1;
			// 	temp2 = Binomial(b[i],j,MOD);
			// 	//cout<<"temp2"<<temp2<<endl;
			// 	ans += (temp1*temp2)%MOD;

			// }
			ans += Binomial(a[i]-1+b[i],a[i],MOD)%MOD;
		}

	}

	ans %= MOD;
	cout<<ans<<endl;

	//cout<<Binomial(0,1,MOD)<<endl;
}


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

ll comb(ll n, ll k)
{
  if(n < k)
    return 0;

  if(n == k || k == 0)
    return 1;

  return (comb(n-1, k-1) + comb(n-1, k))%M;
}

int main() {

  string s;
  cin >> s;

  //precomb();

  ll arr[2][s.length()];
  ll x=0,y=0,i=0;

  while(i<s.length())
  {
    if(s[i] == '(')
      x ++;
    arr[0][i] = x;

    i++;
  }
  i--;
  while(i>=0)
  {
    if(s[i] == ')')
      y++;
    arr[1][i] = y;
    i--;
  }

  i = s.length()-1;
  ll ans = 0;

  while(i>=0)
  {
    if(arr[1][i] != 0)
    {
      if(s[i] == '(')
      {
        x = arr[0][i] + arr[1][i] - 1;
        y = arr[0][i];
        x = comb(x, y);
        ans = (ans + x)%M;
      }
    }
    i--;
  }

  cout<< ans;

  return 0;

}


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

ll fact[1000000]={1};

void factorial()
{
  for(ll i=1; i<1000000; i++)
    fact[i] = (i*fact[i-1])%M;
}

ll extended_euclidean(ll a,ll m, ll &x, ll &y)
{
  if (m == 0)
  {
    x = 1;
    y = 0;
    return a;
  }
  ll x1, y1;
  ll d = extended_euclidean(m, a%m, x1, y1);
  x = y1;
  y = x1 - (a/m)*y1;
  return d;
}

ll mulmod(ll a)
{
  ll x, y;
  ll g = extended_euclidean(a,M, x, y);

  x = (x % M + M) % M;
  return x;
}

ll comb(ll n, ll k)
{
  ll ans = (fact[n] * mulmod(fact[k]) * mulmod(fact[n-k]) + M)%M;
  return ans;
}

int main() {

  string s;
  cin >> s;

  factorial();

  ll arr[2][s.length()];
  ll x=0,y=0,i=0;

  while(i<s.length())
  {
    if(s[i] == '(')
      x ++;
    arr[0][i] = x;

    i++;
  }
  i--;
  while(i>=0)
  {
    if(s[i] == ')')
      y++;
    arr[1][i] = y;
    i--;
  }

  i = s.length()-1;
  ll ans = 0;

  while(i>=0)
  {
    if(arr[1][i] != 0)
    {
      if(s[i] == '(')
      {
        x = arr[0][i] + arr[1][i] - 1;
        y = arr[0][i];
        x = comb(x, y);
        ans = (ans + x)%M;
      }
    }
    i--;
  }

  cout<< ans;

  return 0;

}


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

ll fact[1000000]={1};

void factorial()
{
  for(ll i=1; i<1000000; i++)
    fact[i] = (i*fact[i-1])%M;
}

ll extended_euclidean(ll a,ll m, ll &x, ll &y)
{
  if (m == 0)
  {
    x = 1;
    y = 0;
    return a;
  }
  ll x1, y1;
  ll d = extended_euclidean(m, a%m, x1, y1);
  x = y1;
  y = x1 - (a/m)*y1;
  return d;
}

ll mulmod(ll a)
{
  ll x, y;
  ll g = extended_euclidean(a,M, x, y);

  x = (x % M + M) % M;
  return x;
}

ll comb(ll n, ll k)
{
  ll ans = (fact[n] * ((int64_t)mulmod(fact[k]) *(int64_t)mulmod(fact[n-k]))%M)%M;
  return ans;
}

int main() {

  string s;
  cin >> s;

  factorial();

  ll arr[2][s.length()];
  ll x=0,y=0,i=0;

  while(i<s.length())
  {
    if(s[i] == '(')
      x ++;
    arr[0][i] = x;

    i++;
  }
  i--;
  while(i>=0)
  {
    if(s[i] == ')')
      y++;
    arr[1][i] = y;
    i--;
  }

  i = s.length()-1;
  ll ans = 0;

  while(i>=0)
  {
    if(arr[1][i] != 0)
    {
      if(s[i] == '(')
      {
        x = arr[0][i] + arr[1][i] - 1;
        y = arr[0][i];
        x = comb(x, y);
        ans = (ans + x)%M;
      }
    }
    i--;
  }

  cout<< ans;

  return 0;

}


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

ll fact[1000000]={1};

void factorial()
{
  for(ll i=1; i<1000000; i++)
    fact[i] = (i*fact[i-1])%M;
}

ll extended_euclidean(ll a,ll m, ll &x, ll &y)
{
  if (m == 0)
  {
    x = 1;
    y = 0;
    return a;
  }
  ll x1, y1;
  ll d = extended_euclidean(m, a%m, x1, y1);
  x = y1;
  y = x1 - (a/m)*y1;
  return d;
}

ll mulmod(ll a)
{
  ll x, y;
  ll g = extended_euclidean(a, M, x, y);
  x = (x % M + M) % M;
  return x;
}

ll comb(ll n, ll k)
{
  ll mul = (fact[k] * fact[n-k])%M;
  ll ans = ((fact[n] * mulmod(mul))%M + M)%M;
  return ans;
}

int main() {

  string s;
  cin >> s;

  factorial();

  ll arr[2][s.length()];
  ll x=0,y=0,i=0;

  while(i<s.length())
  {
    if(s[i] == '(')
      x ++;
    arr[0][i] = x;

    i++;
  }
  i--;
  while(i>=0)
  {
    if(s[i] == ')')
      y++;
    arr[1][i] = y;
    i--;
  }

  i = s.length()-1;
  ll ans = 0;

  while(i>=0)
  {
    if(arr[1][i] != 0)
    {
      if(s[i] == '(')
      {
        x = arr[0][i] + arr[1][i] - 1;
        y = arr[0][i];
        x = comb(x, y);
        ans = (ans + x)%M;
      }
    }
    i--;
  }

  cout<< ans;

  return 0;

}


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

ll fact[1000000]={1};

void factorial()
{
  for(ll i=1; i<1000000; i++)
    fact[i] = (i*fact[i-1])%M;
}

ll extended_euclidean(ll a,ll m, ll &x, ll &y)
{
  if (m == 0)
  {
    x = 1;
    y = 0;
    return a;
  }
  ll x1, y1;
  ll d = extended_euclidean(m, a%m, x1, y1);
  x = y1;
  y = x1 - (a/m)*y1;
  return d;
}

ll mulmod(ll a)
{
  ll x, y;
  ll g = extended_euclidean(a,M, x, y);

  x = (x % M + M) % M;
  return x;
}

ll comb(ll n, ll k)
{
  ll ans = (fact[n] * (mulmod(fact[k]) * mulmod(fact[n-k]))%M)%M;
  return ans;
}

int main() {

  string s;
  cin >> s;

  factorial();

  ll arr[2][s.length()];
  ll x=0,y=0,i=0;

  while(i<s.length())
  {
    if(s[i] == '(')
      x ++;
    arr[0][i] = x;

    i++;
  }
  i--;
  while(i>=0)
  {
    if(s[i] == ')')
      y++;
    arr[1][i] = y;
    i--;
  }

  i = s.length()-1;
  ll ans = 0;

  while(i>=0)
  {
    if(arr[1][i] != 0)
    {
      if(s[i] == '(')
      {
        x = arr[0][i] + arr[1][i] - 1;
        y = arr[0][i];
        x = comb(x, y);
        ans = (ans + x)%M;
      }
    }
    i--;
  }

  cout<< ans;

  return 0;

}


#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;
#define ll long long
ll p = 1e9 + 7;

void print(vector<ll> &a)
{
    for (int i = 0; i<a.size(); i++) cout<<a[i]<<' ';
    cout<<endl;
}

ll fill(ll n)
{
    ll i = max((ll)(sqrt(n))-10, (ll)(0));
    while (i*(i+1)/2<n) i++;
    return i;
}

ll po(ll a, ll d)
{
    if (d==0) return 1;
    if (d%2==1) return (po(a, d-1)*a)%p;
    ll temp = po(a, d/2);
    return (temp*temp)%p;
}

ll inv(ll n)
{
    return po(n, p-2);
}

vector<ll> fac(300050);

vector<ll> invfac(300050);

void init()
{
    fac[0] = 1;
    for (int i = 1; i<300050; i++) fac[i] = (fac[i-1]*i)%p;
    for (int i = 0; i<300050; i++) invfac[i] = inv(fac[i]);
    }

ll C(int n, int k)
{
    if (n<k) return 0;
    ll res = fac[n];
    res = (res*invfac[k])%p;
    res = (res*invfac[n-k])%p;
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    init();
    string s;
    cin>>s;
    int n = s.length();
    vector<ll> pref_open(n+1);
    pref_open[0] = 0;
    for (int i = 1; i<=n; i++) pref_open[i] = pref_open[i-1] + (s[i-1]=='(');

    vector<ll> suf_cl(n+1);
    suf_cl[n] = 0;
    for (int i = n-1; i>=0; i--) suf_cl[i] = suf_cl[i+1] + (s[i]==')');

    //print(pref_open);
    //print(suf_cl);

    ll res = 0;
    for (int i = 1; i<=n; i++) if (s[i-1]=='(') res= (res+C(pref_open[i]-1 + suf_cl[i], pref_open[i]))%p;
    if (res<0) res+=p;
    cout<<res;

}


#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;
#define ll long long
ll p = 998244353;

void print(vector<ll> &a)
{
    for (int i = 0; i<a.size(); i++) cout<<a[i]<<' ';
    cout<<endl;
}

ll fill(ll n)
{
    ll i = max((ll)(sqrt(n))-10, (ll)(0));
    while (i*(i+1)/2<n) i++;
    return i;
}

ll po(ll a, ll d)
{
    if (d==0) return 1;
    if (d%2==1) return (po(a, d-1)*a)%p;
    ll temp = po(a, d/2);
    return (temp*temp)%p;
}

ll inv(ll n)
{
    return po(n, p-2);
}

vector<ll> fac(300050);

vector<ll> invfac(300050);

void init()
{
    fac[0] = 1;
    for (int i = 1; i<300050; i++) fac[i] = (fac[i-1]*i)%p;
    for (int i = 0; i<300050; i++) invfac[i] = inv(fac[i]);
    }

ll C(int n, int k)
{
    if (n<k) return 0;
    ll res = fac[n];
    res = (res*invfac[k])%p;
    res = (res*invfac[n-k])%p;
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    init();
    string s;
    cin>>s;
    int n = s.length();
    vector<ll> pref_open(n+1);
    pref_open[0] = 0;
    for (int i = 1; i<=n; i++) pref_open[i] = pref_open[i-1] + (s[i-1]=='(');

    vector<ll> suf_cl(n+1);
    suf_cl[n] = 0;
    for (int i = n-1; i>=0; i--) suf_cl[i] = suf_cl[i+1] + (s[i]==')');

    //print(pref_open);
    //print(suf_cl);

    ll res = 0;
    for (int i = 1; i<=n; i++) if (s[i-1]=='(') res= (res+C(pref_open[i]-1 + suf_cl[i], pref_open[i]))%p;
    cout<<res;

}


#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>;
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> void re(T& x) { cin >> x; }
template<typename T>
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "/home/wjex/cp/pr.h"
#else
#define trace(...)
#endif

constexpr int MOD = 1000000007;
constexpr int Nx = 1e5+5; // check

// ref : https://codeforces.com/blog/entry/63903
// Verification :CSES

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  constexpr ModInt() : v(0) {}
  constexpr ModInt(unsigned _v, int) : v(_v) {}
  template<class Z> ModInt(const Z& a) : v((a < 0 ? P - -a % P : a) % P) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool)*this; }
  M& operator*=(M r) { v = (uint64_t)v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  friend M operator*(M l, M r) { return M(l) *= r; }
  friend M operator/(M l, M r) { return M(l) /= r; }
  friend M operator+(M l, M r) { return M(l) += r; }
  friend M operator-(M l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend bool operator==(M l, M r) { return l.v == r.v; }
  friend bool operator!=(M l, M r) { return !(l == r); }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  template<class Z> M pow(Z n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
};
using Mint = ModInt<MOD>; //
constexpr int N = 2e5+5; // set accordingly
struct Fact {
  vector<Mint> v;
  Fact(int n) : v(n + 1, 1) {
    for (int i = 1; i <= n; ++i) v[i] = i * v[i - 1];
  }
  Mint operator[](int i) const { return v[i]; }
} fact(N);
struct Finv {
  vector<Mint> v;
  Finv(int n) : v(n + 1, 1 / fact[n]) {
    for (int i = n; i; --i) v[i - 1] = i * v[i];
  }
  Mint operator[](int i) const { return v[i]; }
} finv(N);
struct Minv {
  vector<Mint> v;
  Minv(int n) : v(n) {
    for (int i = 1; i <= n; ++i) v[i - 1] = fact[i - 1] * finv[i];
  }
  Mint operator[](int i) const { return v[i - 1]; }
} minv(N);
Mint ncr(int n, int r) {
  if (r < 0 or r > n) return 0;
  return fact[n] * finv[r] * finv[n - r];
}

Mint powr(Mint a , int b){
	Mint ret = 1 ;
	while(b){
		if(b&1){
			ret= ret*a ;
		}
		a=a*a;
		b>>=1;
	}
	return ret ;
}

void solve(){
	string s ;re(s) ;
	int n = s.length();
	int cl = count(all(s),'(');
	int op = 0 ;
	Mint ans = 0 ;
	rep(i,0,n){
		if(s[i] == '(') ans += ncr(op+cl,cl-1), op++;
		else cl--;
	}
	cout << ans << endl;
}

signed main() {
	unsyncIO();
	int tt =1 ;
	//cin >> tt;
	rep(i,0,tt) solve();

#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>;
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> void re(T& x) { cin >> x; }
template<typename T>
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "/home/wjex/cp/pr.h"
#else
#define trace(...)
#endif

constexpr int MOD = 1000000007;
constexpr int Nx = 1e5+5; // check

// ref : https://codeforces.com/blog/entry/63903
// Verification :CSES

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  constexpr ModInt() : v(0) {}
  constexpr ModInt(unsigned _v, int) : v(_v) {}
  template<class Z> ModInt(const Z& a) : v((a < 0 ? P - -a % P : a) % P) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool)*this; }
  M& operator*=(M r) { v = (uint64_t)v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  friend M operator*(M l, M r) { return M(l) *= r; }
  friend M operator/(M l, M r) { return M(l) /= r; }
  friend M operator+(M l, M r) { return M(l) += r; }
  friend M operator-(M l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend bool operator==(M l, M r) { return l.v == r.v; }
  friend bool operator!=(M l, M r) { return !(l == r); }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  template<class Z> M pow(Z n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
};
using Mint = ModInt<MOD>; //
constexpr int N = 2e5+5; // set accordingly
struct Fact {
  vector<Mint> v;
  Fact(int n) : v(n + 1, 1) {
    for (int i = 1; i <= n; ++i) v[i] = i * v[i - 1];
  }
  Mint operator[](int i) const { return v[i]; }
} fact(N);
struct Finv {
  vector<Mint> v;
  Finv(int n) : v(n + 1, 1 / fact[n]) {
    for (int i = n; i; --i) v[i - 1] = i * v[i];
  }
  Mint operator[](int i) const { return v[i]; }
} finv(N);
struct Minv {
  vector<Mint> v;
  Minv(int n) : v(n) {
    for (int i = 1; i <= n; ++i) v[i - 1] = fact[i - 1] * finv[i];
  }
  Mint operator[](int i) const { return v[i - 1]; }
} minv(N);
Mint ncr(int n, int r) {
  if (r < 0 or r > n) return 0;
  return fact[n] * finv[r] * finv[n - r];
}

Mint powr(Mint a , int b){
	Mint ret = 1 ;
	while(b){
		if(b&1){
			ret= ret*a ;
		}
		a=a*a;
		b>>=1;
	}
	return ret ;
}

void solve(){
	string s ;re(s) ;
	int n = s.length();
	int cl = count(all(s),')');
	int op = 0 ;
	Mint ans = 0 ;
	rep(i,0,n){
		if(s[i] == '(') ans += ncr(op+cl,cl-1), op++;
		else cl--;
	}
	cout << ans << endl;
}

signed main() {
	unsyncIO();
	int tt =1 ;
	//cin >> tt;
	rep(i,0,tt) solve();

#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


///Allah gave me the brain.Allah will help me///
/*
Nahid Hossain
Jahangirnagar University
Roll:54
*/
#include<bits/stdc++.h>
#define ll          long long int
#define db          double
#define pf          printf
#define sf          scanf
#define ff          first
#define ss          second
#define clr         clear()
#define sz          size()
#define pb          push_back
#define mk          make_pair
#define pi          acos(-1)
#define inf         1e17
#define mod         1000000007
#define ull         unsigned long long int
#define f(i,k,n)    for(ll i=k;i<n;i++)
#define fr(i,n,k)   for(i=n;i>=k;i--)
#define ent(a)      scanf("%lld",&a)
#define ent2(a,b)   scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a)      memset(a,0,sizeof(a))
#define vec(v,s)    vector<ll>v[s]
#define arr(a,s)    ll a[s];
//#define check(n,pos) (n&(1<<pos))
//#define set(n,pos)  (n|(1<<pos))
//knight and king//
int dr[]= {2, 2, -2, -2, 1, -1, 1, -1};
int dc[]= {1,-1,  1, -1, 2,  2,-2, -2};
int dr1[]= {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[]= {-1,0, 1,-1, 0, 1, -1, 0,   1};
int dr2[]= {0, 0, 1, -1};
int dc2[]= {1,-1, 0,  0};
////////////////////////////
using namespace std;

#define ma 200004
ll b[ma],fr[ma];

ll bigmod(ll n,ll p)
{
 if(p==0)return 1;
 ll x=bigmod(n,p/2);
 x=(x*x)%mod;
 if(p%2==1)x=(x*n)%mod;
 return x;
}

void pre()
{
 ll n,i;
 fr[0]=1;
 f(i,1,ma)fr[i]=(fr[i-1]*i)%mod;
}

ll ncr(ll n,ll r)
{
 ll p=fr[n];
 ll p1=(fr[n-r]*fr[r])%mod;
 p1=bigmod(p1,mod-2);
 return (p*p1)%mod;
}

int main()
{
 string t;
 pre();
 ll n,i,j;
 while(cin>>t)
 {
  ll cn=0;
  for(i=t.sz-1;i>=0;i--)
  {
   cn+=(t[i]==')');
  }
  ll ans=0;
  ll cn1=0;

  for(i=0;i<t.sz;i++)
  {
   if(t[i]==')')
   {
    cn--;
    continue;
   }
   ans+=cn;
   ll p=min(cn,cn1);
   for(j=1;j<=p;j++)
   {
    ans+=ncr(cn1,j)*ncr(cn,j+1);
    ans%=mod;
   }
   cn1++;

  }

  cout<<ans<<endl;
 }

 return 0;
}


///Allah gave me the brain.Allah will help me///
/*
Nahid Hossain
Jahangirnagar University
Roll:54
*/
#include<bits/stdc++.h>
#define ll          long long int
#define db          double
#define pf          printf
#define sf          scanf
#define ff          first
#define ss          second
#define clr         clear()
#define sz          size()
#define pb          push_back
#define mk          make_pair
#define pi          acos(-1)
#define inf         1e17
#define mod         1000000007
#define ull         unsigned long long int
#define f(i,k,n)    for(ll i=k;i<n;i++)
#define fr(i,n,k)   for(i=n;i>=k;i--)
#define ent(a)      scanf("%lld",&a)
#define ent2(a,b)   scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a)      memset(a,0,sizeof(a))
#define vec(v,s)    vector<ll>v[s]
#define arr(a,s)    ll a[s];
//#define check(n,pos) (n&(1<<pos))
//#define set(n,pos)  (n|(1<<pos))
//knight and king//
int dr[]= {2, 2, -2, -2, 1, -1, 1, -1};
int dc[]= {1,-1,  1, -1, 2,  2,-2, -2};
int dr1[]= {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[]= {-1,0, 1,-1, 0, 1, -1, 0,   1};
int dr2[]= {0, 0, 1, -1};
int dc2[]= {1,-1, 0,  0};
////////////////////////////
using namespace std;

#define ma 200004
ll b[ma],fr[ma];

ll bigmod(ll n,ll p)
{
 if(p==0)return 1;
 ll x=bigmod(n,p/2);
 x=(x*x)%mod;
 if(p%2==1)x=(x*n)%mod;
 return x;
}

void pre()
{
 ll n,i;
 fr[0]=1;
 f(i,1,ma)fr[i]=(fr[i-1]*i)%mod;
}

ll ncr(ll n,ll r)
{
 ll p=fr[n];
 ll p1=(fr[n-r]*fr[r])%mod;
 p1=bigmod(p1,mod-2);
 return (p*p1)%mod;
}

int main()
{
 string t;
 pre();
 ll n,i,j;
 while(cin>>t)
 {
  ll cn=0;
  for(i=t.sz-1;i>=0;i--)
  {
   cn+=(t[i]==')');
  }
  ll ans=0;
  ll cn1=0;

  for(i=0;i<t.sz;i++)
  {
   if(t[i]==')')
   {
    cn--;
    continue;
   }

  cn1++;
  ll p=ncr(cn+cn1-1,cn1);
  ans+=p;
  ans%=mod;
  }

  cout<<ans<<endl;
 }

 return 0;
}


#include <bits/stdc++.h>
#define x first
#define y second
#define ll long long

const int N = 2e5 + 5;
const ll MOD = 1e9 + 7;
int open, close[N];
ll ans, f[N];
std::string s;

ll fpow(ll a, ll p) {
    ll ans = 1LL;
    while (p) {
        if (p & 1LL) ans = ans * a % MOD;
        a = a * a % MOD;
        p >>= 1LL;
    }
    return ans;
}

ll nCr(ll n, ll r) {
    return f[n] * fpow(f[r], MOD - 2LL) % MOD * fpow(f[n - r], MOD - 2LL) % MOD;
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cin >> s;

    f[0] = 1LL;
    for (int i = 1; i < N; ++i) f[i] = f[i - 1] * i * 1LL % MOD;
    for (int i = (int)s.size() - 1; i >= 0; --i) {
        close[i] = close[i + 1] + (s[i] == ')');
    }
    for (int i = 0; i < (int)s.size(); ++i) {
        if (s[i] == '(') {
            (ans += nCr(open + close[i + 1], open + 1)) %= MOD;
            ++open;
        }
    }

    std::cout << ans << '\n';
}


#include <bits/stdc++.h>
#define x first
#define y second
#define ll long long

const int N = 2e5 + 5;
const ll MOD = 1e9 + 7;
int cnt, close;
ll ans, f[N];
std::string s;

ll fpow(ll a, ll p) {
    ll ans = 1LL;
    while (p) {
        if (p & 1LL) ans = ans * a % MOD;
        a = a * a % MOD;
        p >>= 1LL;
    }
    return ans;
}

ll nCr(ll n, ll r) {
    return f[n] * fpow(f[r], MOD - 2LL) % MOD * fpow(f[n - r], MOD - 2LL) % MOD;
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cin >> s;

    f[0] = 1LL;
    for (int i = 1; i < N; ++i) f[i] = f[i - 1] * i * 1LL % MOD;
    for (char c : s) cnt += (c == ')');
    for (int i = 0; i < (int)s.size(); ++i) {
        if (s[i] == '(') {
            (ans += nCr(cnt + i + 1LL - 2LL * close, i + 1LL - close)) %= MOD;
        }
        else {
            ++close;
        }
    }

    ans /= 2LL;
    std::cout << ans << '\n';
}


#include <bits/stdc++.h>

using namespace std;

const int inf = 1e9 + 7;

typedef long long ll;

ll C(int n, int k) {
    vector<vector<ll>> dp(n + 1, vector<ll> (n + 1));
    for (int i = 0; i <= n; i++) {
       dp[i][0] = 1;
       dp[i][i] = 1;
       for (int j = 1; j < i; j++)
            dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
    }
    return dp[n][k];
}

int main() {
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    string s;
	cin >> s;
	int n = s.size();
	vector<int> l(n);
	vector<int> r(n);
    l[0] = (s[0] == '(') ? 1 : 0;
	r[n - 1] = (s[n - 1] == ')') ? 1 : 0;
	for (int i = 1; i < n; i++)
		l[i] = l[i - 1] + ((s[i] == '(') ? 1 : 0);
	for (int i = n - 2; i >= 0; i--)
		r[i] = r[i + 1] + ((s[i] == ')') ? 1 : 0);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] != '(' || r[i] == 0)
			continue;
		int t = C(l[i] + r[i] - 1, l[i]);
		ans = (long long)(ans + t) % inf;
	}
	cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int inf = 1e9 + 7;

typedef long long ll;

ll C(int n, int k) {
    vector<vector<ll>> dp(n + 1, vector<ll> (n + 1));
    for (int i = 0; i <= n; i++) {
       dp[i][0] = 1;
       dp[i][i] = 1;
       for (int j = 1; j < i; j++)
            dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
    }
    return dp[n][k];
}

int main() {
    freopen("input.txt", "r", stdin);
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    string s;
	cin >> s;
	int n = s.size();
	vector<int> l(n);
	vector<int> r(n);
    l[0] = (s[0] == '(') ? 1 : 0;
	r[n - 1] = (s[n - 1] == ')') ? 1 : 0;
	for (int i = 1; i < n; i++)
		l[i] = l[i - 1] + ((s[i] == '(') ? 1 : 0);
	for (int i = n - 2; i >= 0; i--)
		r[i] = r[i + 1] + ((s[i] == ')') ? 1 : 0);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] != '(' || r[i] == 0)
			continue;
		int t = C(l[i] + r[i] - 1, l[i]);
		ans = (long long)(ans + t) % inf;
	}
	cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;
vector<int> f;

typedef long long ll;

inline int addMod(long long a, int b) {
	return (a + b) % mod;
}

inline int mul(long long a, int b) {
    return a * b % mod;
}

int bpow(int x, int n) {
    if (!n)
        return 1;
    if (n & 1)
        return mul(bpow(mul(x, x), n / 2), x);
    else
        return bpow(mul(x, x), n / 2);
}

inline int divmod(int a, int b) {
    return mul(a, bpow(b, mod - 2));
}

inline int F(int n) {
	return (n < 0) ? 0 : f[n];
}

inline int C(int n, int k) {
	return divmod(F(n), mul(F(n - k), F(k)));
}

int main() {
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    string s;
	cin >> s;
	int n = s.size();
    f.resize(n + 1);
	f[0] = 1;
	for (int i = 1; i <= n; i++)
		f[i] = mul(f[i - 1], i);
	vector<int> l(n);
	vector<int> r(n);
    l[0] = (s[0] == '(') ? 1 : 0;
	r[n - 1] = (s[n - 1] == ')') ? 1 : 0;
	for (int i = 1; i < n; i++)
		l[i] = l[i - 1] + ((s[i] == '(') ? 1 : 0);
	for (int i = n - 2; i >= 0; i--)
		r[i] = r[i + 1] + ((s[i] == ')') ? 1 : 0);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] != '(' || r[i] == 0)
			continue;
		int t = C(l[i] + r[i] - 1, l[i]);
		ans = (long long)(ans + t) % mod;
	}
	cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+5,MOD=1e9+7;
int n,q,i,b,sum,a[N][2];
int t[N],dp[N],F[N];
int pow1(int x,int n){
	if(n == 0) return 1;
	int y = 1;
	for(;n>1;x=x*x%MOD,n>>=1) if(n&1) y=(y*x)%MOD;
	return (x*y)%MOD;
}
int C(int n,int m){
	if(n<m) return 0;
	if(n == m) return 1;
	return F[n]*pow1(F[m],MOD-2)%MOD*pow1(F[n-m],MOD-2)%MOD;
}
main(){
	string s;
	cin >> s;
	for(i =2, F[1] = 1;i<N;i++)
	F[i] = F[i-1]*i%MOD;
	if(s[0] == '(') a[0][1] = 1;
	for(i=1;i<s.size();i++)
    if(s[i] =='(') a[i][1] = a[i-1][1]+1;
	else 	a[i][1] = a[i-1][1];
    for(i=s.size()-1;i>=0;i--)
    if(s[i] ==')') a[i][0] = a[i+1][0]+1;
    else a[i][0] = a[i+1][0];
	for(i =0;i<s.size();i++)
				if(s[i] == '(')
			    sum = (sum + C(a[i][1] + a[i][0]-1,a[i][1]))%MOD;
	cout << sum;
}


#include<bits/stdc++.h>
using namespace std;
#define ii pair<ll,ll>
#define ll long long int
ll N=1000000007;
vector<ll> fact(1000001,1);
vector<ll> inv_fact(1000001,1);
ll modexp(ll x,ll y){
	if(y==0){
		return 1;
	}
	else{
		if(y%2==0){
			ll res=modexp(x,y/2);
			return (res*res)%N;
		}
		else{
			ll res=modexp(x,y/2);
			return (((res*res)%N)*x)%N;
		}
	}
}
void func(ll len)
{
	fact[0] = 1;
	for (ll i = 1; i <=len; i++){
		fact[i] = (fact[i - 1] * i) % N;
	}

	inv_fact[len] = modexp(fact[len], N - 2);

	for (ll i = len-1; i >= 0; i--){
		inv_fact[i] = (inv_fact[i + 1] * (i + 1)) % N;
	}
}

ll C(ll n,ll r){
	if(n<r){
		return 0;
	}
	else{
		ll a=fact[n],b=inv_fact[r],c=inv_fact[n-r];
		return (((a*b)%N) * c)%N;
	}
}
int main(){

	string s;
	cin>>s;
	ll l=0,r=0,len=s.size(),sum=0;
	func(len+1);
	for(ll i=0;i<len;i++){
		if(s[i]=='('){
			l++;
		}
	}

	ll r1=0;

	for(ll i=len-1;i>=0;i--){
		if(l==0){
			break;
		}
		else if(s[i]=='('){

			sum=(sum+C(l+r1-1,l)%N); // f(l,r1) gives the number of rsbs
			                     // subsequences with last ( as s[i],=summation(rCz * (l-1)C(z-1) )
			l--;                 //where z varies from 1 to min(r,l).
		}
		else{
			r1++;
		}
	}
	cout<<sum<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ii pair<ll,ll>
#define ll long long int
ll N=1000000007;
vector<ll> fact(1000001,1);
vector<ll> inv_fact(1000001,1);
ll modexp(ll x,ll y){
	if(y==0){
		return 1;
	}
	else{
		if(y%2==0){
			ll res=modexp(x,y/2);
			return (res*res)%N;
		}
		else{
			ll res=modexp(x,y/2);
			return (((res*res)%N)*x)%N;
		}
	}
}
void func(ll len)
{
	fact[0] = 1;
	for (ll i = 1; i <=len; i++){
		fact[i] = (fact[i - 1] * i) % N;
	}

	inv_fact[len] = modexp(fact[len], N - 2);

	for (ll i = len-1; i >= 0; i--){
		inv_fact[i] = (inv_fact[i + 1] * (i + 1)) % N;
	}
}

ll C(ll n,ll r){
	if(n<r){
		return 0;
	}
	else{
		ll a=fact[n],b=inv_fact[r],c=inv_fact[n-r];
		return (((a*b)%N) * c)%N;
	}
}
int main(){

	string s;
	cin>>s;
	ll l=0,r=0,len=s.size(),sum=0;
	func(len+1);
	for(ll i=0;i<len;i++){
		if(s[i]=='('){
			l++;
		}
	}

	ll r1=0;

	for(ll i=len-1;i>=0;i--){
		if(l==0){
			break;
		}
		else if(s[i]=='('){

			sum=(sum+C(l+r1-1,l)%N )%N; // f(l,r1) gives the number of rsbs
			                     // subsequences with last ( as s[i],=summation(rCz * (l-1)C(z-1) )
			l--;                 //where z varies from 1 to min(r,l).
		}
		else{
			r1++;
		}
	}
	cout<<sum<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ii pair<ll,ll>
#define ll long long int
ll N=1000000007;
ll C(ll n,ll r){
	if(n<r){
		return 0;
	}
	ll num=1;
	for(int i=1;i<=r;i++){
		num=num*(n+1-i)/i;
	}
	return num;
}
ll f(ll l,ll r){
	ll res=0,z=min(l,r);
	if(z<1){
		return 0;
	}
	else{
		for(ll j=1;j<=z;j++){
			res=(res+ ((C(r,j)*C(l-1,j-1)) %N))%N;
		}
		return res;
	}
}
int main(){
	string s;
	cin>>s;
	ll l=0,r=0,len=s.size(),sum=0,z;
	for(ll i=0;i<len;i++){
		if(s[i]=='('){
			l++;
		}
		else{
			r++;
		}
	}
	ll r1=0;
	vector<ii> vec(len);
	for(ll i=len-1;i>=0;i--){
		if(s[i]=='('){

			sum=(sum+f(l,r1))%N;
			l--;
		}
		else{
			r1++;
		}
	}
	cout<<sum<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ii pair<ll,ll>
#define ll long long int
ll N=1000000007;
ll C(ll n,ll r){
	if(n<r){
		return 0;
	}
	ll num=1;
	for(ll i=1;i<=r;i++){
		num=num*(n+1-i)/i;
	}
	return num%N;
}
ll f(ll l,ll r){
	ll res=0,z=min(l,r);
	if(z<1){
		return 0;
	}
	else{
		ll num=r;
		res=num;
		for(ll j=2;j<=z;j++){
			num=(num*(r+1-j)*(l-j+1))/(j*(j-1));
			num=num%N;
			res=(res+num )%N;
		}
		return res;
	}
}
int main(){
	string s;
	cin>>s;
	ll l=0,r=0,len=s.size(),sum=0,z;
	for(ll i=0;i<len;i++){
		if(s[i]=='('){
			l++;
		}
		else{
			r++;
		}
	}
	ll r1=0;
	vector<ii> vec(len);
	for(ll i=len-1;i>=0;i--){
		if(l==0){
			break;
		}
		else if(s[i]=='('){

			sum=(sum+f(l,r1))%N;
			l--;
		}
		else{
			r1++;
		}
	}
	cout<<sum<<endl;
}


#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
#define int long long
#define fi first
#define se second
#define pll pair<LL, LL>
#define pii pair<LL, LL>
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define SZ(x) ((int)(x.size()))

constexpr int N = 4e5+5;
constexpr int M = 1e9+7;
constexpr int INF = 0x3f3f3f3f3f3f3f3f;
constexpr int INF2 = 0xcfcfcfcfcfcfcfcf;

string s;
int n;
int ans;
int dp[N];

namespace Factor {
    int exgcd(int a, int b, int &x, int &y) {
        if (!b) {
            x = 1;
            y = 0;
            return a;
        }
        int d = exgcd(b, a % b, x, y);
        int t = x;
        x = y;
        y = t - (a / b) * y;
        return d;
    }

    template <class T> T qpow(T a, T b, T m) {
        T c = 1 % m;
        while (b) {
            if (b & 1) c = c * a % m;
            a = a * a % m;
            b >>= 1;
        }
        return c;
    }

    template <class T> T inline inv(T x, T m) { return qpow(x, m-2, m); }

    template <class T, int M, int N> struct Inv {
        T inv[N];
        Inv() {
            inv[1] = 1;
            for (int i = 2; i < N; ++i) inv[i] = (long long)(M - M / i) * inv[M % i] % M;
        }
    };

    template <int N> struct Mu {
        signed mu[N];
        signed flg[N];
        signed tot;
        signed p[N];
        Mu() {
            mu[1] = 1;
            for (int i = 2; i < N; ++i) {
                if (!flg[i]) p[++tot] = i, mu[i] = -1;
                for (int j = 1; j <= tot && i * p[j] < N; ++j) {
                    flg[i * p[j]] = 1;
                    if (i % p[j] == 0) {
                        mu[i * p[j]] = 0;
                        break;
                    }
                    mu[i * p[j]] = -mu[i];
                }
            }
        }
    };

    template <int N> struct Prime {
        bool prime[N];
        bool vis[N];
        vector<signed> primes;
        signed phi[N];
        Prime() {
            phi[1] = 1;
            for (int i = 2; i < N; ++i) {
                if (!vis[i]) {
                    phi[i] = i - 1;
                    primes.push_back(i);
                }
                for (int j = 0; j < primes.size(); ++j) {
                    if (1ll * i * primes[j] >= N) break;
                    vis[i * primes[j]] = 1;
                    if (i % primes[j]) {
                        phi[i * primes[j]] = phi[i] * (primes[j] - 1);
                    } else {
                        // i % pri[j] == 0
                        // 换言之，i 之前被 pri[j] 筛过了
                        // 由于 pri 里面质数是从小到大的，所以 i 乘上其他的质数的结果一定也是
                        // pri[j] 的倍数 它们都被筛过了，就不需要再筛了，所以这里直接 break
                        // 掉就好了
                        phi[i * primes[j]] = phi[i] * primes[j];
                        break;
                    }
                }
            }
        }

        // f(n) = \sum_{d|n} g(d)
        // g(n) = \sum_{d|n} mu(d) * f(n/d)
        signed mu(signed x) {
            int cnt = 0;
            for (int p: primes) {
                if (p * p > x) break;
                if (x % p) continue;
                cnt++;
                int now = 0;
                while (x % p == 0) x /= p, now++;
                if (now > 1) return 0;
            }
            if (x != 1) cnt++;
            return cnt % 2 ? -1 : 1;
        }

    };

    signed euler(signed x) {
        signed ans=x;
        for (signed i=2; i*i <= x; ++i)
            if(x % i ==0) {
                ans = ans - ans / i;
                while (x % i == 0) x /=i;
            }
        if(x > 1) ans = ans - ans / x;
        return ans;
    }

    template<class T> T crt(const vector<pair<T, T>>& v) {
        T n = 1;
        T ans = 0;
        for (auto& p: v) {
            n *= p.fi;
        }
        for (auto& p: v) {
            T m = n / p.fi;
            T b = inv(m, p.fi);
            ans = (ans + p.se * m % n * b % n) % n;
        }
        return ans;
    }

    template <class T, int M, int N> struct Combination {
        T fact[N];
        Combination() {
            fact[0] = 1 % M;
            for (int i = 1; i < N; i++)
                fact[i] = fact[i-1] * i % M;
        }
        inline T C(int n, int m) {
            return fact[n] * inv<T>(fact[n-m] * fact[m] % M, M) % M;
        }
        inline T stirling(int n, int k) {
            T ans = 0;
            for (int i = 0; i < k; i++) {
                T p1 = (i & 1) ? -1 : 1;
                ans = (ans + C(k, i) % M * qpow<T>(k-i, n, M) % M * p1 + M) % M;
            }
            return ans * inv<T>(fact[k], M) % M;
        }
    };

    template <int N, int M> struct Lagrange {
        int a[N+1][N+1], x[N+1], y[N+1], cnt;
        int ans[N+1];

        void add(int x, int y) {
            this->x[cnt] = x;
            this->y[cnt] = y;
            cnt++;
        }
        void add(int a[N+1], int b[N+1]) {
            for (int i = 0; i <= N; i++)
                a[i] = (a[i] + M + b[i]) % M;
        }
        void mul(int a[N+1], int b[N+1], int maxj = N) {
            int c[N+1];
            memset(c, 0, sizeof(c));
            for (int i = 0; i <= N; i++)
                for (int j = 0; i+j <= N && j <= maxj; j++)
                    c[i+j] += a[i] * b[j] % M,
                            c[i+j] = (c[i+j] + M) % M;
            memcpy(a, c, sizeof(c));
        }
        void build() {
            memset(ans, 0, sizeof(ans));
            for (int i = 0; i < cnt; i++) {
                int ta[N+1], tb;
                int t[N+1];
                memset(ta, 0, sizeof(ta));
                memset(t, 0, sizeof(t));
                ta[0] = y[i];
                tb = 1;
                for (int j = 0; j < cnt; j++) {
                    if (i == j) continue;
                    t[0] = -x[j];
                    t[1] = 1;
                    mul(ta, t, 1);
                    tb = (x[i] - x[j] + M) % M * tb % M;
                }
                t[0] = inv(tb, M);
                t[1] = 0;
                mul(ta, t, 0);
                add(ans, ta);
            }
        }
        int calc(int x) {
            int po[N+1];
            po[0] = 1;
            for (int i = 1; i <= N; i++) po[i] = po[i-1] * x % M;
            int res = 0;
            for (int j = 0; j <= N; j++) res = (res + po[j] * ans[j] % M + M) % M;
            return res;
        }
    };
}

Factor::Combination<int, M, N> cmb;

signed main() {
    fastio;
    cin >> s;
    int l = 0, r=  0;
    for (char& c: s) r += c == ')';
    for (char& c: s) {
        if (c == '(') {
            l++;
            ans = (ans + cmb.C(l+r-1, l)) % M;
        } else r--;
    }
    cout << ans << endl;
    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
#define int long long
#define fi first
#define se second
#define pll pair<LL, LL>
#define pii pair<LL, LL>
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define SZ(x) ((int)(x.size()))

constexpr int N = 4e5+5;
constexpr int M = 1e9+7;
constexpr int INF = 0x3f3f3f3f3f3f3f3f;
constexpr int INF2 = 0xcfcfcfcfcfcfcfcf;

string s;
int n;
int ans;
int dp[N];

namespace Factor {
    int exgcd(int a, int b, int &x, int &y) {
        if (!b) {
            x = 1;
            y = 0;
            return a;
        }
        int d = exgcd(b, a % b, x, y);
        int t = x;
        x = y;
        y = t - (a / b) * y;
        return d;
    }

    template <class T> T qpow(T a, T b, T m) {
        T c = 1 % m;
        while (b) {
            if (b & 1) c = c * a % m;
            a = a * a % m;
            b >>= 1;
        }
        return c;
    }

    template <class T> T inline inv(T x, T m) { return qpow(x, m-2, m); }

    template <class T, int M, int N> struct Inv {
        T inv[N];
        Inv() {
            inv[1] = 1;
            for (int i = 2; i < N; ++i) inv[i] = (long long)(M - M / i) * inv[M % i] % M;
        }
    };

    template <int N> struct Mu {
        signed mu[N];
        signed flg[N];
        signed tot;
        signed p[N];
        Mu() {
            mu[1] = 1;
            for (int i = 2; i < N; ++i) {
                if (!flg[i]) p[++tot] = i, mu[i] = -1;
                for (int j = 1; j <= tot && i * p[j] < N; ++j) {
                    flg[i * p[j]] = 1;
                    if (i % p[j] == 0) {
                        mu[i * p[j]] = 0;
                        break;
                    }
                    mu[i * p[j]] = -mu[i];
                }
            }
        }
    };

    template <int N> struct Prime {
        bool prime[N];
        bool vis[N];
        vector<signed> primes;
        signed phi[N];
        Prime() {
            phi[1] = 1;
            for (int i = 2; i < N; ++i) {
                if (!vis[i]) {
                    phi[i] = i - 1;
                    primes.push_back(i);
                }
                for (int j = 0; j < primes.size(); ++j) {
                    if (1ll * i * primes[j] >= N) break;
                    vis[i * primes[j]] = 1;
                    if (i % primes[j]) {
                        phi[i * primes[j]] = phi[i] * (primes[j] - 1);
                    } else {
                        // i % pri[j] == 0
                        // 换言之，i 之前被 pri[j] 筛过了
                        // 由于 pri 里面质数是从小到大的，所以 i 乘上其他的质数的结果一定也是
                        // pri[j] 的倍数 它们都被筛过了，就不需要再筛了，所以这里直接 break
                        // 掉就好了
                        phi[i * primes[j]] = phi[i] * primes[j];
                        break;
                    }
                }
            }
        }

        // f(n) = \sum_{d|n} g(d)
        // g(n) = \sum_{d|n} mu(d) * f(n/d)
        signed mu(signed x) {
            int cnt = 0;
            for (int p: primes) {
                if (p * p > x) break;
                if (x % p) continue;
                cnt++;
                int now = 0;
                while (x % p == 0) x /= p, now++;
                if (now > 1) return 0;
            }
            if (x != 1) cnt++;
            return cnt % 2 ? -1 : 1;
        }

    };

    signed euler(signed x) {
        signed ans=x;
        for (signed i=2; i*i <= x; ++i)
            if(x % i ==0) {
                ans = ans - ans / i;
                while (x % i == 0) x /=i;
            }
        if(x > 1) ans = ans - ans / x;
        return ans;
    }

    template<class T> T crt(const vector<pair<T, T>>& v) {
        T n = 1;
        T ans = 0;
        for (auto& p: v) {
            n *= p.fi;
        }
        for (auto& p: v) {
            T m = n / p.fi;
            T b = inv(m, p.fi);
            ans = (ans + p.se * m % n * b % n) % n;
        }
        return ans;
    }

    template <class T, int M, int N> struct Combination {
        T fact[N];
        Combination() {
            fact[0] = 1 % M;
            for (int i = 1; i < N; i++)
                fact[i] = fact[i-1] * i % M;
        }
        inline T C(int n, int m) {
            return fact[n] * inv<T>(fact[n-m] * fact[m] % M, M) % M;
        }
        inline T stirling(int n, int k) {
            T ans = 0;
            for (int i = 0; i < k; i++) {
                T p1 = (i & 1) ? -1 : 1;
                ans = (ans + C(k, i) % M * qpow<T>(k-i, n, M) % M * p1 + M) % M;
            }
            return ans * inv<T>(fact[k], M) % M;
        }
    };

    template <int N, int M> struct Lagrange {
        int a[N+1][N+1], x[N+1], y[N+1], cnt;
        int ans[N+1];

        void add(int x, int y) {
            this->x[cnt] = x;
            this->y[cnt] = y;
            cnt++;
        }
        void add(int a[N+1], int b[N+1]) {
            for (int i = 0; i <= N; i++)
                a[i] = (a[i] + M + b[i]) % M;
        }
        void mul(int a[N+1], int b[N+1], int maxj = N) {
            int c[N+1];
            memset(c, 0, sizeof(c));
            for (int i = 0; i <= N; i++)
                for (int j = 0; i+j <= N && j <= maxj; j++)
                    c[i+j] += a[i] * b[j] % M,
                            c[i+j] = (c[i+j] + M) % M;
            memcpy(a, c, sizeof(c));
        }
        void build() {
            memset(ans, 0, sizeof(ans));
            for (int i = 0; i < cnt; i++) {
                int ta[N+1], tb;
                int t[N+1];
                memset(ta, 0, sizeof(ta));
                memset(t, 0, sizeof(t));
                ta[0] = y[i];
                tb = 1;
                for (int j = 0; j < cnt; j++) {
                    if (i == j) continue;
                    t[0] = -x[j];
                    t[1] = 1;
                    mul(ta, t, 1);
                    tb = (x[i] - x[j] + M) % M * tb % M;
                }
                t[0] = inv(tb, M);
                t[1] = 0;
                mul(ta, t, 0);
                add(ans, ta);
            }
        }
        int calc(int x) {
            int po[N+1];
            po[0] = 1;
            for (int i = 1; i <= N; i++) po[i] = po[i-1] * x % M;
            int res = 0;
            for (int j = 0; j <= N; j++) res = (res + po[j] * ans[j] % M + M) % M;
            return res;
        }
    };
}

Factor::Combination<int, M, N> cmb;

signed main() {
    fastio;
    cin >> s;
    int l = 0, r=  0;
    for (char& c: s) r += c == ')';
    for (char& c: s) {
        if (c == '(') {
            l++;
            if (l+r-1 >= l)
            ans = (ans + cmb.C(l+r-1, l)) % M;
        } else r--;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;
int add(int x, int y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
int sub(int x, int y) {
  x -= y;
  if (x < 0) x += mod;
  return x;
}
int mult(int x, int y) {
  return (1ll * x * y) % mod;
}
int bin_pow(int x, int p) {
  if (p == 0) return 1;
  if (p & 1) return mult(x, bin_pow(x, p - 1));
  return bin_pow(mult(x, x), p / 2);
}
int rev(int x) {
  return bin_pow(x, mod - 2);
}

const int N = 200100;
int f[N], rf[N];

int C(int n, int k) {
  if (k < 0 || k > n) return 0;
  return mult(f[n], mult(rf[k], rf[n - k]));
}

int pref[N];

int main() {
  ios_base::sync_with_stdio(0);
  f[0] = 1;
  for (int i = 1; i < N; ++i) {
    f[i] = mult(f[i - 1], i);
  }
  rf[N - 1] = rev(f[N - 1]);
  for (int i = N - 2; i >= 0; --i) {
    rf[i] = mult(rf[i + 1], i + 1);
  }

  string s;
  cin >> s;
  int n = s.size();
  int op = 0, cl = 0;
  for (char c : s) {
    cl += (c == ')');
  }
  int ans = 0;
  for (char c : s) {
    if (c == '(') {
      op++;
      ans = add(ans, C(op + cl - 1, op));
    } else {
      cl--;
    }
  }
  cout << ans << '\n';
  return 0;
}


#include "bits/stdc++.h"

using namespace std;

#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)

typedef long long ll;
typedef long double ld;

void solve();

int32_t main () {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(20);
    #ifdef LOCAL
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
const int M = 1e9 + 7;
void add (int &a, int b) {
    a += b;
    if (a >= M)
        a -= M;
}
const int N = 4e5 + 5;
int exp (int a, int b) {
    if (b == 0)
        return 1;
    int ans = exp(a, b/2);
    ans = (ans * ans) % M;
    if (b & 1)
        ans = (ans * a) % M;
    return ans;
}
int fac[N], ifac[N];
string s;
int c (int n, int r) {
    if (n < r or r < 0)
        return 0;
    int ans = fac[n];
    ans *= ifac[n - r];
    ans %= M;
    ans *= ifac[r];
    ans %= M;
    return ans;
}
void solve() {
    fac[0] = 1;
    for (int i = 1; i < N; ++i)
        fac[i] = (fac[i - 1] * i) % M;
    ifac[N - 1] = exp(fac[N - 1], M - 2);
    for (int i = N - 2; i >= 0; --i)
        ifac[i] = (ifac[i + 1] * (i + 1)) % M;
    cin >> s;
    int op = 0, cl = 0;
    for (auto i : s) {
        if (i == ')')
            ++cl;
    }
    int ans = 0;
    for (auto i : s) {
        if (i == ')')
            --cl;
        else {
            ++op;
            add(ans, c(op + cl - 1, cl - 1));
        }
    }
    cout << ans;
}


#include <bits/stdc++.h>
#define ll int64_t

using namespace std;

const int MOD = 1e9 + 7;

ll mult_mod(ll a, ll b){
    return (a % MOD * b % MOD) % MOD;
}

ll mult_add(ll a, ll b){
    b %= MOD;
    a += b;
    if(a >= MOD){
        a -= MOD;
    }
    return a;
}

ll c_n_k(int n, int k, vector<pair<ll, ll>> fact){
    return mult_mod(mult_mod(fact[n].first, fact[k].second), fact[n - k].second);
}

ll binpow(ll a, int p){
    if(p == 1){
        return a;
    }
    if(p == 0){
        return 1;
    }
    if(p & 1){
        ll temp = binpow(a, p - 1);
        return mult_mod(a, temp);
    }
    ll temp = binpow(a, p / 2);
    return mult_mod(temp, temp);
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    vector<pair<ll, ll>> factorial(1000000);
    factorial[0].first = 1;
    factorial[0].second = 1;
    for(int i = 1; i <= 1000000; i++){
        factorial[i].first = mult_mod(i, factorial[i - 1].first);
        factorial[i].second = binpow(factorial[i].first, MOD - 2);
    }
    int n = s.size();
    vector<int> suff(n);
    suff[n - 1] = (s.back() == ')');
    for(int i = n - 2; i >= 0; i--){
        suff[i] = suff[i + 1];
        suff[i] += (s[i] == ')');
    }
    vector<int> pref(n);
    pref[0] = (s[0] == '(');
    for(int i = 1; i < n; i++){
        pref[i] = pref[i - 1];
        pref[i] += (s[i] == '(');
    }
    ll res = 0;
    for(int i = 0; i < n - 1; i++){
        if(s[i] == ')'){
            continue;
        }
        int opened = pref[i];
        int closed = suff[i + 1];
        //cout << opened << " " << closed << ' ';
        ll temp = c_n_k(opened + closed - 1, opened, factorial);
        //cout << temp << '\n';
        res = mult_add(res, temp);
    }
    cout << res;
}


#include <iostream>
#include <vector>
#include <cstdint>

using namespace std;

int mod = (int)1e9 + 7;

int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {
	if (!a) {
		x = 0;
		y = 1;
		return b;
	}
	int64_t x1, y1;
	int64_t d = extGcd(b % a, a, x1, y1);
	x = y1 - (b / a) * x1;
	y = x1;
	return d;
}

inline int addMod(int a, int b, int m = mod) {
	return ((int64_t)a + b) % m;
}

inline int mulMod(int a, int b, int m = mod) {
	return ((int64_t)a * b) % m;
}

inline int divMod(int a, int b, int m = mod) {
	int64_t x, y;
	int64_t g = extGcd(b, m, x, y);
	if (g != 1) {
		cerr << "Bad gcd!" << endl;
		for (;;);
	}
	x = (x % m + m) % m;
	return mulMod(a, x, m);
}

const int factRange = 1000000;
int fact[factRange];

inline void precalcFactorials() {
	fact[0] = 1;
	for (int i = 1; i < factRange; i++) {
		fact[i] = mulMod(fact[i-1], i);
	}
}

inline int F(int n) {
	return (n < 0) ? 0 : fact[n];
}

inline int C(int k, int n) {
	return divMod(F(n), mulMod(F(n-k), F(k)));
}

int main() {
	ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	int len = s.size();
	precalcFactorials();
	vector<int> opnLeft(len), clsRight(len);
	opnLeft[0] = (s[0] == '(') ? 1 : 0;
	for (int i = 1; i < len; i++) {
		opnLeft[i] = opnLeft[i-1] + ((s[i] == '(') ? 1 : 0);
	}
	clsRight[len-1] = (s[len-1] == ')') ? 1 : 0;
	for (int i = len-2; i >= 0; i--) {
		clsRight[i] = clsRight[i+1] + ((s[i] == ')') ? 1 : 0);
	}
	int res = 0;
	for (int i = 0; i < len; i++) {
		if (s[i] != '(' || clsRight[i] == 0) {
			continue;
		}
		int add = C(opnLeft[i], opnLeft[i] + clsRight[i] - 1);
		res = addMod(res, add);
	}
	cout << res << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#define ll int64_t

using namespace std;

const int MOD = 1e9 + 7;

inline int mult_mod(int a, int b){
    return ((ll)a * b) % MOD;
}

inline int mult_add(int a, int b){
    return((ll)a + b) % MOD;
}

ll extGcd(ll a, ll b, ll& x, ll& y) {
	if (!a) {
		x = 0;
		y = 1;
		return b;
	}
	int64_t x1, y1;
	int64_t d = extGcd(b % a, a, x1, y1);
	x = y1 - (b / a) * x1;
	y = x1;
	return d;
}

inline ll binpow(ll a, int p){
    if(p == 1){
        return a;
    }
    if(p == 0){
        return 1;
    }
    if(p & 1){
        ll temp = binpow(a, p - 1);
        return mult_mod(a, temp);
    }
    ll temp = binpow(a, p / 2);
    return mult_mod(temp, temp);
}

inline ll mult_div(int a, int b){
    ll x, y;
    ll g = extGcd(b, MOD, x, y);
    x = (x % MOD + MOD) % MOD;
    return mult_mod(a, x);
}

int factorial[300000];

inline ll c_n_k(int n, int k){
    return mult_div(factorial[n], mult_mod(factorial[k], factorial[n - k]));
}

inline void precalc(){
    factorial[0] = 1;
    factorial[0] = 1;
    for(int i = 1; i < 3e5; i++){
        factorial[i] = mult_mod(i, factorial[i - 1]);
    }
}

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

    string s;
    cin >> s;

    precalc();

    int n = s.size();

    vector<int> suff(n);
    suff[n - 1] = (s.back() == ')');
    for(int i = n - 2; i >= 0; i--){
        suff[i] = suff[i + 1];
        suff[i] += (s[i] == ')');
    }

    vector<int> pref(n);
    pref[0] = (s[0] == '(');
    for(int i = 1; i < n; i++){
        pref[i] = pref[i - 1];
        pref[i] += (s[i] == '(');
    }

    int res = 0;
    for(int i = 0; i < n - 1; i++){
        if(s[i] == ')' || suff[i + 1] == 0){
            continue;
        }
        int opened = pref[i];
        int closed = suff[i + 1];
        //zcout << opened << " " << closed << ' ';
        ll temp = c_n_k(opened + closed - 1, opened);
        //cout << temp << '\n';
        res = mult_add(res, temp);
    }

    cout << res;
}


#include <iostream>
#include <vector>
#include <algorithm>
#define ll int64_t

using namespace std;

const int MOD = 1e9 + 7;

inline int mult_mod(int a, int b){
    return ((ll)a * b) % MOD;
}

inline int mult_add(int a, int b){
    return((ll)a + b) % MOD;
}

ll extGcd(ll a, ll b, ll& x, ll& y) {
	if (!a) {
		x = 0;
		y = 1;
		return b;
	}
	int64_t x1, y1;
	int64_t d = extGcd(b % a, a, x1, y1);
	x = y1 - (b / a) * x1;
	y = x1;
	return d;
}

inline ll binpow(ll a, int p){
    if(p == 1){
        return a;
    }
    if(p == 0){
        return 1;
    }
    if(p & 1){
        ll temp = binpow(a, p - 1);
        return mult_mod(a, temp);
    }
    ll temp = binpow(a, p / 2);
    return mult_mod(temp, temp);
}

inline ll mult_div(int a, int b){
    ll x, y;
    ll g = extGcd(b, MOD, x, y);
    x = (x % MOD + MOD) % MOD;
    return mult_mod(a, x);
}

inline ll c_n_k(int n, int k, vector<pair<int, int>> fact){
    return mult_div(fact[n].first, mult_mod(fact[k].first, fact[n - k].first));
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    vector<pair<int, int>> factorial(3e5);
    factorial[0].first = 1;
    factorial[0].second = 1;
    for(int i = 1; i < 3e5; i++){
        factorial[i].first = mult_mod(i, factorial[i - 1].first);
    }
    int n = s.size();
    vector<int> suff(n);
    suff[n - 1] = (s.back() == ')');
    for(int i = n - 2; i >= 0; i--){
        suff[i] = suff[i + 1];
        suff[i] += (s[i] == ')');
    }
    vector<int> pref(n);
    pref[0] = (s[0] == '(');
    for(int i = 1; i < n; i++){
        pref[i] = pref[i - 1];
        pref[i] += (s[i] == '(');
    }
    ll res = 0;
    for(int i = 0; i < n - 1; i++){
        if(s[i] == ')' || suff[i + 1] == 0){
            continue;
        }
        int opened = pref[i];
        int closed = suff[i + 1];
        //zcout << opened << " " << closed << ' ';
        ll temp = c_n_k(opened + closed - 1, opened, factorial);
        //cout << temp << '\n';
        res = mult_add(res, temp);
    }
    cout << res;
}


#include <bits/stdc++.h>
#define ll int64_t

using namespace std;

const int MOD = 1e9 + 7;

inline ll mult_mod(ll a, ll b){
    return (a * b) % MOD;
}

inline ll mult_add(ll a, ll b){
    a += b;
    a %= MOD;
    return a;
}

ll c_n_k(int n, int k, vector<pair<ll, ll>> fact){
    return mult_mod(mult_mod(fact[n].first, fact[k].second), fact[n - k].second);
}

ll binpow(ll a, int p){
    if(p == 1){
        return a;
    }
    if(p == 0){
        return 1;
    }
    if(p & 1){
        ll temp = binpow(a, p - 1);
        return mult_mod(a, temp);
    }
    ll temp = binpow(a, p / 2);
    return mult_mod(temp, temp);
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    vector<pair<ll, ll>> factorial(3e5);
    factorial[0].first = 1;
    factorial[0].second = 1;
    for(int i = 1; i < 3e5; i++){
        factorial[i].first = mult_mod(i, factorial[i - 1].first);
        factorial[i].second = binpow(factorial[i].first, MOD - 2);
    }
    int n = s.size();
    vector<int> suff(n);
    suff[n - 1] = (s.back() == ')');
    for(int i = n - 2; i >= 0; i--){
        suff[i] = suff[i + 1];
        suff[i] += (s[i] == ')');
    }
    vector<int> pref(n);
    pref[0] = (s[0] == '(');
    for(int i = 1; i < n; i++){
        pref[i] = pref[i - 1];
        pref[i] += (s[i] == '(');
    }
    ll res = 0;
    for(int i = 0; i < n - 1; i++){
        if(s[i] == ')' || suff[i + 1] == 0){
            continue;
        }
        int opened = pref[i];
        int closed = suff[i + 1];
        //cout << opened << " " << closed << ' ';
        ll temp = c_n_k(opened + closed - 1, opened, factorial);
        //cout << temp << '\n';
        res = mult_add(res, temp);
    }
    cout << res;
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int MOD = 1e9 + 7;

ll mult_mod(ll a, ll b){
    return (a % MOD * b % MOD) % MOD;
}

ll mult_add(ll a, ll b){
    a %= MOD;
    b %= MOD;
    a += b;
    if(a >= MOD){
        a -= MOD;
    }
    return a;
}

ll c_n_k(int n, int k, vector<pair<ll, ll>> fact){
    return mult_mod(mult_mod(fact[n].first, fact[k].second), fact[n - k].second);
}

ll binpow(ll a, int p){
    if(p == 1){
        return a;
    }
    if(p == 0){
        return 1;
    }
    if(p & 1){
        ll temp = binpow(a, p - 1);
        return mult_mod(a, temp);
    }
    ll temp = binpow(a, p / 2);
    return mult_mod(temp, temp);
}

signed main(){
    string s;
    cin >> s;
    vector<pair<ll, ll>> factorial(3e5);
    factorial[0].first = 1;
    factorial[0].second = 1;
    for(int i = 1; i <= 1e5; i++){
        factorial[i].first = mult_mod(i, factorial[i - 1].first);
        factorial[i].second = binpow(factorial[i].first, MOD - 2);
    }
    int n = s.size();
    vector<int> suff(n);
    suff[n - 1] = (s.back() == ')');
    for(int i = n - 2; i >= 0; i--){
        suff[i] = suff[i + 1];
        suff[i] += (s[i] == ')');
    }
    vector<int> pref(n);
    pref[0] = (s[0] == '(');
    for(int i = 1; i < n; i++){
        pref[i] = pref[i - 1];
        pref[i] += (s[i] == '(');
    }
    ll res = 0;
    for(int i = 0; i < n - 1; i++){
        if(s[i] == ')'){
            continue;
        }
        int opened = pref[i];
        int closed = suff[i + 1];
        //cout << opened << " " << closed << ' ';
        ll temp = c_n_k(opened + closed - 1, opened, factorial);
        //cout << temp << '\n';
        res = mult_add(res, temp);
    }
    cout << res;
}


#include <bits/stdc++.h>
#define ll int64_t

using namespace std;

const int MOD = 1e9 + 7;

inline ll mult_mod(ll a, ll b){
    return (a * b) % MOD;
}

inline ll mult_add(ll a, ll b){
    a += b;
    a %= MOD;
    return a;
}

ll binpow(ll a, int p){
    if(p == 1){
        return a;
    }
    if(p == 0){
        return 1;
    }
    if(p & 1){
        ll temp = binpow(a, p - 1);
        return mult_mod(a, temp);
    }
    ll temp = binpow(a, p / 2);
    return mult_mod(temp, temp);
}

inline ll mult_div(ll a, ll b){
    b = binpow(b, MOD - 2);
    return mult_mod(a, b);
}

ll c_n_k(int n, int k, vector<pair<ll, ll>> fact){
    return mult_div(fact[n].first, mult_mod(fact[k].first, fact[n - k].first));
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    vector<pair<ll, ll>> factorial(3e5);
    factorial[0].first = 1;
    factorial[0].second = 1;
    for(int i = 1; i < 3e5; i++){
        factorial[i].first = mult_mod(i, factorial[i - 1].first);
    }
    int n = s.size();
    vector<int> suff(n);
    suff[n - 1] = (s.back() == ')');
    for(int i = n - 2; i >= 0; i--){
        suff[i] = suff[i + 1];
        suff[i] += (s[i] == ')');
    }
    vector<int> pref(n);
    pref[0] = (s[0] == '(');
    for(int i = 1; i < n; i++){
        pref[i] = pref[i - 1];
        pref[i] += (s[i] == '(');
    }
    ll res = 0;
    for(int i = 0; i < n - 1; i++){
        if(s[i] == ')' || suff[i + 1] == 0){
            continue;
        }
        int opened = pref[i];
        int closed = suff[i + 1];
        //cout << opened << " " << closed << ' ';
        ll temp = c_n_k(opened + closed - 1, opened, factorial);
        //cout << temp << '\n';
        res = mult_add(res, temp);
    }
    cout << res;
}


#include <iostream>
#include <vector>
#include <algorithm>
#define ll int64_t

using namespace std;

const int MOD = 1e9 + 7;

inline ll mult_mod(ll a, ll b){
    return (a * b) % MOD;
}

inline ll mult_add(ll a, ll b){
    a += b;
    a %= MOD;
    return a;
}

ll extGcd(ll a, ll b, ll& x, ll& y) {
	if (!a) {
		x = 0;
		y = 1;
		return b;
	}
	int64_t x1, y1;
	int64_t d = extGcd(b % a, a, x1, y1);
	x = y1 - (b / a) * x1;
	y = x1;
	return d;
}

inline ll binpow(ll a, int p){
    if(p == 1){
        return a;
    }
    if(p == 0){
        return 1;
    }
    if(p & 1){
        ll temp = binpow(a, p - 1);
        return mult_mod(a, temp);
    }
    ll temp = binpow(a, p / 2);
    return mult_mod(temp, temp);
}

inline ll mult_div(ll a, ll b){
    ll x, y;
    ll g = extGcd(b, MOD, x, y);
    x = (x % MOD + MOD) % MOD;
    return mult_mod(a, x);
}

inline ll c_n_k(int n, int k, vector<pair<ll, ll>> fact){
    return mult_div(fact[n].first, mult_mod(fact[k].first, fact[n - k].first));
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    vector<pair<ll, ll>> factorial(3e5);
    factorial[0].first = 1;
    factorial[0].second = 1;
    for(int i = 1; i < 3e5; i++){
        factorial[i].first = mult_mod(i, factorial[i - 1].first);
    }
    int n = s.size();
    vector<int> suff(n);
    suff[n - 1] = (s.back() == ')');
    for(int i = n - 2; i >= 0; i--){
        suff[i] = suff[i + 1];
        suff[i] += (s[i] == ')');
    }
    vector<int> pref(n);
    pref[0] = (s[0] == '(');
    for(int i = 1; i < n; i++){
        pref[i] = pref[i - 1];
        pref[i] += (s[i] == '(');
    }
    ll res = 0;
    for(int i = 0; i < n - 1; i++){
        if(s[i] == ')' || suff[i + 1] == 0){
            continue;
        }
        int opened = pref[i];
        int closed = suff[i + 1];
        //cout << opened << " " << closed << ' ';
        ll temp = c_n_k(opened + closed - 1, opened, factorial);
        //cout << temp << '\n';
        res = mult_add(res, temp);
    }
    cout << res;
}


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

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

ll extGcd(ll a,ll b,ll &x,ll &y){
	if(a == 0){
		x = 0;
		y = 1;
		return b;
	}
	ll x1 , y1;
	ll d = extGcd(b%a , a , x1 , y1);
	x = y1 - (b / a) * x1;
	y = x1;
	return d;
}

ll addMod (ll a , ll b , int m = mod){
	return (a + b)%m;
}

ll mulMod (ll a, ll b, int m = mod){
	return (a * b)%m;
}

ll modInv (ll a,ll b ,int m = mod){
	ll x , y;
	ll g = extGcd(b,m,x,y);
	if(g != 1)cerr << "No Solution !";
	x = (x % m + m) % m;
	return mulMod(a,x,m);
}

const int range = 1000000;
int fact[range];

void precalFact(){
	fact[0] = 1;
	for(int i = 1 ; i < range ; i++)
		fact[i] = mulMod(fact[i-1],i);
}

ll F(ll n){
	return (n < 0) ? 0 : fact[n];
}

ll C(ll n,ll k){
	return modInv(F(n),mulMod(F(n-k),F(k)));
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	string s;
	cin >> s;
	int length_s = s.length();
	vector<int> opn(length_s);
	vector<int> cls(length_s);
	precalFact();
	opn[0] = (s[0] == '(') ? 1 : 0;
	for(int i = 1 ; i < length_s ; i++){
		if(s[i] == '(')
			opn[i] = opn[i - 1] + 1;
		else
			opn[i] = opn[i - 1];
	}
	cls[length_s - 1] = (s[length_s - 1] == ')') ? 1 : 0;
	for(int i = length_s - 2 ; i >= 0 ; i--){
		if(s[i] == ')')
			cls[i] = cls[i + 1] + 1;
		else
			cls[i] = cls[i + 1];
	}

	ll ans = 0;
	for(int i = 0 ; i < length_s ; i++){
		if(s[i] == ')' || cls[i] == 0)continue;
		int poss = C(opn[i] + cls[i] - 1,opn[i]);
		ans = addMod(ans,poss);
	}

	cout << ans << '\n';

	return 0;
}


// created by anaksoleh
// 19 Jan 2020

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

const int MOD = 1e9 + 7;

string s;
vector<int> buka , tutup;
int C(int l)
{
	int ans = 0;
	int curr = buka.size() - 1;
	for(int i = tutup.size()-1 ; i >=0 ; i--){
		for(int j = curr ; j >= 0 ; j--){
			if(tutup[i] > buka[j] && tutup[i-l+1] > buka[j]){
				ans += ((j+1)/l)%MOD;
				curr = j-1;
				break;
			}
		}
	}
	return ans%MOD;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> s;
	for(int i = 0 ; i < (int)s.length() ; i++){
		if(s[i] == '(')buka.push_back(i);
		if(s[i] == ')')tutup.push_back(i);
	}
	int ans = 0;
	for(int i = 1 ; i <= (int)tutup.size() ; i++){
		ans += C(i)%MOD;
	}
	cout << ans << '\n';
	return 0;
}


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

const int MOD = 1e9 + 7;
string s;

int C(int n,int k)
{
	int res = 1;
	for(int i = n - k + 1 ; i <= n ; i++) res *= i;
	for(int i = 2 ; i <= k ; i++) res /= i;
	return res;
}

int addMOD(int a,int b){
	return (a + b)%MOD;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> s;
	int _length = s.length();
	vector<int> opnL(_length,0);
	vector<int> clsR(_length,0);
	opnL[0] = (s[0] == '(') ? 1 : 0;
	for(int i = 1 ; i < _length ; i++){
		opnL[i] = opnL[i-1];
		if(s[i] == '(')opnL[i]++;
	}
	clsR[_length-1] = (s[_length-1] == ')') ? 1 : 0;
	for(int i = _length - 2 ; i >= 0 ; i--){
		clsR[i] = clsR[i+1];
		if(s[i] == ')')clsR[i]++;
	}
	int ans = 0;
	for(int i = 0 ; i < _length ; i++){
		if(s[i] == ')' || clsR[i] == 0)continue;
		int cnt = C(opnL[i] + clsR[i] - 1,opnL[i]);
		ans = addMOD(ans,cnt);
	}
	cout << ans << '\n';
	return 0;
}