num_color = 1 for i in range(3): s = input() if s == 'NONE': num_color *= 16 ** 2 else: num_color *= (16 - len(list(s.split(',')))) ** 2 print(num_color)