while True:     try:         n=int(input())         line1=input()         line2=input()         res=1                      if line2[-1]=='X':             print(-1)             break         if n==1:             print(1)             break         for i in range(1,n):             temp=0             if line1[i]=='.':                 temp+=1             if line2[i]=='.':                 temp+=1             if temp==0:                 print(-1)                 break             res*=temp         print(res)         except:         break