import sys import itertools print max(map(lambda (a,b,c,d) : a * b + c * d,itertools.permutations(map(int,sys.stdin.readlines()[0].split(" ")))))