# 2か所にでてくるlとoをどう分けるか、oは平均的に分けた、lは分け方全探索にした d_count = 0 e_count = 0 h_count = 0 l_count = 0 o_count = 0 r_count = 0 w_count = 0 for i in range(26): c = int(input()) if i == 3: d_count = c elif i == 4: e_count = c elif i == 7: h_count = c elif i == 11: l_count = c elif i == 14: o_count = c elif i == 17: r_count = c elif i == 22: w_count = c #print(d_count, e_count, h_count, l_count, o_count, r_count, w_count) #print('l_count', l_count, 'o_count', o_count) if l_count < 3: l1 = 0 l2 = 0 else: excess = l_count-3 #print('excess', excess) highest = 0 alloc1 = -1 for allocate1 in range(0, excess+1): calc = ((2+allocate1)*(2+allocate1-1)//2)*(1+(excess-allocate1)) #print('allocate1', allocate1, 'calc', calc, 'highest', highest, 'alloc1', alloc1) if calc > highest: highest = calc alloc1 = allocate1 l1 = 2+alloc1 l2 = 1+(excess-alloc1) if o_count < 2: o1 = 0 o2 = 0 else: excess = o_count-2 o1 = 1+(excess)//2 o2 = 1+(excess+1)//2 #print(l1, l2, o1, o2) ans = 1 ans *= h_count ans *= e_count ans *= l1*(l1-1)//2 ans *= o1 ans *= w_count ans *= o2 ans *= r_count ans *= l2 ans *= d_count print(ans)