N1 = input().split(',') N2 = input().split(',') N3 = input().split(',') n1 = 0 if N1[0]=="NONE" else len(N1) n2 = 0 if N2[0]=="NONE" else len(N2) n3 = 0 if N3[0]=="NONE" else len(N3) nn = (16-n1)*(16-n1)*(16-n2)*(16-n2)*(16-n3)*(16-n3) print(nn)