R = input().split(",") G = input().split(",") B = 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*r*g*g*b*b)