program ex;
var
cx,co,mx,mo,minm,minc:longint;
begin
assign(input,'bs.in');
assign(output,'bs.out');
reset(input);
rewrite(output);
while not eof(input) do
begin
readln(co,cx,mo,mx);
if (co=0) or (mo=0) then
if (cx=0) or (mx=0) then writeln('0') else if (cx<mx) then writeln(cx) else writeln(mx)
else
if (cx=0) or (mx=0) then
if (co=0) or (mo=0) then writeln('0') else if (co<mo) then writeln(co) else writeln(mo)
else
if ((cx*mo+mo)>co)and((co*mx+mx)>cx) then writeln(co+cx)
else
begin
if (cx<co) then minc:=cx else minc:=co;
if (mx<mo) then minm:=mx else minm:=mo;
writeln(minm*minc+minm+minc);
end;
end;
close(input);
close(output);
end.