ans = 1 for s in (input() for _ in range(3)): if s == "NONE": ans *= 256 else: ans *= (15 - s.count(',')) ** 2 print(ans)