#include<bits/stdc++.h>usingnamespacestd;typedeflonglongll;constintmaxV=1001;intdp[maxV][maxV];intmain(){strings;cin>>s;dp[1][1]=1,dp[1][0]=1;intcurrOpen=1;inti=0;for(autoc:s){i++;if(i<2){continue;}if(c=='('){currOpen++;}else{currOpen--;}for(intj=0;j<currOpen+1;j++){intk=currOpen-j;intl=currOpen-k+1;dp[i][j]=0;if(c=='('){// left bracket, "("if(j-1>=0&&dp[i-1][j-1]!=0){dp[i][j]+=dp[i-1][j-1];}if(k-1>=0&&dp[i-1][currOpen-1-(k-1)]!=0){dp[i][j]+=dp[i-1][currOpen-1-(k-1)];}}else{// right bracket, ")"if(dp[i-1][j+1]!=0){dp[i][j]+=dp[i-1][j+1];}if(dp[i-1][currOpen+1-(k+1)]!=0){dp[i][j]+=dp[i-1][currOpen+1-(k+1)];}}dp[i][j]%=2012;}}cout<<dp[i][0]%2012;}