r = list(input().split(',')) g = list(input().split(',')) b = list(input().split(',')) if r == ['NONE']: r = 16 else: r = 16 - len(r) if g == ['NONE']: g = 16 else: g = 16 - len(g) if b == ['NONE']: b = 16 else: b = 16 - len(b) print(r**2 * g**2 * b**2)