#include<iostream>
#include<fstream>
using namespace std;
long long cx,co,maxx,maxo;
long long min(long long x,long long y)
{
if (x<y) return x;
else return y;
}
int main()
{
ifstream fin("bs.in");
ofstream fout("bs.out");
while (fin.eof()==false)
{
fin>>co>>cx>>maxo>>maxx;
if (min(maxo,co)==0) fout<<min(maxx,cx)<<endl;
else
if (min(maxx,cx)==0) fout<<min(maxo,co)<<endl;
else
if ((co)>(cx+1)*maxo)
fout<<((cx+1)*maxo+cx)<<endl;
else
if ((cx)>(co+1)*maxx)
fout<<((co+1)*maxx+co)<<endl;
else
fout<<cx+co<<endl;
}
fin.close();
fout.close();
return 0;
}