from math import comb C = [] dic = {3: 1, 4: 1, 7: 1, 11: 3, 14: 2, 17: 1, 22: 1} ans = 1 for i in range(26): x = int(input()) if i in dic: if x < dic[i]: print(0) exit() if i == 11: t = 1 for k in range(x - 2): t = max(t, comb(k + 2, 2) * (x - k - 2)) ans *= t elif i == 14: t = 1 for k in range(x - 1): t = max(t, (k + 1) * (x - k - 1)) ans *= t else: ans *= x print(ans)