R=list(input().split(",")) G=list(input().split(",")) B=list(input().split(",")) if R[0]=="NONE": RN=16**2 else: RN=(16-len(R))**2 if G[0]=="NONE": GN=16**2 else: GN=(16-len(G))**2 if B[0]=="NONE": BN=16**2 else: BN=(16-len(B))**2 print(RN*GN*BN)