R = input() G = input() B = input() Rv = 16-(len(R)+1)//2 if R != 'NONE' else 16 Gv = 16-(len(G)+1)//2 if G != 'NONE' else 16 Bv = 16-(len(B)+1)//2 if B != 'NONE' else 16 print((Rv*Gv*Bv)**2)