r = input() g = input() b = input() col = [] if r != 'NONE': col.append(list(r.split(","))) if g != 'NONE': col.append(list(g.split(","))) if b != 'NONE': col.append(list(b.split(","))) ans = 1 for s in col: ans *= (16-len(s))**2 ans2 = ans*(16**2)**(3-len(col)) print(max(ans,ans2))