# No.785 色食い虫 r = input() g = input() b = input() can_colors = 1 for s in [r, g, b]: if s == 'NONE': can_colors *= 16 ** 2 else: can_colors *= (16 - len(s.split(','))) ** 2 print(can_colors)