X = 1 for i in range(3): S = input() if S == "NONE": X *= 16 else: X *= (31 - len(S)) // 2 print(X ** 2)