C = [] for i in range(26): C.append(int(input())) #alphabets = 'abcdefghijklmnopqrstuvwxyz' #print(alphabets[7], alphabets[4], alphabets[11], alphabets[14]) #print(alphabets[22], alphabets[14], alphabets[17], alphabets[11], alphabets[3]) test = True if C[7] < 1: test = False if C[4] < 1: test = False if C[11] < 3: test = False if C[14] < 2: test = False if C[22] < 1: test = False if C[17] < 1: test = False if C[3] < 1: test = False #print(test) if test == False: print(0) exit() # 2か所ある文字は2つにどう分配するのがベストか # 分配方法を全探索で調べる必要ある l_count = C[11] l_best = 0 for left in range(2, l_count): right = l_count - left calc = (left*(left-1)//2) * right l_best = max(l_best, calc) #print(l_best) o_count = C[14] o_best = 0 for left in range(1, o_count): right = o_count - left calc = left * right o_best = max(o_best, calc) #print(o_best) ans = 1 ans *= C[7] ans *= C[4] ans *= l_best ans *= o_best ans *= C[22] ans *= C[17] ans *= C[3] print(ans)