r,g,b = [[y for y in input().split(",") if y != "NONE"] for x in range(3)] R = 256 G = 256 B = 256 if r: R = (16 - len(r)) ** 2 if g: G = (16 - len(g)) ** 2 if b: B = (16 - len(b)) ** 2 print(R * G * B)