uses math;
var
n,i:integer;
co,mo,cx,mx:longint;
begin
assign(input,'bs.in'); assign(output,'bs.out');
reset(input); rewrite(output);
read(co);
while co<>0 do
begin
read(cx,mo,mx);
if (mo and mx=0) or (co and cx=0) then writeln('0') else
if (co=0) or (mo=0) then writeln(min(cx,mx)) else
if (cx=0) or (mx=0) then writeln(min(co,mo)) else
if cx=co then writeln(cx+co) else
if cx>co then writeln(min(mx*(co+1)+co,cx+co)) else
if cx<co then writeln(min(mo*(cx+1)+cx,cx+co));
read(co);
end;
end.