A = input().split(",") B = input().split(",") C = input().split(",") a = 0 if A[0] == "NONE" else len(A) b = 0 if B[0] == "NONE" else len(B) c = 0 if C[0] == "NONE" else len(C) print(pow(16 - a, 2) * pow(16 - b, 2) * pow(16 - c, 2))