#coding: UTF-8 import sys import re import itertools from collections import deque ### defs ### ### main ### A, B, X, Y = map(int, sys.stdin.readline().split()) print(min(X+X*B/A, Y+Y*A/B))