ans = 1 for i in range(3): inp = input() if inp != "NONE": ans *= (16 - len(inp.split(','))) else: ans *= 16 ans *= ans print(ans)