R = input().split(',') G = input().split(',') B = input().split(',') l = [R,G,B] ans = 1 for k in l: if k[0] == 'NONE': ans *= 16*16 else: ans *= (16-len(k))**2 print(ans)