r=input() g=input() b=input() def t(a): if a!="NONE": return 16-len(a.split(",")) else: return 16 rc=t(r) gc=t(g) bc=t(b) print(rc*rc*gc*gc*bc*bc)