f=open("stdin.txt","r") for l in f: nr=l.split(" ") nr.sort() a=int(nr[0]) b=int(nr[1]) c=int(nr[2]) d=int(nr[3]) f=open("stdout.txt","w") f.write(str(a*b+c*d)) f.close()