from math import gcd from decimal import Decimal a,b,x,y = map(int,input().split()) g = gcd(a,b) a //= g b //= g a = Decimal(a) b = Decimal(b) x = Decimal(x) y = Decimal(y) c = x/a d = y/b e = min(c,d) ans = (a+b)*e print(ans)