program trubi;
//uses windows;
type ttype=array [1..4] of integer;
     ttype2=array [1..10000000] of record
     x,y,col,last:integer end;

var f,f2:text;
    x,y,kol,kol2,x1,y1,x2,y2,k,left,right,h,w,max,n,t,t2,t3,t4:integer;
    dl,col:ttype;
    mtek:boolean=true;

    m:array[1..1000,1..1000] of record
    col: byte;
    last: integer;
    end;

    m2,m3: ttype2;
    s,s2:^ttype2;

function Recurse(x,y,c:integer; cll:ttype): integer;
var t:integer;
begin
 result:=0;
 if (x<1) or (x>1000) or (y<1) or (y>1000) then exit;
 if (x=x2) and (y=y2) then
  begin
   if c<max then max:=c;
   exit;
  end;

 for t:=1 to k do
  if cll[t]<>0 then
   begin
    dec(cll[t]);
    Recurse(x+dl[t],y,c+1,cll);
    Recurse(x-dl[t],y,c+1,cll);
    Recurse(x,y+dl[t],c+1,cll);
    Recurse(x,y-dl[t],c+1,cll);
    inc(cll[t]);
   end;
end;

begin
  //allocconsole;

  assignfile(f,'input.txt');
  reset(f);
  assignfile(f2,'output.txt');
  rewrite(f2);
  read(f,x1,y1,x2,y2,k);

  for t:=1 to k do read(f,dl[t]);
  for t:=1 to k do read(f,col[t]);

  max:=maxint;
  fillchar(m,sizeof(m),0);

  kol:=1;
  s:=@m;
  s2:=@m2;
  s^[1].x:=x1;
  s^[1].y:=y1;
  s^[1].col:=0;
  s^[1].last:=0;


  for t:=1 to 40 do
  begin
   for t2:=1 to 1000 do
    for t3:=1 to 1000 do
    for t4:=1 to 4 do
     begin
      m[t2,t3].col:=1;
      inc(m[t2,t3].col);
      m[t2,t3].col:=m[t2,t3].col*20;
      if m[t2,t3].col>0 then m[t2,t3].col:=2;
      if m[t2,t3].col<0 then m[t2,t3].col:=2;
      if m[t2,t3].col=2 then m[t2,t3].col:=4;
      end;
  end;




  //if max=maxint then writeln(f2,'-1') else writeln(f2,max);
  closefile(f2);
//  readln;


end.
