a = 1 for i in range(3): v = input() c = (16-(0 if v=="NONE" else len(v.split(","))))**2 a *= c print(a)