#include <fstream>
using namespace std;
ifstream cin("bs.in");
ofstream cout("bs.out");
long long co,cx,mo,mx;
int main()
{
while (!cin.eof())
{
co=-1;
cin>>co>>cx>>mo>>mx;
if (co!=-1)
{
if (mo==0&&mx==0) cout<<0<<endl;else
{
if (mo==0||co==0)
{
if (mx>cx) cout<<cx<<endl;else
cout<<mx<<endl;
}else
if (mx==0||cx==0)
{
if (mo>co) cout<<co<<endl;else
cout<<mo<<endl;
}else
{
if (co>(cx+1)*mo) cout<<(cx+1)*mo+cx<<endl;else
if (cx>(co+1)*mx) cout<<(co+1)*mx+co<<endl;else
cout<<co+cx<<endl;
}
}
}
}
return 0;
}