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