ans=1 for i in range(3): C=input().split(",") if C==["NONE"]: C_bit=16 else: C_bit=16-len(C) ans*=(C_bit**2) print(ans)