N=int(input()) K=input() if N==1: ANS=0 for i in range(8): if K[i]=='-': continue X=[(i&(1<>j for j in range(4)] for x in range(2): for y in range(2): for z in range(2): if (X[x][y]-z)*((1-X[x][y])-z)<=0: ANS+=1 print(ANS) exit() mod=10**9+7 ANS=0 t=pow(2,2*N,mod) x=(pow(2,N-1,mod)-1)%mod for i in range(8): if K[i]=='-': continue X=[(i&(1<>j for j in range(4)] Y=[X.count(0),X.count(1)] ANS+=t ANS+=x*pow(4,N-2,mod)*(Y[0]*Y[0]+Y[1]*Y[1])%mod ANS-=x*pow(4,N-2,mod)*(Y[0]*Y[1]+Y[1]*Y[0])%mod ANS+=pow(4,N,mod)*pow(2,N-1,mod) print(ANS%mod)