r_s = list(input().split(",")) g_s = list(input().split(",")) b_s = list(input().split(",")) rr = len(r_s) gg = len(g_s) bb = len(b_s) if r_s == ["NONE"]: rr = 0 if g_s == ["NONE"]: gg = 0 if b_s == ["NONE"]: bb = 0 ans = (16 - rr) ** 2 * (16 - gg) ** 2 * (16 - bb) ** 2 print(ans)