program C0486;
var CO,CX,MO,MX,ans:longint;
begin
assign(input,'bs.in');
reset(input);
assign(output,'bs.out');
rewrite(output);
while not eof do begin
readln(CO,CX,MO,MX);
ans:=0;
if MO*MX<>0 then begin
inc(ans,MO+MX);
dec(CO,MO);
dec(CX,MX);
if CO=CX then inc(ans,CO+CX)
else
if CO>CX then inc(ans,CX+CX+1) else inc(ans,CO+CO+1 );
end;
if ans<0 then writeln(0) else writeln(ans);
end;
close(input);
close(output);
end.