# -*- coding: utf-8 -*- """ No.236 鴛鴦茶 https://yukicoder.me/problems/no/236 """ import sys from sys import stdin input = stdin.readline def main(args): A, B, X, Y = map(int, input().split()) coffee_limit = X * (A + B) / A tea_limit = Y * (A + B) / B print(min(coffee_limit, tea_limit)) if __name__ == '__main__': main(sys.argv[1:])