r=input().split(',') g=input().split(',') b=input().split(',') x=0 if r=='NONE' else len(r) y=0 if g=='NONE' else len(g) z=0 if b=='NONE' else len(b) print(pow(2,16*3-(x+y+z)))