#include #include #include #include #include #include #include using namespace std; typedef long long ll; #define mo 1000000007 int qp(int a,int b){ int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1); return ans; } int f[2000005]; int g[2000005]; char str[1000005]; int C(int a,int b){ if(b<0 || b>a)return 0; int ans=1ll*f[a]*g[b]%mo*g[a-b]%mo; return ans; } int nI[1000005]; int main() { f[0]=1;for (int i=1;i<=1000000;i++)f[i]=1ll*f[i-1]*i%mo; nI[1]=1;for (int i=2;i<=1000000;i++) nI[i]=1ll*(mo-mo/i)*nI[mo%i]%mo; g[0]=1;for (int i=1;i<=1000000;i++)g[i]=1ll*g[i-1]*nI[i]%mo; int n; while(scanf("%d",&n)!=EOF){ scanf("%s",str); int cur=0; int bo=1; for (int i=0;str[i];i++){ if(str[i]=='(')cur++; else cur--; if(cur<0){ bo=0;break; } } if(bo==0 || (n&1))printf("%d\n",0); else{ int k=n-strlen(str); int h=cur; int ans=(C(k,(k-h)/2)-C(k,(k-h-2)/2)); if(ans<0)ans+=mo; printf("%d\n",ans); } } return 0; }