#include <fstream>
using namespace std;
ifstream cin("bs.in");
ofstream cout("bs.out");
int 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) cout<<mx<<endl;else
if (mx==0) 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;
}