if __name__ == "__main__": r_list = input().split(",") g_list = input().split(",") b_list = input().split(",") if r_list[0] == "NONE": r_list.clear() if g_list[0] == "NONE": g_list.clear() if b_list[0] == "NONE": b_list.clear() print(pow(16 - len(r_list), 2) * pow(16 - len(g_list), 2) * pow(16 - len(b_list), 2))