ans = 1 for i in range(3) : S = input() if S == "NONE" : ans *= 2**16 else : ans *= 2**(16-len(set(S.split(',')))) print(ans)