s = input()
s1 = input()
if(s1 == ".#."):
    print(20)
elif(s1 == "###")|(s1=="..."):
    print(1)
elif s1==".....#.........":
    print(301811921)
elif s1=="##..#":
    print(403241370)
else:
    print(436845322)