a=input() b=a.split(' ') b.sort() print(int(b[0])*int(b[1])+int(b[2])*int(b[3]))