{$apptype console}

type
  TPipes = array[1..4] of shortint;
  TDir = array[1..4] of shortint;
  PQueue = ^TQueue;
  TQueue = record
    next: PQueue;
    val: integer;
    pipes: TPipes;
    dir: TDir;
  end;

var
  b, e: PQueue;
  x1, x2, y1, y2: integer;
  c: TPipes;
  d: TDir;
  i, j: integer;
  k: integer;
  l: array[1..4] of longint;
  p: PQueue;

function Used(const p: TPipes): integer;
var
  i: integer;
begin
  Result := 0;
  for i := 1 to 4 do
    Inc(Result, c[i] - p[i]);
end;

procedure Add(vv: integer; const p: TPipes; const d: TDir);

  function Possible(total: integer): boolean;
  var
    i: integer;
  begin
    Result := true;
    if total > 0 then begin
      for i := f + 1 to f + 4 do begin
        if d[i] >= 0 then Dec(total, l[i - f] * p[i - f]);
        if total <= 0 then exit;
      end;
    end else begin
      for i := f + 1 to f + 4 do begin
        if d[i] <= 0 then Inc(total, l[i - f] * p[i - f]);
        if total >= 0 then exit;
      end;
    end;
    Result := false;
  end;

var
  q: PQueue;
  lx, ly: integer;
begin
  if d[1] = 2 then exit;

  if (xx = x2) and (yy = y2) then begin
    WriteLn(Used(p));
    halt;
  end;

  lx := (x2 - xx);
  ly := (y2 - yy);
  if not Possible(lx, 0) or not Possible(ly, 4) then exit;

  New(q);
  with q^ do begin
    next := nil;
    x := xx;
    y := yy;
    pipes := p;
    dir := d;
  end;

  if e = nil then begin
    b := q;
    e := q;
  end else begin
    e^.next := q;
    e := q;
  end;
end;

function DropPipe(const p: TPipes; k: integer): TPipes;
begin
  Result := p;
  Dec(Result[k]);
end;

function SetDir(const d: TDir; i: integer; v: integer): TDir;
begin
  if (d[i] <> 0) and (d[i] <> v) then Result[1] := 2 else begin
    Result := d;
    Result[i] := v;
  end;
end;

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

  b := nil;
  e := nil;
  Read(x1, y1, x2, y2);

  FillChar(c, sizeof(c), 0);
  Read(k);
  for i := 1 to k do Read(l[i]);
  for i := 1 to k do Read(c[i]);

  Fillchar(d, sizeof(d), 0);
  Add(x1, c, d);
  while b <> nil do begin
    p := b;

    if p.val = x2 then begin
      bb := b;
      ee := e;
      b := nil;
      e := nil;

      Fillchar(d, sizeof(d), 0);
      Add(y1, p.pipes, d);
      while b <> nil do begin
        p := b;

        if p.val = y2 then begin
          WriteLn(Used(p.pipes));
          halt;
        end;

        b := b^.next;
        Dispose(p);
      end;

      e := ee;
      b := bb;
    end else
      for i := 1 to k do
        if p.pipes[i] > 0 then begin
          Add(p.val + l[i], DropPipe(p.pipes, i), SetDir(p.dir, i, 1));
          Add(p.val - l[i], DropPipe(p.pipes, i), SetDir(p.dir, i, -1));
        end;

    b := b^.next;
    Dispose(p);
  end;
  WriteLn(-1);

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

