R_l = list(map(str, input().split(","))) G_l = list(map(str, input().split(","))) B_l = list(map(str, input().split(","))) R = max(1, 16 - len(R_l)) G = max(1, 16 - len(G_l)) B = max(1, 16 - len(B_l)) print(R * R * G * G *B * B)