R = input() G = input() B = input() r = len(R.split(',')) if R != 'NONE' else 0 g = len(G.split(',')) if G != 'NONE' else 0 b = len(B.split(',')) if B != 'NONE' else 0 print((16 - r)**2 * (16 - g)**2 * (16 - b)**2)