x=1 for i in range(3): s=input() if s=="NONE": x*16 else: x*=(31-len(s))//2 print(x**2)