R = raw_input() G = raw_input() B = raw_input() rlist = [] glist = [] blist = [] if R != 'NONE': rlist = R.split(',') if G != 'NONE': glist = G.split(',') if B != 'NONE': blist = B.split(',') rable = 16 - len(rlist) gable = 16 - len(glist) bable = 16 - len(blist) print rable * rable * gable * gable * bable * bable