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