program cojs_p486;
var
i,j:longint;
l,c0,c1,m0,m1,l0,l1:int64;
procedure ass;
begin
assign(input,'bs.in');
assign(output,'bs.out');
reset(input);
rewrite(output);
end;
procedure cls;
begin
close(input);
close(output);
end;
procedure swap(var a,b:int64);
var
t:int64;
begin
t:=a;
a:=b;
b:=t;
end;
begin
ass;
while not(eof) do
begin
readln(c0,c1,m0,m1);
if c0>c1
then begin swap(c0,c1); swap(m0,m1); swap(l0,l1); end;
if (m0=0) and (m1<>0)
then begin if m1<c1 then l:=m1 else l:=c1; writeln(l); end;
if (m1=0) and (m0<>0)
then begin if m0<c0 then l:=m0 else l:=c0; writeln(l); end;
if (m1=0) and (m0=0)
then writeln('0');
if (m1<>0) and (m0<>0)
then begin
if m1*(c0+1)<=c1
then l:=c0+(c0+1)*m1
else l:=c0+c1;
writeln(l);
end;
end;
cls;
end.