type point=record x,y:integer;end;
var x1,x2:point;
kol,mkol,k,i:integer;
c,l:array[1..40] of integer;

function r(h:char):integer;
var res,res1,res2,res3,res4,res5,ii,jj:integer;
begin
 res:=50;
 if (x1.x=x2.x)and(x1.y=x2.y)then res:=kol
  else
   begin
    if kol=mKol then res:=50
     else
      begin
       for ii:=1 to k do
        if c[ii]>0 then
         begin
          dec(c[ii]);inc(kol);x1.x:=x1.x+l[ii];
          res1:=r(' ');
          x1.x:=x1.x-l[ii];
          x1.y:=x1.y+l[ii];
          res2:=r(' ');
          if res2<res1 then res5:=res2 else res5:=res1;
          x1.y:=x1.y-l[ii];
          x2.x:=x2.x+l[ii];
          res3:=r(' ');
          if res3<res5 then res5:=res3;
          x2.x:=x2.x-l[ii];
          x2.y:=x2.y+l[ii];
          res4:=r(' ');
          if res4<res5 then res5:=res4 ;
          x2.y:=x2.y-l[ii];
         end;
         inc(c[ii]);dec(kol);
         if res5<res then res:=res5;
      end;
   end;
 r:=res;
end;

begin
 Assign(input,'input.txt');
 Reset(input);
 read(x1.x,x1.y,x2.x,x2.y);
 read(k);
 For i:=1 to k do
  read(l[i]);
 For i:=1 to k do
  begin
  read(c[i]);
  mkol:=mkol+c[i];
  end;
 writeln(r(' '));
end.