R = list(input().split(',')) G = list(input().split(',')) B = list(input().split(',')) r = pow(16-len(R) if R[0]!='NONE' else 16, 2) g = pow(16-len(G) if G[0]!='NONE' else 16, 2) b = pow(16-len(B) if B[0]!='NONE' else 16, 2) print(r*g*b)