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) print(R * R * G * G *B * B)