R = list(input().split(',')) G = list(input().split(',')) B = list(input().split(',')) if R[0] == "NONE": r = 16 else: r = 16 - len(R) if G[0] == "NONE": g = 16 else: g = 16 - len(G) if B[0] == "NONE": b = 16 else: b = 16 - len(B) print(r**2 * g**2 * b**2)