{$apptype console}

uses
  Math;

var
  x1, y1, x2, y2: integer;
  l: array[1..4] of longint;
  c: array[1..4] of longint;
  i1, i2, i3, i4, i5, i6: integer;
  c1, c2, c3, c4: longint;
  k: integer;
  curx, cury: longint;
  minp: integer;

begin
  assign(input, 'input.txt');
  reset(input);
  assign(output, 'output.txt');
  rewrite(output);

  Read(x1, y1, x2, y2);
  Read(k);
  for i1 := 1 to k do Read(l[i1]);
  for i1 := 1 to k do Read(c[i1]);

  minp := 4000;
  
  for i1 := -c[4] to c[4] do
    for i2 := -c[3] to c[3] do
      for i3 := -c[2] to c[2] do begin
        curx := i1 * l[4] + i2 * l[3] + i3 * l[2];
        curx := abs(x2 - x1) - curx;

        if (curx mod l[1] = 0) and (curx div l[1] <= c[1]) then begin
          c4 := c[4] - abs(i1);
          c3 := c[3] - abs(i2);
          c2 := c[2] - abs(i3);
          c1 := c[1] - abs(curx div l[1]);

          for i4 := -c4 to c4 do
            for i5 := -c3 to c3 do
              for i6 := -c2 to c2 do begin
                cury := i4 * l[4] + i5 * l[3] + i6 * l[2];
                cury := abs(y2 - y1) - cury;

                if (cury mod l[1] = 0) and (cury div l[1] <= c1) then
                  minp := Min(
                    minp,
                      abs(i1) + abs(i2) + abs(i3) +
                      abs(i4) + abs(i5) + abs(i6) +
                      (abs(curx) + abs(cury)) div l[1] 
                  );
              end;
        end;
      end;

  if minp < 4000 then WriteLn(minp) else WriteLn(-1);

  close(input);
  close(output);
end.

