a,b,x,y=STDIN.gets.split(" ") a=a.to_f b=b.to_f x=x.to_f y=y.to_f puts [x/a,y/b].min*(a+b)