R_l = list(map(str, input().split(","))) G_l = list(map(str, input().split(","))) B_l = list(map(str, input().split(","))) R = 16 - len(R_l) G = 16 - len(G_l) B = 16 - len(B_l) if R_l[0] == "NONE": R = 16 if G_l[0] == "NONE": G = 16 if B_l[0] == "NONE": B = 16 print(R * R * G * G *B * B)