with open('INPUT. TXT') as f:
data = [int(x) for x in f. read(). strip(). split()]
profit = 0
prices = data[0:3]
banks = data[3:6]
for i in range(3):
max_price = max(prices)
max_bank = max(banks)
banks. remove(max_bank)
prices. remove(max_price)
profit += max_price * max_bank
with open('OUTPUT. TXT', 'w') as f:
f. write(str(profit))