Uses Math;
var a, b, c, d: int64;
	s, sq : int64;

begin
  Assign(input, 'pobeda.in');
  Assign(output, 'pobeda.out');
  Reset(input);
  Rewrite(output);
  read(a, b, c, d);
  a := Min(a, b) + Min(c, d); 
  s := 1;
  sq := 1;
  while (sq <= a) do
  begin
    sq := sq + s + s + 1;
    inc(s);
  end;
  writeln(s - 1);
end.