def read(): s=input() return 16 if s=='NONE' else 15-len(s)//2 print((read()*read()*read())**2)