program _198C_DeliveringCarcinogen;
uses math;
const eps=1e-9;
var xp,yp,vp,x,y,v,r:longint;
	theta,w,RR,x0,y0,alpha,AB,OA,OB,t0,low,high,mid,h,DG1,DG2:extended;

function viable(t:extended):boolean;
begin
	x0:=cos(theta+w*t)*RR;
	y0:=sin(theta+w*t)*RR;
	AB:=sqrt(sqr(x-x0)+sqr(y-y0));
	alpha:=abs(arctan2(y,x)-arctan2(y0,x0));
	if alpha>pi then alpha:=2*pi-alpha;
	DG1:=arccos((sqr(OA)+sqr(AB)-sqr(OB))/(2*OA*AB));
	DG2:=pi-DG1-alpha;
	h:=OA*sin(DG1);
    if (DG1<pi/2)and(DG2<pi/2)and(h<r-eps) then
    	t0:=(sqrt(sqr(OA)-sqr(r))+sqrt(sqr(OB)-sqr(r))+r*(alpha-arccos(r/OA)-arccos(r/OB)))/v
    else
		t0:=AB/v;
	exit(t0<t+eps);
end;

begin
    readln(xp,yp,vp);
	readln(x,y,v,r);
	RR:=sqrt(sqr(xp)+sqr(yp));
	w:=vp/RR;
	theta:=arctan2(yp,xp);
	OA:=sqrt(sqr(x)+sqr(y));
    OB:=RR;
	low:=0; high:=(OA+RR+2*pi*(RR+r))/v;
	repeat
		mid:=(low + high)/2;
		if viable(mid) then high:=mid else low:=mid;
	until high-low<=eps;
	writeln(high:0:8);
end.

program pr1;

{$APPTYPE CONSOLE}

     type point=record x,y:double; end;
          tar=record r1,r2,h:double; end;
const  modul=1046527;  modul7=1000000007;
 eps=1e-11;  nnn=2000000;
 label 1,2,3,4;
var kolshag,w,h,pmax,imax,p1,p2,nn,n1,n2,kolm,j1,i,kk,t,tt,k,i3,i0,i1,i2,i4,step,j:longint;
p,kolraz,rr,s1,mmin,kolmax,x0,y0,vx,vy,f,ii,n,ot,besk,m,k1,k2,a2,jj:int64;
pzav,ott:double;  tt2,ch,ch1,ch2:char;
sss,ss,ss1,ss2:string;
st,fin,a,b,c:point;
ddx,ddy,x,y,z:array [-2000..200000] of double;
gr:array[-2001..2001,-2001..2001] of boolean;
pad: array[-2001..2001] of boolean;
s:int64;
ugt,ugg,vv,xx,yy,xp,yp,vp,l,r, dt,dx,dy,aa,bb,cc,pp,t1,t2,x1,x2,tmin:double;
 oldmingor,oldminver,mingor,minver:array[0..1000] of longint;
sss1,sss2,sss3: string;

flag2,flag1,flag:boolean;
rzav,pprod:double;
name:array[0..200] of string;
function min(a,b:double):double;begin min:=b;if a<b then min:=a;  end;
function max(a,b:longint):longint;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:longint):longint; var p,t:longint;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;
  function dd(x,y:point):double;
begin dd:=sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y));     end;

   function phi(a,b:double):double; label 222;var p:double;
begin
  if (a>0)and (b>=0) then begin p:=arctan(b/a);goto 222; end;
  if (a<0) then begin p:=pi+arctan(b/a);goto 222; end;
  if (a>0)and (b<0) then begin p:=2*pi+arctan(b/a);goto 222; end;
  if (a=0)and (b>0) then begin p:=pi/2;goto 222; end;
  if (a=0)and (b<0) then begin p:=3*pi/2;goto 222; end;
  222: phi:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

   function ttt(ss:string):longint; var i,j,k,s:longint; fl:boolean;
 begin k:=length(ss);
   s:=0; for i:=1 to k do s:=10*s+ord(ss[i])-48;
      ttt:=s;
 end;

 {   function dist2(xx,yy:double):double;  var i,j:longint; dd,pp,tt:double;
      begin
         dd:=1e+20;
         for i:=1 to n do
             begin
                 pp:=abs(xx*a[i]+yy*b[i]-c[i])/sqrt(a[i]*a[i]+b[i]*b[i]);
                if pp<dd then dd:=pp;
             end;
        dist2:=(dd*dd);
      end;
   }
 function dist(a,b,c:point):double;
 var p,q,d1,d2,l,r:double; ll,rr,xx,yy:point;
 begin
    l:=0;r:=1; ll:=a;rr:=b;
    repeat p:=l+(r-l)*0.4; q:=l+(r-l)*0.6;
       xx.x:=ll.x+(rr.x-ll.x)*0.4;
       xx.y:=ll.y+(rr.y-ll.y)*0.4;
       yy.x:=ll.x+(rr.x-ll.x)*0.6;
       yy.y:=ll.y+(rr.y-ll.y)*0.6;
       d1:=dd(xx,c); d2:=dd(yy,c);
       if d1<d2 then begin r:=q; rr:=yy; end else begin  l:=p;ll:=xx;    end;

    until abs(l-r)<eps;
    dist:=dd(ll,c);
 end;
    function dltr(a,b:point):double;   label 33;
 var r1,r2,ot,uga,ugb,ug,x,y,l1,l2:double; cen:point;
   begin
      uga:=phi(a.x,a.y); ugb:=phi(b.x,b.y); cen.x:=0;cen.y:=0;
      ug:=min(abs(uga-ugb),2*pi-abs(uga-ugb)); r1:=dd(a,cen);r2:=dd(b,cen);
      if dist(a,b,cen)>=r then begin ot:=dd(a,b); goto 33;       end;
      l1:=sqrt(r1*r1-r*r);  l2:=sqrt(r2*r2-r*r);

      x:=arctan(l1/r);y:=arctan(l2/r);
      ot:=l1+l2+r*(ug-x-y);

 33: dltr:=ot;
   end;

         begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}       read(xp,yp,vp);
       read(xx,yy,vv,r);
 aa:=0;bb:=10000000; ugg:=phi(xp,yp);
  while abs(aa-bb)>eps do
    begin
        cc:=(aa+bb)/2; ugt:=ugg+cc*vp/sqrt(xp*xp+yp*yp);
     a.x:=xx; a.y:=yy;
     b.x:=sqrt(xp*xp+yp*yp)*cos(ugt);
     b.y:=sqrt(xp*xp+yp*yp)*sin(ugt);
     c.x:=0;c.y:=0;
     if dltr(a,b)/vv<cc then bb:=cc else aa:=cc;
    { writeln(aa:0:5,' ',bb:0:5,' ',dltr(a,b):0:5);   }
    end;
                 writeln(cc:0:8);

  1:
     close(output);

     end.

uses math;
const pi=3.1415926535897932384626433832795;
type
  double=extended;
  dot=record
    x,y:double;
  end;

var
  vp,lt,mid,rt,v,time,xp,yp,rr,x,y,af,r:double;
  ttp,tp,sy,oy:dot;
  i:longint;
function dis(a,b:dot):double;
begin
  dis:=sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));
end;

function cj(a,b,c,d:dot):double;
begin
  cj:=(b.x-a.x)*(d.y-c.y)-(d.x-c.x)*(b.y-a.y);
end;

function dj(a,b,c,d:dot):double;
begin
  dj:=(b.x-a.x)*(d.x-c.x)+(b.y-a.y)*(d.y-c.y);
end;

function xz(v:dot; af:double):dot;
var d1,d2:double;
begin
  d1:=cos(af); d2:=sin(af);
  xz.x:=cos(af)*v.x-sin(af)*v.y;
  xz.y:=sin(af)*v.x+cos(af)*v.y;
end;

procedure qqd(var v1,v2:dot;tp:dot);
var
  tt:dot;
  af:double;
begin
  tt:=tp;
  tt.x:=tt.x/dis(tp,oy)*r; tt.y:=tt.y/dis(tp,oy)*r;
  af:=arccos(r/dis(tp,oy));

  v1:=xz(tt,af);
  v2:=xz(tt,-af);
end;

function calc(v1,v2:dot):double;
var af:double;
begin
  af:=arccos(dj(oy,v1,oy,v2)/dis(oy,v1)/dis(oy,v2));
  calc:=af*r;
end;

function check(ti:double):boolean;
var kind:boolean;
  le,l2:double;
  v1,v2,v3,v4:dot;
begin
  check:=true;
  tp:=xz(tp,ti*vp/rr);

  le:=arccos(dj(oy,tp,oy,ttp)/dis(oy,tp)/dis(oy,ttp));
  kind:=true;
  if (dj(sy,tp,sy,oy)/dis(sy,tp)>0) then
  if (dj(sy,tp,sy,oy)/dis(sy,tp)<dis(sy,tp)) then
    if abs(cj(sy,tp,sy,oy))/dis(sy,tp)<r then kind:=false;
  if kind then check:=(dis(sy,tp)/ti<v) else begin
    qqd(v1,v2,sy);
    qqd(v3,v4,tp);
    le:=dis(sy,v1)+dis(tp,v4)+calc(v1,v4);
    l2:=dis(sy,v2)+dis(tp,v3)+calc(v2,v3);
    if l2<le then le:=l2;
    check:=(le/ti<v);
  end;

  tp:=xz(tp,-ti*vp/rr);
end;

begin
  oy.x:=0; oy.y:=0;
  readln(xp,yp,vp);
  tp.x:=xp; tp.y:=yp;  rr:=dis(tp,oy);
  ttp:=tp;

  readln(x,y,v,r);
  sy.x:=x; sy.y:=y;
  if dis(sy,tp)<1e-10 then begin
    writeln(0.0:0:12);
    halt;
  end;

  lt:=0; rt:=1e10;
  for i:=1 to 300 do begin
    mid:=(lt+rt)/2;
    if check(mid) then rt:=mid else lt:=mid;
  end;

  writeln(lt:0:12);
end.

uses math;
const pi=3.1415926535897932384626433832795;
type
  double=extended;
  dot=record
    x,y:double;
  end;

var
  vp,lt,mid,rt,v,time,xp,yp,rr,x,y,af,r:double;
  ttp,tp,sy,oy:dot;
  i:longint;
function dis(a,b:dot):double;
begin
  dis:=sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));
end;

function cj(a,b,c,d:dot):double;
begin
  cj:=(b.x-a.x)*(d.y-c.y)-(d.x-c.x)*(b.y-a.y);
end;

function dj(a,b,c,d:dot):double;
begin
  dj:=(b.x-a.x)*(d.x-c.x)+(b.y-a.y)*(d.y-c.y);
end;

function xz(v:dot; af:double):dot;
var d1,d2:double;
begin
  d1:=cos(af); d2:=sin(af);
  xz.x:=cos(af)*v.x-sin(af)*v.y;
  xz.y:=sin(af)*v.x+cos(af)*v.y;
end;

function xz2(v:dot; si,co:double):dot;
begin
  xz2.x:=co*v.x-si*v.y;
  xz2.y:=si*v.x+co*v.y;

end;
procedure qqd(var v1,v2:dot;tp:dot);
var
  tt:dot;
  af,si,co:double;
begin
  tt:=tp;
  tt.x:=tt.x/dis(tp,oy)*r; tt.y:=tt.y/dis(tp,oy)*r;
  co:=r/dis(tp,oy);
  si:=1-co*co;
  if si<0 then si:=0 else si:=sqrt(si);

  v1:=xz2(tt,-si,co);
  v2:=xz2(tt,si,co);
end;

function calc(v1,v2:dot):double;
var af:double;
begin
  af:=arccos(dj(oy,v1,oy,v2)/dis(oy,v1)/dis(oy,v2));
  calc:=af*r;
end;

function check(ti:double):boolean;
var kind:boolean;
  le,l2:double;
  v1,v2,v3,v4:dot;
begin
  check:=true;
  tp:=xz(tp,ti*vp/rr);

  le:=arccos(dj(oy,tp,oy,ttp)/dis(oy,tp)/dis(oy,ttp));
  //tp:=xz(tp,-ti*vp);
  kind:=true;
  if (dj(sy,tp,sy,oy)/dis(sy,tp)>0) then
  if (dj(sy,tp,sy,oy)/dis(sy,tp)<dis(sy,tp)) then
    if abs(cj(sy,tp,sy,oy))/dis(sy,tp)<r then kind:=false;
  if kind then check:=(dis(sy,tp)/ti<v) else begin
    qqd(v1,v2,sy);
    //writeln(dj(v2,oy,v2,sy));
    qqd(v3,v4,tp);
    le:=dis(sy,v1)+dis(tp,v4)+calc(v1,v4);
    l2:=dis(sy,v2)+dis(tp,v3)+calc(v2,v3);
    if l2<le then le:=l2;
    check:=(le/ti<v);
  end;

  tp:=xz(tp,-ti*vp/rr);
end;

begin
{readln(tp.x,tp.y);
while 1=1 do begin
  read(af);
  tp:=xz(tp,af);
  tp:=xz(tp,-af);
  writeln(tp.x:0:2,' ',tp.y:0:2);
end;        }
  oy.x:=0; oy.y:=0;
  readln(xp,yp,vp);
  tp.x:=xp; tp.y:=yp;  rr:=dis(tp,oy);
  ttp:=tp;
  {time:=dis(tp,oy)/vp;
  vp:=1/time;}

  readln(x,y,v,r);
  sy.x:=x; sy.y:=y;
  if dis(sy,tp)<1e-10 then begin
    writeln(0.0:0:12);
    halt;
  end;

  lt:=0; rt:=1e10;
  for i:=1 to 300 do begin
    mid:=(lt+rt)/2;
    if check(mid) then rt:=mid else lt:=mid;
  end;

  writeln(lt:0:12);
end.

uses math;
type
  double=extended;
  dot=record
    x,y:double;
  end;

var
  vp,lt,mid,rt,v,time,xp,yp,rr,x,y,af,r:double;
  ttp,tp,sy,oy:dot;
  i:longint;
function dis(a,b:dot):double;
begin
  dis:=sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));
end;

function cj(a,b,c,d:dot):double;
begin
  cj:=(b.x-a.x)*(d.y-c.y)-(d.x-c.x)*(b.y-a.y);
end;

function dj(a,b,c,d:dot):double;
begin
  dj:=(b.x-a.x)*(d.x-c.x)+(b.y-a.y)*(d.y-c.y);
end;

function xz(v:dot; af:double):dot;
var d1,d2:double;
begin
  d1:=cos(af); d2:=sin(af);
  xz.x:=cos(af)*v.x-sin(af)*v.y;
  xz.y:=sin(af)*v.x+cos(af)*v.y;
end;

procedure qqd(var v1,v2:dot;tp:dot);
var
  tt:dot;
  af:double;
begin
  tt:=tp;
  tt.x:=tt.x/dis(tp,oy)*r; tt.y:=tt.y/dis(tp,oy)*r;
  af:=arccos(r/dis(tp,oy));

  v1:=xz(tt,af);
  v2:=xz(tt,-af);
end;

function calc(v1,v2:dot):double;
var af:double;
begin
  af:=arccos(dj(oy,v1,oy,v2)/dis(oy,v1)/dis(oy,v2));
  calc:=af*r;
end;

function check(ti:double):boolean;
var kind:boolean;
  le,l2:double;
  v1,v2,v3,v4:dot;
begin
  check:=true;
  tp:=xz(tp,ti*vp/rr);

  le:=arccos(dj(oy,tp,oy,ttp)/dis(oy,tp)/dis(oy,ttp));
  kind:=true;
  if (dj(sy,tp,sy,oy)/dis(sy,tp)>0) then
  if (dj(sy,tp,sy,oy)/dis(sy,tp)<dis(sy,tp)) then
    if abs(cj(sy,tp,sy,oy))/dis(sy,tp)<r then kind:=false;
  if kind then check:=(dis(sy,tp)/ti<v) else begin
    qqd(v1,v2,sy);
    qqd(v3,v4,tp);
    le:=dis(sy,v1)+dis(tp,v4)+calc(v1,v4);
    l2:=dis(sy,v2)+dis(tp,v3)+calc(v2,v3);
    if l2<le then le:=l2;
    check:=(le/ti<v);
  end;

  tp:=xz(tp,-ti*vp/rr);
end;

begin
oy.x:=pi;
  oy.x:=0; oy.y:=0;
  readln(xp,yp,vp);
  tp.x:=xp; tp.y:=yp;  rr:=dis(tp,oy);
  ttp:=tp;

  readln(x,y,v,r);
  sy.x:=x; sy.y:=y;
  if dis(sy,tp)<1e-10 then begin
    writeln(0.0:0:12);
    halt;
  end;

  lt:=0; rt:=1e10;
  for i:=1 to 300 do begin
    mid:=(lt+rt)/2;
    if check(mid) then rt:=mid else lt:=mid;
  end;

  writeln(lt:0:12);
end.

uses
  math;

const
  eps=1e-8;
  inf=1e9;

var
  d3,d1,d2,a,b,c,tmp,ans,x01,y01,x02,y02,ta,ox,oy,kt,t,xp,yp,vp,x,y,v,r,rv,lt,rt:extended;
  it:longint;

  function dist(x1,y1,x2,y2:extended):extended;
    begin
      dist:=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    end;

  function inseg(x,y,x1,y1,x2,y2:extended):boolean;
    begin
      inseg:=abs(dist(x,y,x1,y1)+dist(x,y,x2,y2)-dist(x1,y1,x2,y2))<eps;
    end;

  procedure cross(a,b,c,r:extended;var x01,y01,x02,y02:extended);
    var
      dd,x00,y00,d:extended;

    begin
      d:=sqrt(a*a+b*b);
      a:=a/d;b:=b/d;c:=c/d;
      d:=abs(c);
      if (d+eps>r)then begin
        x01:=inf;y01:=inf;
        x02:=inf;y02:=inf;
        exit;
      end;
      dd:=r*r-d*d;
      if (abs(dd)<eps)then dd:=0;
      dd:=sqrt(dd);
      x00:=-a*c;
      y00:=-b*c;
      x01:=x00-b*dd;
      y01:=y00+a*dd;
      x02:=x00+b*dd;
      y02:=y00-a*dd;
    end;

begin
  {cross(1,-1,0,2,x01,y01,x02,y02);
  writeln(x01:0:10,' ',y01:0:10,' ',x02:0:10,' ',y02:0:10);
  exit;}
  read(xp,yp,vp);
  read(x,y,v,r);
  rv:=sqrt(xp*xp+yp*yp);
  lt:=0;rt:=1e9;
  for it:=1 to 1000 do begin
    t:=(lt+rt)/2;
    kt:=t*vp*180/(PI*rv);
    kt:=kt*PI/180;
    tmp:=arctan2(yp,xp);
    kt:=kt+tmp;
    ox:=rv*cos(kt);
    oy:=rv*sin(kt);
    if (abs(ox)<eps)then ox:=0;
    if (abs(oy)<eps)then oy:=0;
    a:=oy-y;
    b:=x-ox;
    c:=-a*x-b*y;
    cross(a,b,c,r,x01,y01,x02,y02);
    if (not inseg(x01,y01,x,y,ox,oy))or
       (not inseg(x02,y02,x,y,ox,oy))
         then ans:=dist(x,y,ox,oy)
         else begin
           d1:=sqrt(x*x+y*y);
           d2:=sqrt(ox*ox+oy*oy);
           d3:=dist(x,y,ox,oy);
           ta:=arccos((d1*d1+d2*d2-d3*d3)/(2*d1*d2));
           ta:=ta-(arccos(r/d1)+arccos(r/d2));
           while (ta<-eps)do ta:=ta+2*PI;
           if (2*PI-ta<ta)then ta:=2*PI-ta;
           ta:=ta*360/(2*PI);
           ans:=2*PI*r*ta/360;
           ans:=ans+sqrt(d1*d1-r*r)+sqrt(d2*d2-r*r);
         end;
    if (ans/v<t+eps)
      then rt:=t
      else lt:=t;
  end;
  writeln(t:0:10);
end.

uses math;
type
  extended=double;
const
 eps=1e-12;
var
  i,j,k:longint;
  x,y,x1,y1,v,v1,dan,l,r,r1,stx,sty,mid,w1,l3,l4,ans:double;
function dis(x,y,x1,y1:double):double;
begin
   exit(sqrt(sqr(x-x1)+sqr(y-y1)));
end;
function dot(x,y,x1,y1:double):double;
begin
   exit(x*x1+y*y1);
end;
function check(time:double):boolean;
var xnow,ynow,roranow,cida,cida1,cida2,ll,dd:double;
begin
     roranow:=w1*time;
     xnow:=x1*cos(roranow)-y1*sin(roranow);
     ynow:=y1*cos(roranow)+x1*sin(roranow);

     cida:=arccos(dot(xnow,ynow,stx,sty)/(dis(0,0,xnow,ynow)*dis(0,0,stx,sty)));

     cida1:=arccos(dan/dis(0,0,xnow,ynow));

     cida2:=arccos(dan/dis(0,0,stx,sty));

     if cida1+cida2-cida>=0 then exit(time*v-dis(xnow,ynow,stx,sty)>=0);

     dd:=(cida-cida1-cida2)*dan;

     dd:=dd+sqrt(xnow*xnow+ynow*ynow-dan*dan)+l3;

     exit(v*time-dd>=0);
end;
begin
     readln(x1,y1,v1);
     readln(stx,sty,v,dan);
     if stx=x1 then if sty=y1 then
     begin
      writeln(0);
      halt;
     end;
     l3:=sqrt(stx*stx+sty*sty-dan*dan);
     r1:=sqrt(x1*x1+y1*y1);
     w1:=v1/r1;
     l:=0;
     r:=1e8;
     while abs(r-l)>eps do
     begin
       mid:=(l+r)*0.5;if check(mid) then begin r:=mid;
       ans:=mid;
       end
       else l:=mid;
     end;
     writeln(ans:0:8);
end.

{$R-,S-,Q-,I-,O+}
const pi = 3.1415926535897932384626433832795;
var
  it,xp,yp,vp,x,y,v,r: longint;
  ll,rr,t,ang,xx,yy: extended;

function findang(x,y:extended):extended;
var
  ang: extended;
begin
  if abs(x) < 1e-9 then
  begin
    if y > 0 then findang:=0.5*pi
    else findang:=1.5*pi;
  end else
  if abs(y) < 1e-9 then
  begin
    if x > 0 then findang:=0
    else findang:=pi;
  end else
  begin
    ang:=arctan(abs(y/x));
    if (x < 0) and (y > 0) then ang:=pi-ang else
    if (x < 0) and (y < 0) then ang:=pi+ang else
    if (x > 0) and (y < 0) then ang:=2*pi-ang;
    findang:=ang;
  end;
end;

function dst(x,y:extended):extended;
var
  min: extended;
begin
  min:=abs(x-y);
  if abs(x+2*pi-y) < min then min:=abs(x+2*pi-y);
  if abs(x-2*pi-y) < min then min:=abs(x-2*pi-y);
  if abs(x+4*pi-y) < min then min:=abs(x+4*pi-y);
  if abs(x-4*pi-y) < min then min:=abs(x-4*pi-y);
  dst:=min;
end;

function go(x1,y1,x2,y2:extended):extended;
var
  ma,c1,c2,u1,u2,r1,r2,q1,q2,q3,q4,a,b,c,d,dist,d1,d2: extended;
  ok: boolean;
begin
  dist:=sqrt(sqr(x1-x2)+sqr(y1-y2));
  if dist < 1e-9 then
  begin
    go:=dist;
    exit;
  end;
  d1:=sqrt(sqr(x1)+sqr(y1));
  d2:=sqrt(sqr(x2)+sqr(y2));
  ok:=False;
  if d1*d1 > d2*d2+dist*dist then ok:=True;
  if d2*d2 > d1*d1+dist*dist then ok:=True;
  if not ok then
  begin
    a:=y2-y1; b:=x1-x2;
    c:=-a*x1-b*y1;
    d:=abs(c)/sqrt(a*a+b*b);
    if d < r then
    begin
      c1:=sqrt(x1*x1+y1*y1-r*r);
      c2:=sqrt(x2*x2+y2*y2-r*r);
      u1:=findang(x1,y1);
      u2:=findang(x2,y2);
      r1:=arctan(c1/r);
      q1:=u1-r1; q2:=u1+r1;
      r2:=arctan(c2/r);
      q3:=u2-r2; q4:=u2+r2;
      ma:=dst(q1,q3);
      if dst(q1,q4) < ma then ma:=dst(q1,q4);
      if dst(q2,q3) < ma then ma:=dst(q2,q3);
      if dst(q2,q4) < ma then ma:=dst(q2,q4);
      dist:=c1+c2+ma*r;
    end;
  end;
  go:=dist;
end;

begin
  read(xp,yp,vp);
  read(x,y,v,r);
  ll:=0; rr:=1e9;
  for it:=1 to 500 do
  begin
    t:=(ll+rr)*0.5;
    ang:=t*vp/sqrt(xp*xp+yp*yp);
    xx:=xp*cos(ang)-yp*sin(ang);
    yy:=xp*sin(ang)+yp*cos(ang);
    if go(x,y,xx,yy) <= t*v then rr:=t
    else ll:=t;
  end;
  writeln((ll+rr)*0.5:0:17);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var k,b,ta,tb,tc,td,xp,yp,vp,x,y,v,r,dt,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:extended;
function dis(x1,y1,x2,y2:extended):extended;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:extended):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=vp*time/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 //write(x:0:9,' ',y:0:9,' ',txp:0:9,' ',typ:0:9,' ');
 //writeln(txp:0:9,' ',typ:0:9);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 dt:=(t1x*t2x+t1y*t2y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 if dt<=0 then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 1');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 t1x:=-txp;t1y:=-typ;
 t2x:=t1x+x;t2y:=t1y+y;
 dt:=(t1x*t2x+t1y*t2y)/(dis(txp,typ,0,0)*dis(x,y,txp,typ));
 if dt<=0 then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 2');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<mid then exit(true);
   exit(false);
  end;
 //writeln(nt:0:9);
 tt:=dis(x,y,0,0)*nt;
 //writeln(txp:0:9,' ',typ:0:9,' ',tt:0:9);}
 k:=(y-typ)/(x-txp);
 b:=y-k*x;
 ta:=k;tb:=-1;tc:=b;
 td:=abs(tc)/sqrt(ta*ta+tb*tb);
 if ((tt<0) and (td>=r)) or (tt>=r) then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 3');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 //writeln(tttt:0:9,' in 4');
 tttt:=tttt/v;
 if tttt<=mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 if (xp=x) and (yp=y) then
  begin writeln(0.0:0:9);halt;end;
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
//   write(mid:0:9,' ');
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var k,b,ta,tb,tc,td,xp,yp,vp,x,y,v,r,dt,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:extended;
function dis(x1,y1,x2,y2:extended):extended;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:extended):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=vp*time/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 dt:=(t1x*t2x+t1y*t2y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 if dt<=0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 t1x:=-txp;t1y:=-typ;
 t2x:=t1x+x;t2y:=t1y+y;
 dt:=(t1x*t2x+t1y*t2y)/(dis(txp,typ,0,0)*dis(x,y,txp,typ));
 if dt<=0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<mid then exit(true);
   exit(false);
  end;
 tt:=dis(x,y,0,0)*nt;
 k:=(y-typ)/(x-txp);
 b:=y-k*x;
 ta:=k;tb:=-1;tc:=b;
 td:=abs(tc)/sqrt(ta*ta+tb*tb);
 if ((tt<0) and (td>=r)) or (tt>=r) then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 tttt:=tttt/v;
 if tttt<=mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 if (xp=x) and (yp=y) then
  begin writeln(0.0:0:9);halt;end;
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var xp,yp,vp,x,y,v,r,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:extended;
function dis(x1,y1,x2,y2:extended):extended;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:extended):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=(vp*time)/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 tt:=dis(x,y,0,0)*nt;
 if tt>=r then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 tttt:=tttt/v;
 if tttt<=mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var xp,yp,vp,x,y,v,r,dt,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:extended;
function dis(x1,y1,x2,y2:extended):extended;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:extended):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=vp*time/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 //write(x:0:9,' ',y:0:9,' ',txp:0:9,' ',typ:0:9,' ');
 //writeln(txp:0:9,' ',typ:0:9);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 dt:=(t1x*t2x+t1y*t2y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 if nt<=0 then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 1');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 if dt<=0 then
  begin
   //565656
   //writeln(dis(x,y,txp,typ):0:9,' in 1');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 t1x:=-txp;t1y:=-typ;
 t2x:=t1x+x;t2y:=t1y+y;
 dt:=(t1x*t2x+t1y*t2y)/(dis(txp,typ,0,0)*dis(x,y,txp,typ));
 if dt<=0 then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 2');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<mid then exit(true);
   exit(false);
  end;
 tt:=dis(x,y,0,0)*nt;
 //writeln(txp:0:9,' ',typ:0:9,' ',tt:0:9);
 if tt>=r then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 3');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 //writeln(tttt:0:9,' in 4');
 tttt:=tttt/v;
 if tttt<=mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 if (xp=x) and (yp=y) then
  begin writeln(0.0:0:9);halt;end;
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
//   write(mid:0:9,' ');
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var xp,yp,vp,x,y,v,r,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:extended;
function dis(x1,y1,x2,y2:extended):extended;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:extended):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=(vp*time)/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 tt:=dis(x,y,0,0)*nt;
 if tt>=r then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 tttt:=tttt/v;
 if tttt<=mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 if (xp=x) and (yp=y) then
  begin writeln(0.0:0:9);halt;end;
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var xp,yp,vp,x,y,v,r,dt,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:double;
function dis(x1,y1,x2,y2:double):double;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:double):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=(vp*time)/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 dt:=(t1x*t2x-t1y*t2y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 if dt<0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 t1x:=-txp;t1y:=-typ;
 t2x:=t1x+x;t2y:=t1y+y;
 dt:=(t1x*t2x-t1y*t2y)/(dis(txp,typ,0,0)*dis(x,y,txp,typ));
 if dt<0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=dis(x,y,0,0)*nt;
 if tt>=r then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 tttt:=tttt/v;
 if tttt<=mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 if (xp=x) and (yp=y) then
  begin writeln(0.0:0:9);halt;end;
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var xp,yp,vp,x,y,v,r,dt,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:real;
function dis(x1,y1,x2,y2:real):real;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:real):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=vp*time/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 dt:=(t1x*t2x+t1y*t2y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 if dt<=0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<mid then exit(true);
   exit(false);
  end;
 t1x:=-txp;t1y:=-typ;
 t2x:=t1x+x;t2y:=t1y+y;
 dt:=(t1x*t2x+t1y*t2y)/(dis(txp,typ,0,0)*dis(x,y,txp,typ));
 if dt<=0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<mid then exit(true);
   exit(false);
  end;
 tt:=dis(x,y,0,0)*nt;
 if tt>=r then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 tttt:=tttt/v;
 if tttt<mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 if (xp=x) and (yp=y) then
  begin writeln(0.0:0:9);halt;end;
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var xp,yp,vp,x,y,v,r,dt,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:extended;
function dis(x1,y1,x2,y2:extended):extended;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:extended):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=(vp*time)/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 dt:=(t1x*t2x-t1y*t2y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 if dt<0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 t1x:=-txp;t1y:=-typ;
 t2x:=t1x+x;t2y:=t1y+y;
 dt:=(t1x*t2x-t1y*t2y)/(dis(txp,typ,0,0)*dis(x,y,txp,typ));
 if dt<0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=dis(x,y,0,0)*nt;
 if tt>=r then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 tttt:=tttt/v;
 if tttt<=mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 if (xp=x) and (yp=y) then
  begin writeln(0.0:0:9);halt;end;
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var xp,yp,vp,x,y,v,r,dt,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:extended;
function dis(x1,y1,x2,y2:extended):extended;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:extended):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=vp*time/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 //write(x:0:9,' ',y:0:9,' ',txp:0:9,' ',typ:0:9,' ');
 //writeln(txp:0:9,' ',typ:0:9);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 dt:=(t1x*t2x+t1y*t2y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 if nt<=0 then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 1');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 if dt<=0 then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 1');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 t1x:=-txp;t1y:=-typ;
 t2x:=t1x+x;t2y:=t1y+y;
 dt:=(t1x*t2x+t1y*t2y)/(dis(txp,typ,0,0)*dis(x,y,txp,typ));
 if dt<=0 then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 2');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<mid then exit(true);
   exit(false);
  end;
 tt:=dis(x,y,0,0)*nt;
 //writeln(txp:0:9,' ',typ:0:9,' ',tt:0:9);
 if tt>=r then
  begin
   //writeln(dis(x,y,txp,typ):0:9,' in 3');
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 //writeln(tttt:0:9,' in 4');
 tttt:=tttt/v;
 if tttt<=mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 if (xp=x) and (yp=y) then
  begin writeln(0.0:0:9);halt;end;
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
//   write(mid:0:9,' ');
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

//Copyright @ 2012, Mike Rush, All rights reserved.
uses math;
var xp,yp,vp,x,y,v,r,dt,left,right,mid,rp,nt,txp,typ,t1x,t1y,t2x,t2y,tt,ttt,tt1,tt2,tttt:extended;
function dis(x1,y1,x2,y2:extended):extended;
begin exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));end;
function check(time:extended):boolean;
begin
 rp:=dis(xp,yp,0,0);
 nt:=(vp*time)/rp;
 txp:=xp*cos(nt)-yp*sin(nt);
 typ:=yp*cos(nt)+xp*sin(nt);
 t1x:=-x;t1y:=-y;
 t2x:=t1x+txp;t2y:=t1y+typ;
 nt:=(t1x*t2y-t2x*t1y)/(dis(x,y,0,0)*dis(x,y,txp,typ));
 if nt<0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 t1x:=-txp;t1y:=-typ;
 t2x:=t1x+x;t2y:=t1y+y;
 dt:=(t1x*t2y-t2x*t1y)/(dis(txp,typ,0,0)*dis(x,y,txp,typ));
 if dt<0 then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=dis(x,y,0,0)*nt;
 if tt>=r then
  begin
   ttt:=dis(x,y,txp,typ);
   ttt:=ttt/v;
   if ttt<=mid then exit(true);
   exit(false);
  end;
 tt:=x*txp+y*typ;
 tt:=arccos(tt/(dis(x,y,0,0)*dis(txp,typ,0,0)));
 tt1:=arccos(r/dis(txp,typ,0,0));
 tt2:=arccos(r/dis(x,y,0,0));
 ttt:=tt-tt1-tt2;
 tttt:=ttt*r;
 tttt:=tttt+sqrt(sqr(dis(txp,typ,0,0))-sqr(r))+sqrt(sqr(dis(x,y,0,0))-sqr(r));
 tttt:=tttt/v;
 if tttt<=mid then exit(true);
 exit(false);
end;
begin
 readln(xp,yp,vp);
 readln(x,y,v,r);
 if (xp=x) and (yp=y) then
  begin writeln(0.0:0:9);halt;end;
 left:=0;right:=1E5;
 while abs(left-right)>1E-10 do
  begin
   mid:=(left+right)/2;
   if check(mid) then right:=mid-(1E-10)
                 else left:=mid+(1E-10);
  end;
 writeln(left:0:9);
end.

program _198C_DeliveringCarcinogen;
uses math;
const eps=1e-9;
var xp,yp,vp,x,y,v,r:longint;
	theta,w,RR,x0,y0,alpha,AB,OA,OB,t0,low,high,mid,h:extended;

function viable(t:extended):boolean;
begin
	x0:=cos(theta+w*t)*RR;
	y0:=sin(theta+w*t)*RR;
	alpha:=abs(arctan2(y,x)-arctan2(y0,x0));
	if alpha>pi then alpha:=2*pi-alpha;
	AB:=sqrt(sqr(x-x0)+sqr(y-y0));
	if abs(AB)>eps then h:=sin(alpha)*OA*OB/AB else h:=(OA+OB)/2;
    if (alpha>pi/2)and(h<r-eps) then
		t0:=(sqrt(sqr(OA)-sqr(r))+sqrt(sqr(OB)-sqr(r))+r*(alpha-arccos(r/OA)-arccos(r/OB)))/v
    else
		t0:=AB/v;
	exit(t0<t+eps);
end;

begin
    readln(xp,yp,vp);
	readln(x,y,v,r);
	RR:=sqrt(sqr(xp)+sqr(yp));
	w:=vp/RR;
	theta:=arctan2(yp,xp);
	OA:=sqrt(sqr(x)+sqr(y));
    OB:=RR;
	low:=0; high:=(OA+RR+2*pi*(RR+r))/v;
	repeat
		mid:=(low + high)/2;
		if viable(mid) then high:=mid else low:=mid;
	until high-low<=eps;
	writeln(high:0:8);
end.


var n,m,i,j:longint;
a,f:array[0..10001,0..10001] of char;

begin
//assign(input,'wz.in');reset(input);
//assign(output,'wz.out');rewrite(output);
readln(n,m);
for i:=1 to n do
  begin
  for j:=1 to m do read(a[i,j]);
  readln;
  end;
for i:=1 to n do
  for j:=1 to m do
    f[i,j]:='.';
for i:=2 to n-1 do
  begin
  for j:=2 to m-1 do
    begin
    if (a[i,j+1]='#') and (a[i,j-1]='#') and (a[i+1,j]='#') and (a[i-1,j]='#')
    and (a[i-1,j-1]='#') and (a[i-1,j+1]='#') and (a[i+1,j-1]='#') and (a[i+1,j+1]='#') then
      begin
      f[i,j+1]:='#';f[i,j-1]:='#';f[i+1,j]:='#';f[i-1,j]:='#';
      f[i-1,j-1]:='#';f[i-1,j+1]:='#';f[i+1,j-1]:='#';f[i+1,j+1]:='#';
      end;
    end;
  end;
for i:=1 to n do
  for j:=1 to m do
    if f[i,j]<>a[i,j] then
      begin
      writeln('NO');
      close(input);close(output);
      halt;
      end;
writeln('YES');
close(input);close(output);
end.

const d:array[1..8,1..2] of longint=((1,0),(0,1),(-1,0),(0,-1),(-1,-1),(-1,1),(1,-1),(1,1));
var n,m,i,j,k:longint;
f:boolean;
a:array[1..1000,1..1000] of char;
b:array[1..1000,1..1000] of boolean;

begin
//assign(input,'wz.in');reset(input);
//assign(output,'wz.out');rewrite(output);
readln(n,m);
for i:=1 to n do
  begin
  for j:=1 to m do
    read(a[i,j]);
  readln;
  end;
for i:=2 to n-1 do
  for j:=2 to m-1 do
    begin
    f:=true;
    for k:=1 to 8 do
      if a[i+d[k,1],j+d[k,2]]='.' then f:=false;
    if f then
      begin
      for k:=1 to 8 do
        b[i+d[k,1],j+d[k,2]]:=true;
      end;
    end;
for i:=1 to n do
  for j:=1  to m do
    if (a[i,j]='#') and (b[i,j]=false) then
      begin
      write('NO');
      close(input);close(output);halt;
      end;
write('YES');
close(input);close(output);
end.

var n,m,i,j:Longint;
f,a:array [1..1002,1..1002] of char;
begin
//assign(input,'wz.in');reset(input);
//assign(output,'wz.out'); rewrite(output);
readln(n,m);
for i:=1 to n do
  begin
  for j:=1 to m do
    begin
    read(a[i,j]);
    f[i,j]:='.';
    end;
  readln;
  end;
for i:=1 to n do
  for j:=1 to m do
    if (a[i,j]='#') and (a[i,j+1]='#') and (a[i,j+2]='#') and (a[i+1,j]='#') and (a[i+1,j+2]='#') and (a[i+2,j]='#') and (a[i+2,j+1]='#') and (a[i+2,j+2]='#') then
      begin
      f[i,j]:='#';f[i,j+1]:='#';f[i,j+2]:='#';
      f[i+1,j]:='#';f[i+1,j+2]:='#';
      f[i+2,j]:='#';f[i+2,j+1]:='#';f[i+2,j+2]:='#';
      end;
for i:=1 to n do
  for j:=1 to m do
    if f[i,j]<>a[i,j] then
      begin
      writeln('NO');
      close(input);close(output);
      halt;
      end;
writeln('YES');
close(input);close(output);
end.

const
 fi='';
 fo='';
var
 mt:array[0..1000,0..1000]of char;
 a:array[0..1000,0..1000]of longint;
 n,m:longint;
 f:text;

procedure doc;
var
 i,j:longint;
begin
 assign(f,fi);
 reset(f);
 readln(f,n,m);
 for i:=1 to n do
 begin
  for j:=1 to m do
   read(f,mt[i,j]);
  readln(f);
 end;
 close(f);
end;

function kt(i,j:longint):boolean;
begin
 if(mt[i-1,j-1]='#')and(mt[i-1,j]='#')and(mt[i-1,j+1]='#')and(mt[i,j-1]='#')and(mt[i,j+1]='#')and(mt[i+1,j-1]='#')and(mt[i+1,j]='#')and(mt[i+1,j+1]='#')then kt:=true
 else kt:=false;
end;

procedure xuly;
var
 i,j:longint;
begin
 for i:=1 to n do
  for j:=1 to m do
   if(kt(i,j))then
   begin
    a[i-1,j-1]:=1;
    a[i-1,j]:=1;
    a[i-1,j+1]:=1;
    a[i,j-1]:=1;
    a[i,j+1]:=1;
    a[i+1,j-1]:=1;
    a[i+1,j]:=1;
    a[i+1,j+1]:=1;
   end;
end;

procedure xuat;
var
 i,j:longint;
 ktt:boolean;
begin
 assign(f,fo);
 rewrite(f);
 ktt:=true;
 for i:=1 to n do
 begin
  for j:=1 to m do
   if(mt[i,j]='#')and(a[i,j]=0)then
   begin
    ktt:=false;
    break;
   end;
  if(ktt=false)then break;
 end;
 if(ktt=true)then write(f,'YES')
 else write(f,'NO');
 close(f);
end;

begin
 doc;
 xuly;
 xuat;
end.

type mass=array[1..1000,1..1000]of char;
var
   a,b:mass; f:boolean;
   i,j,k,l,n,m:integer;
begin
   readln(n,m);
   for i:=1 to n do
    begin
        for j:=1 to m do
        begin
            read(a[i,j]);
            b[i,j]:='.'
        end;
        readln;
    end;
   for i:=1 to n-2 do
    for j:=1 to m-2 do
    begin
     f:=true;
     for k:=0 to 2 do
      for l:=0 to 2 do
       begin
          if (k<>l) and (a[i+k,j+l]='.')
          then f:=false
          else if (k<>1) and (l<>1) and (a[i+k,j+l]='.')
               then f:=false;
       end;
      if f then
      for k:=0 to 2 do
      for l:=0 to 2 do
       begin
          if (k<>l)
          then  b[i+k,j+l]:='#'
          else if (k<>1) and (l<>1)
               then b[i+k,j+l]:='#';
       end;
     end;
   f:=true;
   for i:=1 to n do
   begin
    for j:=1 to m do
     if (a[i,j]='#')
     then if (b[i,j]<>'#')
          then f:=false
   end;
   if f
   then writeln('YES')
   else writeln('NO')
end.

var     m,n:longint;
        a,b: array[0..1001,0..1001] of Boolean;

procedure main;
var     i,j: longint;
begin
        for i:=1 to m-2 do
        for j:=1 to n-2 do
        begin
                if  (a[i,j]) and (a[i,j+1]) and (a[i,j+2])
                and (a[i+1,j])  and (a[i+1,j+2])
                and (a[i+2,j]) and (a[i+2,j+1]) and (a[i+2,j+2]) then
                begin
                b[i,j]:=true;
                b[i,j+1]:=true;
                b[i,j+2]:=true;
                b[i+1,j]:=true;
                b[i+1,j+2]:=true;
                b[i+2,j]:=true;
                b[i+2,j+1]:=true;
                b[i+2,j+2]:=true;
                end;
        end;
        for i:=1 to m do
        for j:=1 to n do if a[i,j]<>b[i,j] then
        begin
                write('NO');exit;
        end;
        write('YES')
end;

procedure inp;
var     i,j: longint;
        c: char;
begin
        fillchar(a,sizeof(a),False);
        fillchar(a,sizeof(a),False);
        readln(m,n);
        for i:=1 to m do
        begin
                for j:=1 to n do
                begin
                        read(c);
                        if c='#' then a[i,j]:= True;
                end;
                readln;
        end;
end;

begin
        inp;
        main;
end.

var i,j,n,m,k,o,s:longint;
a,b:array[0..1001,0..1001] of boolean;
c:char;
x:array[1..8] of longint=(1,1,-1,-1,0,0,1,-1);
y:array[1..8] of longint=(1,-1,1,-1,1,-1,0,0);
x1:boolean;
begin
  readln(n,m);
  for i:=1 to n do
  begin
    for j:=1 to m do
    begin
      read(c);
      if c='.' then a[i,j]:=true;
    end;
    readln;
  end;
  for i:=2 to n-1 do
  for j:=2 to m-1 do
  begin
    x1:=false;
    for k:=1 to 8 do
    if a[i+x[k],j+y[k]] then
     begin x1:=true;break;end;
    if not(x1) then
    for k:=1 to 8 do
    b[i+x[k],j+y[k]]:=true;
  end;
  for i:=1 to n do
  for j:=1 to m do
  if a[i,j]=b[i,j] then begin writeln('NO');halt;end;
  writeln('YES');
end.

var
  i,j,n,m:longint;
  a:array[0..1001,0..1001] of char;
  f:array[0..1001,0..1001] of boolean;
procedure doit(x,y:longint);
  begin
    if (a[x+1,y]='.') or (a[x+2,y]='.') or (a[x,y+1]='.') or (a[x,y+2]='.') or (a[x+1,y+2]='.') or (a[x+2,y+1]='.') or (a[x+2,y+2]='.') then exit;
    f[x,y]:=true; f[x+1,y]:=true; f[x+2,y]:=true; f[x,y+1]:=true; f[x,y+2]:=true; f[x+1,y+2]:=true; f[x+2,y+1]:=true; f[x+2,y+2]:=true;
  end;
begin
  readln(n,m);
  for i:=1 to n do
    begin
      for j:=1 to m do
        read(a[i,j]);
      readln;
    end;
  for i:=1 to n-2 do
    for j:=1 to m-2 do
      if a[i,j]='#' then doit(i,j);
  for i:=1 to n do
    for j:=1 to m do
      if (a[i,j]='#') and (f[i,j]=false) then begin writeln('NO'); halt; end;
  writeln('YES');
end.

 var i,j,n,m:longint;
 a,b:array [1..1001,1..1001] of char;
  begin
 {assign (input,'input.txt');
 reset (input);
 assign (output,'output.txt');
 rewrite (output);}

 read (n,m);

 for i:=1 to n do
  begin
   readln;
  for j:=1 to m do
   read (a[i,j]);

  end;

 for i:=2 to n-1 do
  for j:=2 to m-1 do
   begin
    if (a[i,j+1]='#') and (a[i-1,j+1]='#') and (a[i-1,j]='#') and (a[i-1,j-1]='#') and
       (a[i,j-1]='#') and (a[i+1,j-1]='#') and (a[i+1,j]='#') and (a[i+1,j+1]='#') then
        begin
         b[i,j+1]:='#';
         b[i-1,j+1]:='#';
         b[i-1,j]:='#';
         b[i-1,j-1]:='#';
         b[i,j-1]:='#';
         b[i+1,j-1]:='#';
         b[i+1,j]:='#';
         b[i+1,j+1]:='#';
        end;

   end;

 for i:=1 to n do
  for j:=1 to m do
   if a[i,j]='#' then
    if b[i,j]<>'#' then
     begin
      writeln ('NO');
      halt;
     end;

 writeln ('YES');

  end.

program _1061B;

var n, m, i, j: integer;
    s: String;
    g: boolean;
    nm : array[1..1000, 1..1000] of char;
    nm2 : array[1..1000, 1..1000] of boolean;

begin
  readln(n, m);
  g := true;
  for i := 1 to n do
    begin
      readln(s);
      for j := 1 to m do
        nm[i, j] := s[j];
    end;

  for i := 2 to n-1 do
    for j := 2 to m-1 do
      begin
        if (nm[i-1, j] = '#') and (nm[i-1, j-1] = '#') and (nm[i-1, j+1] = '#') and (nm[i+1, j+1] = '#') and (nm[i+1, j-1] = '#') and (nm[i+1, j] = '#') and (nm[i, j-1] = '#') and (nm[i, j+1] = '#') then begin
          nm2[i-1, j] := true;
          nm2[i-1, j-1] := true;
          nm2[i-1, j+1] := true;
          nm2[i+1, j+1] := true;
          nm2[i+1, j-1] := true;
          nm2[i+1, j] := true;
          nm2[i, j-1] := true;
          nm2[i, j+1] := true;
        end;
      end;

  for i := 1 to n do
    for j := 1 to m do
      if (nm[i, j] = '#') and (nm2[i, j] <> true) then g := false;

  if g = true then
    write('YES')
  else
    write('NO');
end.

program p;
var n, m: integer;
    a, b: array [-5..1005, -5..1005] of boolean;
    ch: char;

begin
readln(n, m);
for var g:=1 to n do
  begin
  for var g1:=1 to m do
    begin
    read(ch);
    if ch='#' then a[g, g1]:=true
    end;
  readln
  end;

for var g:=2 to n-1 do
  for var g1:=2 to m-1 do
    if a[g-1, g1] and a[g-1, g1+1] and a[g-1, g1-1] and
        a[g+1, g1] and a[g+1, g1+1] and a[g+1, g1-1] and
        a[g, g1+1] and a[g, g1-1] then
    begin
    for var g2:=g1-1 to g1+1 do
      begin
      b[g+1, g2]:=true;
      b[g-1, g2]:=true
      end;
    b[g, g1-1]:=true;
    b[g, g1+1]:=true
    end;
if a=b then write('yes')
  else write('no')
end.

                   const eps=0.000000001;  besk1=200000008;  nnn=4600000;
             { modul=1000000007;  }
             modul=998244353;
   besk=4000000000000000000;
   label 22,1,2,3,4;
    type    real=extended;   double=extended;
    mas=array [-100000..nnn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nnn] of longint;mass1=^mass;
    var nn,t3,t4,t5,t6,posmax,tmax,kold,kk,d,n,j2,ttt,ppp,kol,sq,sum,h,pmin,pmax,limit,posi,posj,diam,oldt,ot1,time,pos,prod,ll,rr,posx,posy,gr,dloch,newdl,oldn,oldm,ost,ot,aa,bb,cc,p1,p2,p3,p4,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,x0,p0,t2,t1,jj,w,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,t,nm,m,smin,cen:int64;
   i2,i3,step2,k1,k2,pp0,mask,k,i1,j1,step1, step, i,j:longint;
   y:mas;
   x,z:array[-1..15000012] of int64;
    prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    iii,oldpos,finot,vv,znak:int64;
    aold:mas;
    alpha,phi:extended;
    zzan:array[-1..2000,-1..2000] of boolean;
    sumkonfig,konfig:array[-1000..200000,-1..10] of int64;
    xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;
    del:array[-1..100001,-1..150] of longint;
    z0,num,x1,y1,z1,z2,kolnul,a,fact,next,prev,xx,yy,str,s,name,dnew, voltay,l,r,c,day,b:mas;
    zz:array[0..125000000] of byte;
    ppole:array[-10..1002,-10..1005] of char;
    pole,ddd,dd2,dd3,dd4:array[-10..4200,-10..1020] of char;
    dd,ddnew:array[-1..1200,-1..2100] of int64;
   newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;
    sss1,sss2:string;
    def,left,right,stepen,koled,dl,och,newoch,place,newnabor,stoim,nabor:array[-10..200005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
    ss1,ss2,ss:string;ch,ch1,ch2:char;
    pr,hesh,numright,dr: array [-10..1060,-10..1060] of extended;
    s3,s2,s1:array[-100..500000] of string;

    grr :array [-10..2010,-10..2010] of boolean;
    maxpr:array[0..nnn] of string;
    sss:array[-10..nnn] of string;
     tx,ty,vel,ott,v0,v1,s0,t0:int64;
     zv:point;
     ugol,rot,temp,sumtemp,vol,newx,newy:array[-1000..400000] of int64;
     mash,sqx,sqy,ottt,aaa,bbb,ccc:extended;
     xxx,yyy,yot:double;
       flag2,flag,flag1:boolean;

  function max(a,b:int64):int64;
begin max:=a; if b>a then max:=b;   end;

  function min(a,b:int64):int64;
begin min:=a; if b<a then min:=b;   end;

procedure udal(p:longint);
begin  next[prev[p]]:=next[p]; prev[next[p]]:=prev[p]; end;

      function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

     function summ(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p2+xx.p2*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=t1 div tt mod modul;
    t2:=t2 div tt mod modul;
    ott.p1:=t1; ott.p2:=t2;

   summ:=@ott;
 end;

{     function prod(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=(t1 div tt) mod modul;
    t2:=(t2 div tt) mod modul;
    ott.p1:=t1; ott.p2:=t2;

   prod:=@ott;
 end;
 }

    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p{/pi*180};
 end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k shr 1); degg:=p*p mod modul;   end;

end;

{function prost(tt:longint):boolean;
var aa:extended; i,p,t:longint;  fl:boolean;
 begin
   fl:=true;
   aa:=tt;
   aa:=sqrt(aa);
   t:=round(aa);
   for i:=2 to t do if tt mod i=0 then fl:=false;

   prost:=fl;
 end;
 }
function arcsin(pp:extended):extended;
var tt:extended;
begin
   if (abs(pp)<=1+eps)and (abs(pp)>=1-eps)
   then if pp>0 then arcsin:=pi/2 else arcsin:=-pi/2;
   tt:=1-pp*pp;
   if abs(tt)>=0 then
     begin
        arcsin:=arctan(pp/sqrt(tt));

     end;

end;

function gl(ch:char):boolean;
begin
 if (ch='o')or (ch='a')or(ch='e')or(ch='u')or(ch='i') then gl:=true else gl:=false;

end;

function zaprmax(left,right:longint):int64;
begin
   if left>=right then zaprmax:=y[left] else
     begin
        if not odd(left) and odd(right) then zaprmax:=zaprmax(left shr 1,right shr 1) else
         begin
          if odd(left) then zaprmax:=max(zaprmax(left+1,right),y[left]);
          if not odd(right) then zaprmax:=max(zaprmax(left,right-1),y[right]);

         end;

     end;

end;

 function ff(gr:int64):boolean;

var ot,aa,bb,cc:int64; fl:boolean;
begin
  aa:=1; bb:=m;  cc:=aa; fl:=false;
  while abs(aa-bb)>1 do
    begin
       cc:=(aa+bb) shr 1;
       if y[cc]<gr then aa:=cc else bb:=cc;

    end;
  { writeln(' cc= ',cc);
  } cc:=min(cc+3,m+1);
   repeat dec(cc) until y[cc]<=gr;
   if y[cc]=gr then fl:=true else fl:=false;
  ff:=fl;
end;

function f1(p:int64):int64;
begin
    if p>=x[n] then f1:=n else f1:=xx[p];
    if p=0 then f1:=0;

end;

function f2(p:int64):int64;
begin
  if p>=y[m] then f2:=m else f2:=yy[p];
  if p=0 then f2:=0;
end;

begin
  {  assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
   }
         readln(n,m);
          for i:=1 to n do begin for j:=1 to m do read(pole[i,j]); readln;  end;
        for i:=1 to n do for j:=1 to m do
          begin
             if pole[i+1,j]='#' then inc(dd[i,j]);
             if pole[i-1,j]='#' then inc(dd[i,j]);
             if pole[i,j+1]='#' then inc(dd[i,j]);
             if pole[i,j-1]='#' then inc(dd[i,j]);
             if pole[i+1,j+1]='#' then inc(dd[i,j]);
             if pole[i-1,j+1]='#' then inc(dd[i,j]);
             if pole[i+1,j-1]='#' then inc(dd[i,j]);
             if pole[i-1,j-1]='#' then inc(dd[i,j]);
          end;

{ for i:=1 to n do begin for j:=1 to m do write(dd[i,j],' '); writeln;  end;
 }
     for i:=1 to n do for j:=1 to m do ppole[i,j]:='.';

      for i:=1 to n do for j:=1 to m do if dd[i,j]=8 then
        begin
           ppole[i+1,j]:='#';
           ppole[i-1,j]:='#';
           ppole[i,j+1]:='#';
           ppole[i,j-1]:='#';
           ppole[i+1,j+1]:='#';
           ppole[i-1,j+1]:='#';
           ppole[i+1,j-1]:='#';
           ppole[i-1,j-1]:='#';

        end;

     {  for i:=1 to n do begin for j:=1 to m do write(ppole[i,j]); writeln;  end;
      }
       flag:=true;
       for i:=1 to n do for j:=1 to m do if pole[i,j]<>ppole[i,j] then flag:=false;

        if flag then write('YES') else write('NO');

1:             close(output);
end.

var n, m, i, j, k, h: longint;
    a, b: array[1..1000, 1..1000] of char;
    ck: boolean;
    tmp: string;
begin
    read(n, m);
    for i := 1 to n do
        for j := 1 to m do b[i, j] := '.';
    readln;
    for i := 1 to n do
    begin
        read(tmp);
        readln;
        for j := 1 to m do
        begin
            a[i, j] := tmp[j];
        end;
    end;
    for i := 1 to n do
        for j := 1 to m do
        begin
            if(i + 2 <= n) and (j + 2 <= m) then
                if(a[i, j] = '#') and (a[i, j + 1] = '#') and (a[i, j + 2] = '#') and (a[i + 1, j] = '#') and (a[i + 1, j + 2] = '#') and (a[i + 2, j] = '#') and (a[i + 2, j + 1] = '#') and (a[i + 2, j + 2] = '#') then
                begin
                    for k := i to i + 2 do
                    begin
                        for h := j to j + 2 do if(h <> j + 1) or (k <> i + 1) then b[k, h] := '#';
                    end;
                    if b[i + 1, j + 1] <> '#' then b[i + 1, j + 1] := '.';
                end;
        end;
    for i := 1 to n do
        for j := 1 to m do
            if a[i, j] <> b[i, j] then ck := true;
    if ck = true then write('NO')
    else write('YES');
end.

var n,m,i,j:longint;
a,f:array[0..1000,0..1000]of char;
begin
//assign(input,'wz.in');reset(input);
//assign(output,'wz.out');rewrite(output);
readln(n,m);
for i:=1 to n do
  begin
  for j:=1 to m do read(a[i,j]);
  readln;
  end;
fillchar(f,sizeof(f),'.');
for i:=2 to n-1 do
  for j:=2 to m-1 do
    if(a[i-1,j]='#')and(a[i+1,j]='#')and(a[i,j-1]='#')and(a[i,j+1]='#')and(a[i-1,j-1]='#')and(a[i+1,j+1]='#')and(a[i+1,j-1]='#')and(a[i-1,j+1]='#')then
      begin
      f[i-1,j]:='#';f[i+1,j]:='#';f[i-1,j-1]:='#';f[i-1,j+1]:='#';
      f[i,j-1]:='#';f[i,j+1]:='#';f[i+1,j-1]:='#';f[i+1,j+1]:='#';
      end;
for i:=1 to n do
  for j:=1 to m do
    if a[i,j]<>f[i,j] then
      begin
      writeln('NO');close(input);close(output);halt;
      end;
writeln('YES');
close(input);close(output);
end.

var a:array[-10..1010,-10..1010] of char;
f:array[-10..1010,-10..1010] of boolean;
i,j,n,m:longint;
begin
//assign(input,'wz.in');reset(input);
//assign(output,'wz.out');rewrite(output);
readln(n,m);
for i:=1 to n do
  begin
  for j:=1 to m do
    read(a[i,j]);
  readln;
  end;
for i:=1 to n do
  for j:=1 to m do
    if (a[i-1,j]='#')and(a[i-1,j-1]='#')and(a[i-1,j+1]='#')and
    (a[i,j-1]='#')and(a[i,j+1]='#')and
    (a[i+1,j]='#')and(a[i+1,j-1]='#')and(a[i+1,j+1]='#') then
      begin
      f[i-1,j]:=true;f[i-1,j-1]:=true;f[i-1,j+1]:=true;
      f[i+1,j]:=true;f[i+1,j-1]:=true;f[i+1,j+1]:=true;
      f[i,j-1]:=true;f[i,j+1]:=true;
      end;
for i:=1 to n do
  for j:=1 to m do
    if (a[i,j]='#') and (f[i,j]=false) then
      begin
      writeln('NO');
      close(input);close(output);
      halt;
      end;
writeln('YES');
close(input);close(output);
end.

var n, m, i, j, k, h: longint;
    a, b: array[1..1000, 1..1000] of char;
    ck: boolean;
    tmp: string;
begin
    read(n, m);
    for i := 1 to n do
        for j := 1 to m do b[i, j] := '.';
    readln;
    for i := 1 to n do
    begin
        read(tmp);
        readln;
        for j := 1 to m do
        begin
            a[i, j] := tmp[j];
        end;
    end;
    for i := 1 to n do
        for j := 1 to m do
        begin
            if(i + 2 <= n) and (j + 2 <= m) then
                if(a[i, j] = '#') and (a[i, j + 1] = '#') and (a[i, j + 2] = '#') and (a[i + 1, j] = '#') and (a[i + 1, j + 2] = '#') and (a[i + 2, j] = '#') and (a[i + 2, j + 1] = '#') and (a[i + 2, j + 2] = '#') then
                begin
                    for k := i to i + 2 do
                    begin
                        for h := j to j + 2 do if(h <> j + 1) or (k <> i + 1) then b[k, h] := '#';
                    end;
                    if b[i + 1, j + 1] <> '#' then b[i + 1, j + 1] := '.';
                end;
        end;
    for i := 1 to n do
        begin
        for j := 1 to m do write(b[i, j]);
        writeln;
        end;
    for i := 1 to n do
        for j := 1 to m do
            if a[i, j] <> b[i, j] then ck := true;
    if ck = true then write('NO')
    else write('YES');
end.

var n,m,i,j:longint;
f,f1:boolean;
a:array[0..10001,0..10001] of char;
begin
//assign(input,'wz.in');reset(input);
//assign(output,'wz.out');rewrite(output);
readln(n,m);
for i:=1 to n do
  begin
  for j:=1 to m do
    read(a[i,j]);
  readln;
  end;
for i:=2 to n-1 do
  for j:=2 to m-1 do
    if a[i,j]='.' then
      begin
      f1:=true;f:=true;
      if a[i-1,j]='.' then f:=false;
      if a[i+1,j]='.' then f:=false;
      if a[i,j-1]='.' then f:=false;
      if a[i,j+1]='.' then f:=false;
      if a[i-1,j-1]='.' then f:=false;
      if a[i-1,j+1]='.' then f:=false;
      if a[i+1,j-1]='.' then f:=false;
      if a[i+1,j+1]='.' then f:=false;
      if f=false then
        begin
        writeln('NO');
        close(input);close(output);halt;
        end;
      end;
if (f1=false)and(n=3)and(n=3) then
  writeln('NO')
else
  writeln('YES');
close(input);close(output);
end.

var n,m,i,j,x,y,o,k:longint;f:boolean;
b:array[-500..500,-500..500]of longint;
a:array[-500..500,-500..500]of char;
begin
//assign(input,'zj.in');reset(input);
//assign(output,'zj.out');rewrite(output);
readln(n,m);
for i:=1 to n do
  begin
  for j:=1 to n do read(a[i,j]);
  readln;
  end;
for i:=1 to n do
  for j:=1 to n do
    if a[i,j]='.' then
      begin
      f:=true;
      for k:=i-1 downto i-m+1 do
        if a[k,j]<>'.' then f:=false;
      if f then
        for k:=i downto i-m+1 do inc(b[k,j]);
      f:=true;
      for k:=i+1 to i+m-1 do
        if a[k,j]<>'.' then f:=false;
      if f then
        for k:=i to i+m-1 do inc(b[k,j]);
      f:=true;
      for k:=j-1 downto j-m+1 do
        if a[i,k]<>'.' then f:=false;
      if f then
        for k:=j downto j-m+1 do inc(b[i,k]);
      f:=true;
      for k:=j+1 to j+m-1 do
        if a[i,k]<>'.' then f:=false;
      if f then
        for k:=j to j+m-1 do inc(b[i,k]);
      end;
x:=1;y:=1;
for i:=1 to n do
  for j:=1 to n do
    if b[i,j]>o then
      begin
      o:=b[i,j];
      x:=i;y:=j;
      end;
write(x,' ',y);
close(input);close(output);
end.

var n,m,i,j,s:longint;
a:array[-5..10001,-5..10001]of char;
begin
///assign(input,'wz.in');reset(input);
//assign(output,'wz.out');rewrite(output);
readln(n,m);
fillchar(a,sizeof(a),'.');
for I:=1 to n do
  begin
  for j:=1 to m do read(a[i,j]);
  readln;
  end;
for I:=1 to n do
  for j:=1 to m do
    if a[i,j]='#' then
      begin
      if(a[i+1,j+1]<>'.')and(n=3)and(m=3)and(i=1)and(j=1)then
        begin
        write('NO');
        close(input);close(output);halt;
        end;
      if(i<n-1)and(j<m-1)then
        if(a[i+1,j+1]='.')and(a[i+1,j-3]='.')then
          begin
          write('NO');
          close(input);close(output);halt;
          end;
      s:=0;
      if a[i+1,j]='.' then inc(s);
      if a[i-1,j]='.' then inc(s);
      if a[i,j-1]='.' then inc(s);
      if a[i,j+1]='.' then inc(s);
      if s>=3 then
        begin
        write('NO');
        close(input);close(output);halt;
        end;
      end;
write('YES');
close(input);close(output);
end.

var n,m,i,j:longint;f,f1:boolean;
a:array[0..1001,0..1001] of char;
begin
//assign(input,'wz.in');reset(input);
//assign(output,'wz.out');rewrite(output);
readln(n,m);
for i:=1 to n do
  begin
  for j:=1 to m do
    read(a[i,j]);
  readln;
  end;
f:=true;
for i:=2 to n-1 do
  for j:=2 to m-1 do
    if a[i,j]='.' then
      begin
      f1:=true;
      if a[i-1,j]='.' then f:=false;
      if a[i+1,j]='.' then f:=false;
      if a[i,j-1]='.' then f:=false;
      if a[i,j+1]='.' then f:=false;
      if a[i-1,j-1]='.' then f:=false;
      if a[i-1,j+1]='.' then f:=false;
      if a[i+1,j-1]='.' then f:=false;
      if a[i+1,j+1]='.' then f:=false;
      if f=false then
        begin
        writeln('NO');
        close(input);close(output);halt;
        end;
      end;
if (f)and(f1)or(f1=false)and((n<>3)or(m<>3)) then writeln('YES')
else writeln('NO');
close(input);close(output);
end.

type mass=array[1..1000,1..1000]of char;
var
   a,b:mass; f:boolean;
   i,j,k,l,n,m:integer;
begin
   readln(n,m);
   for i:=1 to n do
    begin
        for j:=1 to m do
        begin
            read(a[i,j]);
            b[i,j]:='.'
        end;
        readln;
    end;
   for i:=1 to n-2 do
    for j:=1 to m-2 do
    begin
     for k:=0 to 2 do
      for l:=0 to 2 do
       begin
          if (k<>l)
          then  b[i+k,j+l]:='#'
          else if (k<>1) and (l<>1)
               then b[i+k,j+l]:='#';
       end;
     end;
   f:=true;
   for i:=1 to n do
   begin
    for j:=1 to m do
     if (a[i,j]='#') and (b[i,j]<>'#')
     then f:=false
   end;
   if f
   then writeln('YES')
   else writeln('NO')
end.

type mass=array[1..1000,1..1000]of char;
var
   a,b:mass; f:boolean;
   i,j,k,l,n,m:integer;
begin
   readln(n,m);
   for i:=1 to n do
    begin
        for j:=1 to m do
        begin
            read(a[i,j]);
            b[i,j]:='.'
        end;
        readln;
    end;
   for i:=1 to n-2 do
    for j:=1 to m-2 do
    begin
     for k:=0 to 2 do
      for l:=0 to 2 do
       begin
          if (k<>l)
          then  b[i+k,j+l]:='#'
          else if (k<>1) and (l<>1)
               then b[i+k,j+l]:='#';
       end;
     end;
   f:=true;
   for i:=1 to n do
   begin
    for j:=1 to m do
     if (a[i,j]='#')
     then if (b[i,j]<>'#')
          then f:=false
   end;
   if f
   then writeln('YES')
   else writeln('NO')
end.

type mass=array[1..1000,1..1000]of char;
var
   a,b:mass;
   i,j,n,m:integer;
begin
   readln(n,m);
   for i:=1 to n do
    begin
        for j:=1 to m do
        begin
            read(a[i,j]);
            b[i,j]:='.'
        end;
        readln;
    end;
end.


uses math;
var
 i,j,k,n,m,s:longint;
 h1,h2,a,b:longint;
dh:longint;
begin
 readln(h1,h2);
 readln(a,b);
 k:=0;
 dh:=h2-h1;
 if dh<=8*a then writeln(0)
 else begin
 dh:=dh-8*a+2*b;
 if (a>=b) then
 while (dh>0)and(k<100000) do begin
    dh:=dh+10*b-12*a;
    if (dh<=0) then begin
        writeln(k+1);
        dh:=-24*b;
    end;
    dh:=dh+2*b;
    k:=k+1;
 end;
 if dh>0 then writeln(-1);
 end;
 //
end.

program z1;
var k,h1,h2,a,b:longint;
begin
readln(h1,h2,a,b);
if ((h1+a*8)<h2) and (a<=b) then k:=-1 else
if h1+a*8>=h2 then k:=0 else
begin
h1:=h1+a*8;
while h1<h2 do begin
h1:=h1+a*12-b*12;
k:=k+1; end;

end;
writeln(k); end.

var
  h1, h2, a, b, k, hour, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a <=b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;

  hev := 8 * a + h1;
  if hev>=h2 then begin
  write('0');
  Halt;
  end;
  hour := a-b;
  for k := 1 to 10000001 do
    if hev + 12*k*hour >= h2 then begin
      write(k);
      Halt;
    end;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type arr=array[1..1000000] of longint;
arr1=array[1..100,1..100] of longint;
var mas:arr;
s:string;
c:char;
i,j,m,n,k,x,d,q,res,h1,h2:longint;
begin
 read(h1,h2);
 read(d,n);
 k:=0;
 if (n>=d) and ((h1+d*8)<h2) then
 begin
  writeln(-1);
  halt;
 end;
 if h1+d*8>=h2 then writeln(0) else
 begin
  h1:=h1+d*8;
  while h1<h2 do
  begin
   h1:=h1+d*12-n*12;
   inc(k);
  end;
   writeln(k);
 end;
end.

Const Finp='';
      Fout='';
Var h1,h2,a,b:longint;

Procedure Nhap;
Var f:Text;
Begin
    assign(f,finp); reset(f);
    readln(f,h1,h2);
    read(f,a,b);
    close(f);
End;
Function Solve:longint;
Var res,temp:longint;
Begin
    if h1+8*a>=h2 then
        exit(0);
    if (h1+8*a<h2) and (a<=b) then
        exit(-1);
    res:=(h2-h1-8*a) div (12*(a-b));
    if (h2-h1-8*a) mod (12*(a-b))<>0 then
        res:=res+1;
    solve:=res;
End;
Procedure Xuat;
Var f:Text;
Begin
    assign(f,fout); rewrite(f);
    write(f,solve);
    close(f);
End;

Begin
    nhap;
    xuat;
End.

var  h1,h2,a,b,ans:longint;
begin
    readln(h1,h2);
    readln(a,b);
    inc(h1,8*a);
    if h1>=h2 then begin
        writeln(0);
        halt;
    end;
    if (h1<h2)and(a<=b)then begin
        writeln(-1);
        halt;
    end;
    repeat
        dec(h1,12*b) ;
         inc(ans);
         inc(h1,12*a);
         if h1>=h2 then begin
             writeln(ans);
             halt;
         end;
    until false;
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if (l=r) or ((8*a)+l>=r) then
begin
    writeln(0);
    exit;
end;
if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end;
i:=l;
res:=0;
inc(i,A*8);
while i<r do
begin
    inc(i,12*a);
    dec(i,12*b);
    if res>1000000 then
    begin
        writeln('-1');
        exit;
    end;
    inc(res);
end;
writeln(res);
end.

var
  a, b, c, d, e, f: int64;

begin
  readln(a, b);
  readln(c, d);
  f := 0;
  e := a + 8 * c;
  if (e < b) and (c <= d) then writeln(-1)
  else begin
    while e < b do
    begin
      dec(e, 12 * d);
      inc(e, 12 * c);
      inc(f);
    end;
    writeln(f);
  end;
end.

var h1,h2,a,b,cur:integer;
begin
  readln(h1,h2);
  readln(a,b);
  cur:=h1+8*a;
  if h2<=cur then
  begin
    writeln(0);
    exit;
  end;
  if (b>=a) then
  begin
    writeln(-1);
    exit;
  end
  else
  if ((h2-cur) mod (a*12-b*12))=0 then writeln ((h2-cur) div (a*12-b*12)) else
  writeln(((h2-cur) div (a*12-b*12)) +1);
end.

Var a,b,n,m,x,o,l,t,day,pr:LongInt;
  Begin
    Read(n,m,a,b);
    t:=14;
    While n<m do
      Begin
        x:=22-t;
        n:=n+x*a;
        if n>=m then Break;
        n:=n-12*b;
        if a<=b then begin write(-1); halt end;
        Inc(day);
        t:=10;
      end;
    Write(day);
  end.

const fin='';
      fout='';
var a,b,s,t:longint;
    f,g:text;
procedure solve;
var i,swt,d:longint;
begin
    d:=1;
    while s<t do
    begin
        s:=s+(a-b)*12;
        if s>=t then write(g,d);
        inc(d);
    end;
end;
begin
    assign(f,fin);reset(f);
    assign(g,fout);rewrite(g);
    readln(f,s,t);readln(f,a,b);
    s:=s+a*8;
    if s>=t then write(g,0)
    else if a>b then solve
         else write(g,-1);
    close(f);close(g);
end.

program z1;
var a,b,c,d,i,j,k,l,m,n,h1,h2,v,t,h3,vd:longint;
begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(h1,h2);
readln(a,b);
v:=a-b; vd:=v*12;
if h1+(a*8)>=h2 then begin write(0); exit; end;
if v<=0 then begin write(-1);  exit; end;
h1:=h1+a*8;
for t:=1 to 1000000 do
 begin
 h1:=h1-b*12+a*12; if h1>=h2 then begin write(t); exit; end;
 end;
end.

Program _1;
Var
   h1,h2,n,d,k,p:longint;
Begin
   {assign(input,'input.txt');
   assign(output,'output.txt');
   reset(input);
   rewrite(output);}
   read(h1,h2);
   read(d,n);
   k:=h1+d*8;
   if k>=h2 then begin
                 write('0');
                 exit;
                 end
    else if d<=n then begin
                      write('-1');
                      exit;
                      end;
   p:=-1*n*12+d*12;
   h1:=k;
   k:=0;
   while h1<h2 do begin
                  h1:=h1+p;
                  inc(k);
                  end;
   write(k);
   {close(input);
   close(output);}
End.

var a, b, s, f, t:integer;
begin
readln(s, f);
readln(a, b);
if s + a * 8 >= f then begin write('0'); exit; end;
if b >= a then begin write('-1'); exit; end;
t:=14;
while s < f do
  if (t mod 24 >= 10) and (t mod 24 < 22) then
    begin
    t:=t + 1;
    s:=s + a;
    end
  else
    begin
    t:=t + 1;
    s:=s - b;
    end;
write(t div 24);
end.

Var h,h1,a,b,k:longint;

 Begin
  read(h,h1);
  read(a,b);

  if h+a*8<h1
    then if a<=b
           then begin
                 write(-1);
                 halt
                end
           else begin
                 k:=0;

                 h:=h+a*8;

                 while h<h1 do
                  begin
                   dec(h, b*12);
                   inc(k);
                   inc(h, a*12);
                  end;

                 write(k);
                end
    else write(0);

 end.

Var a,b,c,h1,h2,s1,s2,ans:int64;
 begin
  read(h1,h2,s1,s2);
   h1:=h1+8*s1;
   if (h1>=h2) then begin
                     write(0);
                     halt;
                    end;
   if s2>=s1 then begin
                     write(-1);
                     halt;
                     end;
   a:=12*s1-12*s2;
   b:=h2-h1;
   if b mod a=0 then write(b div a)
   else write(b div a+1);

   end.

program fg;
var h1,h2,a,k,b:integer;
begin
read(h1); readln(h2);
read(a); readln(b);
if h1+a*8>=h2 then k:=0
else
    if (a<=b) then  k:=-1
          else begin
          h1:=h1+8*a;k:=0;
          while h1<h2 do begin
          k:=k+1;
          h1:=h1-12*b+12*a;
          end;
          end;
write(k);

end.

uses math;
var
 i,j,k,n,m,s:longint;
 h1,h2,a,b:longint;
dh:longint;
begin
 readln(h1,h2);
 readln(a,b);
 k:=0;
 dh:=h2-h1;
 if dh<=8*a then writeln(0)
 else begin
 dh:=dh-8*a+2*b;
 if (a>=b) then
 while (dh>0)and(k<100000) do begin
    dh:=dh+10*b-12*a;
    if (dh<=0) then begin
        writeln(k+1);
        dh:=-24*b;
    end;
    dh:=dh+2*b;
    k:=k+1;
 end;
 if dh>0 then writeln(-1);
 end;

end.

const inf = 500000;
var i,j,k,n,m,s,ans,h1,h2,sth,a,b:longint;

procedure ex(k:longint);
begin
  write(k);
  halt;
end;

begin
   read(sth,h2,k,b);
   h1:=sth;
   k:=k*4;
   b:=b*12;

   if h1 >= h2 then ex(0);

   inc(h1,2*k);
   if h1 >= h2 then ex(0);
   dec(h1,b);

   while h1 < h2 do
   begin
      inc(h1,k);

      inc(ans);
      if (h1 <= sth) and (ans > 10) then ex(-1);

      if h1 >= h2 then break;
      inc(h1,k*2);
      if h1 >= h2 then break;

      dec(h1,b);
   end;

   writeln(ans);

end.

program fdf;
var h1,h2,a,b,n,k:longint;
begin
read(h1,h2);
read(a,b);
if (a<=b)then
   if (h1+a*8>=h2) then write('0')
   else write('-1')
else
    begin
    if (h2<=h1+a*8) then write('0')
    else
    begin
    n:=h2-h1-8*a;
    if (n<=0) then write ('1')
    else
        repeat
        n:=n-12*a+12*b;
        k:=1+k;
        until (n<=0);
    write(k);
    end;
    end;
end.

var h1,h2,a,b,k:integer;
begin
readln(h1,h2);
readln(a,b);
k:=0;
if (a>b) or (a*8+h1>=h2) then begin
h1:=a*8+h1;
while h1<h2 do begin
k:=k+1;
h1:=(a-b)*12+h1;
if h1<0 then h1:=0;
end;
writeln(k);
end
else writeln(-1);
end.

var h1, h2: longint;
    a, b: longint;
    x, y, z, g: longint;

begin
  readln(h1, h2);
  readln(a, b);

  if (a <= b)and(h2 - h1 > a * 8)
    then
      writeln(-1)
    else
      begin
        x := h1 + a * 8;
        a := a * 12;
        b := b * 12;
        if x >= h2
          then
            writeln(0)
          else
            if not(trunc((h2 - x) / (a - b)) < (h2 - x) / (a - b))
              then
                writeln((h2 - x) div (a - b))
              else
                writeln(((h2 - x) div (a - b)) + 1)
      end;
end.

program pr1;
var h1,h2,a,b,k,i:integer;
begin
read(h1,h2);
read(a,b);
i:=0;
k:=h2-h1-8*a;
if ((k>0) and (a<=b)) then
i:=-1
else
if (k>0) then
  while (k>0) do
    begin
    k:=k+12*b-12*a;
    i:=i+1;
    end;
write(i);
end.

var i, n, m, k, l, o, p, ans, h1, h2, a, b, ans1:LongInt;
 Begin
  Read(h1, h2);
  Read(a, b);

    Inc(h1, a*8);
    if (h1>= h2) then Begin WriteLn(0);Halt;End;
     if a<b then Begin WriteLn(-1);Halt;End;
    Dec(h1, b*2);
 while h1<h2 do
   Begin
     Dec(h1, b*10);
     Inc(h1, a*12);
     Inc(ans);
     if h1>=h2 then Begin WriteLn(ans);Halt;End;
     if (a=b) then Begin  WriteLn(-1);Halt;End;
     Dec(h1, b*2);

   End;

 End.

var
h1,h2,a,b:integer;
begin
readln(h1,h2);
readln(a,b);
if h1+8*a>=h2
then writeln(0)
else if a<=b
     then writeln(-1)
     else if ((h2-h1-8*a) mod (12*(a-b))=0)
          then writeln((h2-h1-8*a) div (12*(a-b)))
          else writeln((h2-h1-8*a) div (12*(a-b))+1);
end.

var h1,h2,a,b,k:integer;
begin
  read(h1,h2,a,b);
  k:=0;
  if (b >= a) and (h2 > h1 + 8*a) then write(-1) else begin
    while h1<h2 do begin
      h1:=h1+8*a;
      if h1 >= h2 then begin write(k); exit; end;
      h1:=h1 - 12* b + 4* a;
      inc(k);
    end;
    write(k);
  end;

end.

var h1,h2,a,b,k:integer;
begin
  read(h1,h2,a,b);
  h1:=h1+8*a;
  if h1>=h2 then write(0)
  else
  if a<=b then write(-1)
  else
  write((h2-h1+12*a-12*b-1)div(12*a-12*b))
end.

      {$APPTYPE CONSOLE}
const nn=3; besk=2000000000000000000;
   nnn=2000000;  eps=1e-11; modul=1000000007;
 type matr=array[1..3,1..3] of extended;
   mat=^matr;
 label 1,2,3,4;

var i2,j2,aa,bb,i1,j1,k,step,kt,ppp,god,day,mon,mask,i0,j0,i,j,start,finish:longint;
qq,newdl,dloch,kol,shag,m,t,ii,jj,l,r,p,p3,pos,ll,pp,tt,ot1,ot2,s,kold,n:int64;
def,xx,cc,q,t1,t2,p4,p1,p2,ot,dist1,vt,zap,ba,by,ay,kk,centr,koef:int64;
flag2,flag1,flag:boolean;
ch1,ch2,ch:char;
str:array[-10..12000] of matr;
prob,ccc1,v,rr,h1,h2,h,r1,r2,aaa,bbb,ccc,hh,po,pt,doltek,dolpred:extended;
b1,a1,next,prev,x1,x2,y1,y2,d,och,newoch,f,x,y,fact,c,b,a,prost:array[-200000..1100000] of int64;
oldzan,oldmarked,zan: array[0..330006] of boolean;
gr:array[-1..1001,-1..1001] of boolean;
agor,aver,ssumgor,ssumver,sgor,sver,udd,dostl,dostr: array[-100..600,-100..600] of int64;
det,ott :double;
d3,d1,d2,dist,edin:matr;
ss,ss1,ss2:string;
dd:array[-21..2001,-2001..2001] of int64;
marked,dost,newdost:array[-10..700000] of boolean;
ssnew:array[-10..1000000] of char;
pole:array[-10..610,-10..600] of char;
name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

 function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

function degg(p,deg:int64):int64; var pp,q:int64;
 begin if deg=0 then degg:=1 else begin   if odd(deg) then degg:=(degg(p,deg-1)*p) mod modul else
 begin q:=(degg(p,deg shr 1)) mod modul; degg:=(q*q) mod modul;   end; end;   end;

begin
 { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
  }
read(h1,h2);
read(t1,t2);
  for i:=0 to 1000000 do
    begin
       if i>0 then h1:=h1+12*t1 else h1:=h1+8*t1;
       if h1>=h2 then begin write(i); goto 1;   end;
       h1:=h1-12*t2;
    end;
      writeln(-1);

   1:          close(output);
end.

var
  h1, h2, a, b, k, hour, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a <=b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;
  hev := 8 * a + h1;
  hour := a-b;
  for k := 1 to 10000001 do
    if hev + 24*k*hour >= h2 then begin
      write(k);
      Halt;
    end;
end.

var
  h1, h2, a, b, k, day, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a < b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;
  hev := 8 * a + h1;
  day := 12 * a - 12 * b;
  for k := 1 to 100001 do
    if hev + k * day  >= h2 then begin
      write(k);
      Halt;
    end;
end.

var
  h1, h2, a, b, k, hour, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a <=b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;
  hev := 8 * a + h1;
  hour := a-b;
  for k := 1 to 10000001 do
    if hev + 12*k*hour >= h2 then begin
      write(k);
      Halt;
    end;
end.

var
  h1, h2, a, b, k, day, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a <=b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;
  hev := 8 * a + h1;
  day := 12 * a - 12 * b;
  for k := 1 to 10000001 do
    if hev + k * day  >= h2 then begin
      write(k);
      Halt;
    end;
end.

var
  h1, h2, a, b, k, hour, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a <=b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;
  hev := 8 * a + h1;
  hour := a-b;
  for k := 1 to 10000001 do
    if hev + 24*(k-1)*hour+8*a-12*b  >= h2 then begin
      write(k);
      Halt;
    end;
end.

var h1,h2,a,b,k,day,hev:integer;
begin
read(h1,h2);
readln;
read(a,b);
if (a<b) and (a+h1<h2) then begin
write('-1');
Halt;
end;
if (8*a+h1>=h2) and (a<=b) then begin
write('0');
Halt;
end;
hev:=8*a+h1;
day:=12*a-12*b;
for k:=1 to 100001 do if hev+k*day>=h2 then begin
write(k);
Halt;
end;
end.

var
  h1, h2, a, b, k, hour, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a <=b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;
  hev := 8 * a + h1;
  hour := a-b;
  for k := 1 to 10000001 do
    if hev + 24*(k-1)*hour+9*a-12*b  >= h2 then begin
      write(k);
      Halt;
    end;
end.

var
  h1, h2, a, b, k, hour, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a <=b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;
  hev := 8 * a + h1;
  hour := a-b;
  for k := 1 to 10000001 do
    if hev + 24*(k-1)*hour+9*a  >= h2 then begin
      write(k);
      Halt;
    end;
end.

var
  h1, h2, a, b, k, hour, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a <=b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;
  hev := 8 * a + h1;
  hour := a-b;
  for k := 1 to 10000001 do
    if hev + 24*(k-1)*hour+8*a  >= h2 then begin
      write(k);
      Halt;
    end;
end.

var h1,h2,a,b,k,day,hev:integer;
begin
read(h1,h2);
readln;
read(a,b);
if (a<b) and (8*a+h1<h2) then begin
write('-1');
Halt;
end;
if (8*a+h1>=h2) and (a<=b) then begin
write('0');
Halt;
end;
hev:=8*a+h1;
day:=12*a-12*b;
for k:=1 to 100001 do if hev+k*day-day+8*a>=h2 then begin
write(k);
Halt;
end;
end.

var
  h1, h2, a, b, k, day, hev: integer;

begin
  read(h1, h2);
  readln;
  read(a, b);
  if (a < b) and (8 * a + h1 < h2) then begin
    write('-1');
    Halt;
  end;
  if (8 * a + h1 >= h2) and (a <= b) then begin
    write('0');
    Halt;
  end;
  hev := 8 * a + h1;
  day := 12 * a - 12 * b;
  for k := 1 to 100001 do
    if hev + k * day - day  >= h2 then begin
      write(k);
      Halt;
    end;
end.

var h1,h2,a,b,k,day,hev:integer;
begin
read(h1,h2);
readln;
read(a,b);
if (a<b) and (8*a+h1<h2) then begin
write('-1');
Halt;
end;
if (8*a+h1>=h2) and (a<=b) then begin
write('0');
Halt;
end;
hev:=8*a+h1;
day:=12*a-12*b;
for k:=1 to 100001 do if hev+k*day>=h2 then begin
write(k);
Halt;
end;
end.

Const Finp='';
      Fout='';
Var h1,h2,a,b:longint;

Procedure Nhap;
Var f:Text;
Begin
    assign(f,finp); reset(f);
    readln(f,h1,h2);
    read(f,a,b);
    close(f);
End;
Function Solve:longint;
Var res,temp:longint;
Begin
    if h1>h2 then
        h2:=h1-h2
    else
        h2:=h2-h1;
    if a<b then
        exit(-1);
    if a=b then
        begin
            if h2<=12 then
                exit(0);
            exit(-1);
        end;
    if a<b then
        begin
            temp:=a;
            a:=b;
            b:=temp;
        end;
    a:=a*12; b:=b*12;
    res:=(h2-a) div (a-b);
    if (h2-a) mod (a-b)<>0 then
        inc(res);
    solve:=res;
End;
Procedure Xuat;
Var f:Text;
Begin
    assign(f,fout); rewrite(f);
    write(f,solve);
    close(f);
End;

Begin
    nhap;
    xuat;
End.

Const Finp='';
      Fout='';
Var h1,h2,a,b:longint;

Procedure Nhap;
Var f:Text;
Begin
    assign(f,finp); reset(f);
    readln(f,h1,h2);
    read(f,a,b);
    close(f);
End;
Function Solve:longint;
Var res,temp:longint;
Begin
    if h1+8*a>=h2 then
        exit(0);
    if (h1+8*a<h2) and (a<=b) then
        exit(-1);
    if h1>h2 then
        h2:=h1-h2
    else
        h2:=h2-h1;
    if a<b then
        begin
            temp:=a;
            a:=b;
            b:=temp;
        end;
    a:=a*12; b:=b*12;
    res:=(h2-a) div (a-b);
    if (h2-a) mod (a-b)<>0 then
        inc(res);
    solve:=res;
End;
Procedure Xuat;
Var f:Text;
Begin
    assign(f,fout); rewrite(f);
    write(f,solve);
    close(f);
End;

Begin
    nhap;
    xuat;
End.

Const Finp='';
      Fout='';
Var h1,h2,a,b:longint;

Procedure Nhap;
Var f:Text;
Begin
    assign(f,finp); reset(f);
    readln(f,h1,h2);
    read(f,a,b);
    close(f);
End;
Function Solve:longint;
Var res,temp:longint;
Begin
    if h1>h2 then
        h2:=h1-h2
    else
        h2:=h2-h1;
    if a<=b then
        begin
            if h2<=12 then
                exit(0);
            exit(-1);
        end;
    if a<b then
        begin
            temp:=a;
            a:=b;
            b:=temp;
        end;
    a:=a*12; b:=b*12;
    res:=(h2-a) div (a-b);
    if (h2-a) mod (a-b)<>0 then
        inc(res);
    solve:=res;
End;
Procedure Xuat;
Var f:Text;
Begin
    assign(f,fout); rewrite(f);
    write(f,solve);
    close(f);
End;

Begin
    nhap;
    xuat;
End.

Const Finp='';
      Fout='';
Var h1,h2,a,b:longint;

Procedure Nhap;
Var f:Text;
Begin
    assign(f,finp); reset(f);
    readln(f,h1,h2);
    read(f,a,b);
    close(f);
End;
Function Solve:longint;
Var res,temp:longint;
Begin
    if h1+8*a>=h2 then
        exit(0);
    if (h1+8*a<h2) and (a<=b) then
        exit(-1);
    res:=(h2-h1-8*a) div 12*(a-b);
    if (h2-h1-8*a) mod 12*(a-b)<>0 then
        res:=res+1;
    solve:=res;
End;
Procedure Xuat;
Var f:Text;
Begin
    assign(f,fout); rewrite(f);
    write(f,solve);
    close(f);
End;

Begin
    nhap;
    xuat;
End.

var  h1,h2,a,b,ans:longint;
begin
    readln(h1,h2);
    readln(a,b);
    inc(h1,8*a);
    if h1>=h2 then begin
        writeln(0);
        halt;
    end;
    if (h1<h2)and(a<=b)then begin
        writeln(-1);
        halt;
    end;
    repeat
        dec(h1,12*b) ;
        inc(ans);
        if h1<0 then h1:=0;
        inc(h1,12*a);
        if h1>=h2 then begin
            writeln(ans);
            halt;
        end;
    until false;
end.

var  h1,h2,a,b,ans:longint;
begin
    readln(h1,h2);
    readln(a,b);
    inc(h1,8*a);
    if h1>=h2 then begin
        writeln(0);
        halt;
    end;
    if (h1<h2)and(a<=b)then begin
        writeln(-1);
        halt;
    end;
    repeat
        dec(h1,12*b) ;
        if h1<0 then h1:=0;
        inc(h1,4*a);
        if h1>=h2 then begin
            writeln(ans);
            halt;
        end;
         inc(ans);
         inc(h1,8*a);
         if h1>=h2 then begin
             writeln(ans);
             halt;
         end;
    until false;
end.

var  h1,h2,a,b,ans:longint;
begin
    readln(h1,h2);
    readln(a,b);
    inc(h1,8*a);
    if h1>h2 then begin
        writeln(0);
        halt;
    end;
    if (h1<h2)and(a<=b)then begin
        writeln(-1);
        halt;
    end;
    repeat
        dec(h1,12*b) ;
        inc(ans);
        if h1<0 then h1:=0;
        inc(h1,12*a);
        if h1>h2 then begin
            writeln(ans);
            halt;
        end;
    until false;
end.

Var a,b,n,m,x,o,l,t,day,pr:LongInt;
  Begin
    Read(n,m,a,b);
    t:=14;
    While n<m do
      Begin
        x:=22-t;
        n:=n+x*a;
        if n>=m then Break;
        n:=n-12*b;
        if a<=b then begin write(-1); halt end;
        Inc(day);
        if n<0 then n:=0;
        t:=10;
      end;
    Write(day);

  end.

const fin='';
      fout='';
var a,b,s,t:longint;
    f,g:text;
procedure solve;
var i,swt,d:longint;
begin
    d:=1;
    while s<t do
    begin
        s:=s+(a-b)*12;
        if s>t then write(g,d);
        inc(d);
    end;
end;
begin
    assign(f,fin);reset(f);
    assign(g,fout);rewrite(g);
    readln(f,s,t);readln(f,a,b);
    s:=s+a*8;
    if s>=t then write(g,0)
    else if a>b then solve
         else write(g,-1);
    close(f);close(g);
end.

Var a,b,c,h1,h2,s1,s2,ans:int64;
 begin
  read(h1,h2,s1,s2);
   h1:=h1+8*s1;
   if (h1>=h2) then begin
                     write(0);
                     halt;
                    end;
   if s2>s1 then begin
                     write(-1);
                     halt;
                     end;
   ans:=1;
   a:=12*s1-12*s2;
   b:=h2-h1;
   if a>0 then ans:=ans+b div a
   else ans:=ans+b;
   write(ans);
 end.

Var a,b,c,h1,h2,s1,s2,ans:int64;
 begin
  read(h1,h2,s1,s2);
   h1:=h1+8*s1;
   if (h1>=h2) then begin
                     write(0);
                     halt;
                    end;
   if s2>s1 then begin
                     write(-1);
                     halt;
                     end;
   ans:=1;
   a:=12*s1-12*s2;
   b:=h2-h1;
   if a>0 then ans:=ans+b
   else ans:=-1;
   write(ans);
 end.

Var a,b,c,h1,h2,s1,s2,ans:int64;
 begin
  read(h1,h2,s1,s2);
   h1:=h1+8*s1;
   if (h1>=h2) then begin
                     write(0);
                     halt;
                    end;
   if s2>=s1 then begin
                     write(-1);
                     halt;
                     end;
   ans:=1;
   a:=12*s1-12*s2;
   b:=h2-h1;
    ans:=ans+b div a;
   write(ans);
 end.

Var a,b,c,h1,h2,s1,s2,ans:int64;
 begin
  read(h1,h2,s1,s2);
   h1:=h1+8*s1;
   if (h1>=h2) then begin
                     write(0);
                     halt;
                    end;
   if s2>s1 then begin
                     write(-1);
                     halt;
                     end;
   ans:=1;
   a:=12*s1-12*s2;
   b:=h2-h1;
   if a>0 then ans:=ans+b div a;
   write(ans);
 end.

Var a,b,c,h1,h2,s1,s2,ans:int64;
 begin
  read(h1,h2,s1,s2);
   h1:=h1+8*s1;
   if (h1>=h2) then begin
                     write(0);
                     halt;
                    end;
   if s2>s1 then begin
                     write(-1);
                     halt;
                     end;
   ans:=1;
   a:=12*s1-12*s2;
   b:=h2-h1;
   if a>0 then ans:=ans+b div a
   else ans:=-1;
   write(ans);
 end.

program fg;
var h1,h2,a,k,b:integer;
begin
read(h1); readln(h2);
read(a); readln(b);
if h1+a*8>=h2 then k:=0
else
    if (a<=b) then  k:=-1
          else begin
          h1:=h1+8*a;k:=0;
          while h1<=h2 do begin
          k:=k+1;
          h1:=h1-12*b+12*a;
          end;
          end;
write(k);

end.

uses math;
var
 i,j,k,n,m,s:longint;
 h1,h2,a,b:longint;
dh:longint;
begin
 readln(h1,h2);
 readln(a,b);
 k:=0;
 dh:=h2-h1;
 if dh<=8*a then writeln(0)
 else
 if (a>b) then begin
 while dh>0 do begin
    dh:=dh-12*a;
    if (dh<=0) then begin
        writeln(k+1);
        dh:=-24*b;
    end;
    dh:=dh+12*b;
    k:=k+1;
 end;
 end
 //writeln(k);
 else writeln(-1);
end.

uses math;
var
 i,j,k,n,m,s:longint;
 h1,h2,a,b:longint;
dh:longint;
begin
 readln(h1,h2);
 readln(a,b);
 k:=0;
 dh:=h2-h1;
 if dh<=8*a then writeln(0)
 else begin
 dh:=dh-8*a+2*b;
 while (dh>0)and(k<100000) do begin
    dh:=dh+10*b-12*a;
    if (dh<=0) then begin
        writeln(k+1);
        dh:=-24*b;
    end;
    dh:=dh+2*b;
    k:=k+1;
 end;
 if dh>0 then writeln(-1);
 end;

end.

program fdf;
var h1,h2,a,b,n,k:longint;
begin
read(h1,h2);
read(a,b);
if (a<=b)then
   if (h1+a*8>=h2) then write('0')
   else write('-1')
else
    begin
    if (h2<=h1+a*8) then write('0')
    else
    begin
    n:=h2-h1-8*a;
    k:=1;
    if (n<=0) then write ('1')
    else
        repeat
        n:=n-12*a+12*b;
        k:=1+k;
        until (n<=0);
    write(k);
    end;
    end;
end.

program fdf;
var h1,h2,a,b,n,k:longint;
begin
read(h1,h2);
read(a,b);
if (a<=b)then
   if (h1+a*8>=h2) then write('0')
   else write('-1')
else
    begin
    h1:=h1-4*a;
    n:=h2-h1-12*a;
    if (n<=0) then write ('1')
    else
        repeat
        n:=n-12*a+12*b;
        k:=1+k;
        until (n<=0);
    write(k);
    end;
end.

var h1,h2,a,b,k:integer;
begin
readln(h1,h2);
readln(a,b);
k:=0;
if (a>b) or (a*8+h1>h2) then begin
h1:=a*8+h1;
while h1<h2 do begin
k:=k+1;
h1:=(a-b)*12+h1;
if h1<0 then h1:=0;
end;
writeln(k);
end
else writeln(-1);
end.

program pr1;
var h1,h2,a,b,k,i:integer;
begin
read(h1,h2);
read(a,b);
i:=0;
k:=h2-h1-8*a;
if ((k>0) and (a>b)) then
  while (k>0) do
    begin
    k:=k+12*b-12*a;
    i:=i+1;
    end
  else
  i:=-1;
write(i);
end.

var i, n, m, k, l, o, p, ans, h1, h2, a, b:LongInt;
 Begin
  Read(h1, h2);
  Read(a, b);
  if a<b then Begin WriteLn(-1);Halt;End;
  Inc(h1, a*8);

 while h1<h2 do
   Begin
     Dec(h1, b*12);
     Inc(h1, a*12);
     Inc(ans);

   End;
   WriteLn(ans);
 End.

var i, n, m, k, l, o, p, ans, h1, h2, a, b, ans1:LongInt;
 Begin
  Read(h1, h2);
  Read(a, b);

    Inc(h1, a*8);
    if (h1>= h2) or ((h1<h2) and (a=b)) then Begin WriteLn(0);Halt;End;
     if a<b then Begin WriteLn(-1);Halt;End;
    Dec(h1, b*2);
 while h1<h2 do
   Begin
     Dec(h1, b*10);
     Inc(h1, a*12);
     Inc(ans);
     if h1>=h2 then Begin WriteLn(ans);Halt;End;
     Dec(h1, b*2);

   End;

 End.

var i, n, m, k, l, o, p, ans, h1, h2, a, b, ans1:LongInt;
 Begin
  Read(h1, h2);
  Read(a, b);
  if a<b then Begin WriteLn(-1);Halt;End;
    Inc(h1, a*8);
    if h1>= h2 then Begin WriteLn(0);Halt;End;
    Dec(h1, b*2);
 while h1<h2 do
   Begin
     Dec(h1, b*10);
     Inc(h1, a*12);
     Inc(ans);
     if h1>=h2 then Begin WriteLn(ans);Halt;End;
     Dec(h1, b*2);

   End;

 End.

var
h1,h2,a,b:integer;
begin
readln(h1,h2);
readln(a,b);
if h1+8*a>=h2
then writeln(0)
else if a<=b
     then writeln(-1)
     else if ((h2-h1-8*a) div (12*(a-b))=0) and  ((h2-h1-8*a) mod (12*(a-b))=0)
          then writeln((h2-h1-8*a) div (12*(a-b)))
          else writeln((h2-h1-8*a) div (12*(a-b))+1);
end.

var h1,h2,a,b,k:integer;
begin
  read(h1,h2,a,b);
  k:=0;
  if (b >= a) and (h2 > h1 + 8*a) then write(-1) else begin
    while h1<h2 do begin
      h1:=h1+8*a;
      if h1 > h2 then begin write(k); exit; end;
      h1:=h1 - 12* b + 4* a;
      inc(k);
    end;

  end;

end.

var h1,h2,a,b,k:integer;
begin
  read(h1,h2,a,b);
  k:=0;
  if (b >= a) and (h2 >= h1 + 8*a) then write(-1) else begin
    while h1<h2 do begin
      h1:=h1+8*a;
      if h1 > h2 then begin write(k); exit; end;
      h1:=h1 - 12* b + 4* a;
      inc(k);
    end;
    write(k);
  end;

end.

var h1,h2,a,b,k:integer;
begin
  read(h1,h2,a,b);
  k:=0;
  if (b >= a) and (h2 > h1 + 8*a) then write(-1) else begin
    while h1<h2 do begin
      h1:=h1+8*a;
      if h1 >= h2 then begin write(k); exit; end;
      h1:=h1 - 12* b + 4* a;
      inc(k);
    end;

  end;

end.

var h1,h2,a,b,k:integer;
begin
  read(h1,h2,a,b);
  k:=0;
  if (b >= a) and (h2 >= h1 + 8*a) then write(-1) else begin
    while h1<h2 do begin
      h1:=h1+8*a;
      if h1 > h2 then begin write(k); exit; end;
      h1:=h1 - 12* b + 4* a;
      inc(k);
    end;

  end;

end.

var h1,h2,a,b,k:integer;
begin
  read(h1,h2,a,b);
  k:=0;
  if (b>=a) and (h2 >= h1 + 8*a) then write(-1) else begin
    while h1<h2 do begin
      h1:=h1+8*a;
      if h1>=h2 then begin write(k); exit; end;
      h1:=h1 - 12* b + 4* a;
      inc(k);
    end;

  end;

end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end;
i:=l;
res:=0;
inc(i,A*8);
while i<r do
begin
    inc(i,12*a);
    dec(i,12*b);
    if res>1000000 then
    begin
        writeln('-1');
        exit;
    end;
    inc(res);
end;
writeln(res);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end;
i:=l;
res:=0;
j:=15;
while i<>r do
begin
    if res>=1 then j:=10;

    while (i<>r) and (j<=22) do
    begin
    inc(i,a);
    inc(j);

    end;

    j:=-2;
    while (i<>r) and (j<10) do
    begin
    dec(i,b);
    inc(j);

    end;
    inc(res);
    if res>99999999 then
    begin
        writeln('-1');
        exit;
    end;

end;
writeln(res-1);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
{if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end; }
i:=l;
res:=0;
j:=15;
while i<>r do
begin
    if res>=1 then j:=10;

    while (i<>r) and (j<=22) do
    begin
    inc(i,a);
    inc(j);

    end;

    j:=-1;
    while (i<>r) and (j<=10) do
    begin
    dec(i,b);
    inc(j);

    end;
    inc(res);
    if res>6999999 then
    begin
        writeln('-1');
        exit;
    end;

end;
writeln(res-1);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
{if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end; }
i:=l;
res:=0;
j:=15;
while i<>r do
begin
    if res>=1 then j:=10;

    while (i<>r) and (j<=22) do
    begin
    inc(i,a);
    inc(j);

    end;

    j:=-3;
    while (i<>r) and (j<=10) do
    begin
    dec(i,b);
    inc(j);

    end;
    inc(res);
    if res>1000000 then
    begin
        writeln('-1');
        exit;
    end;

end;
writeln(res-1);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
{if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end; }
i:=l;
res:=0;
inc(i,A*8);
while i<r do
begin
    inc(i,12*a);
    dec(i,12*b);
    if res>1000000 then
    begin
        writeln('-1');
        exit;
    end;
    inc(res);
end;
writeln(res);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end;
i:=l;
j:=14;
while i<>r do
begin
    if res>1 then j:=10;

    while (i<>r) and (j<=22) do
    begin
    inc(i,a);
    inc(j);
    end;

    j:=-2;
    while (i<>r) and (j<=10) do
    begin
    dec(i,b);
    inc(j);
    end;
    inc(res);

end;
writeln(res-1);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end;
i:=l;
j:=14;
while i<>r do
begin
    if res>1 then j:=10;

    while (i<>r) and (j<=22) do
    begin
    inc(i,a);
    inc(j);
    end;

    j:=-2;
    while (i<>r) and (j<=10) do
    begin
    dec(i,b);
    inc(j);
    end;
    inc(res);

end;
writeln(res-1);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end;
i:=l;
res:=0;
j:=15;
while i<>r do
begin
    if res>=1 then j:=10;

    while (i<>r) and (j<=22) do
    begin
    inc(i,a);
    inc(j);

    end;

    j:=-2;
    while (i<>r) and (j<=10) do
    begin
    dec(i,b);
    inc(j);

    end;
    inc(res);
    if res>999999 then
    begin
        writeln('-1');
        exit;
    end;

end;
writeln(res-1);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
{if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end; }
i:=l;
res:=0;
j:=14;
while i<>r do
begin
    if res>=1 then j:=10;

    while (i<>r) and (j<=22) do
    begin
    inc(i,a);
    inc(j);

    end;

    j:=-3;
    while (i<>r) and (j<=10) do
    begin
    dec(i,b);
    inc(j);

    end;
    inc(res);
    if res>1000000 then
    begin
        writeln('-1');
        exit;
    end;

end;
writeln(res-1);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
{if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end; }
i:=l;
res:=0;
j:=15;
while i<>r do
begin
    if res>=1 then j:=10;

    while (i<>r) and (j<=22) do
    begin
    inc(i,a);
    inc(j);

    end;

    j:=-2;
    while (i<>r) and (j<=10) do
    begin
    dec(i,b);
    inc(j);

    end;
    inc(res);
    if res>1000000 then
    begin
        writeln('-1');
        exit;
    end;

end;
writeln(res-1);
end.

var i,n,l,r,a,b,res,j:longint;
ch:boolean;
begin
read(L,R);
read(a,b);
if l=r then
begin
    writeln(0);
    exit;
end;
{if ((a>b) and (l>r)) or ((a<b) and (l<r)) then
begin
    writeln('-1');
    exit;
end; }
i:=l;
res:=0;
j:=15;
while i<>r do
begin
    if res>=1 then j:=10;

    while (i<>r) and (j<=22) do
    begin
    inc(i,a);
    inc(j);

    end;

    j:=-1;
    while (i<>r) and (j<=10) do
    begin
    dec(i,b);
    inc(j);

    end;
    inc(res);
    if res>1000000 then
    begin
        writeln('-1');
        exit;
    end;

end;
writeln(res-1);
end.

var h1,h2,a,b,k:integer;
begin
  read(h1,h2,a,b);
  h1:=h1+8*a;
  if h1>=h2 then write(0)
  else
  if a<=b then write(-1)
  else
  write((h2-h1)div(12*a-12*b)+1)
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type arr=array[1..1000000] of longint;
arr1=array[1..100,1..100] of longint;
var mas:arr;
s:string;
c:char;
i,j,m,n,k,x,d,q,res,h1,h2:longint;
begin
 read(h1,h2);
 read(d,n);
 if n>d then
 begin
  writeln(-1);
  halt;
 end;
 res:=0;
 h1:=h1+d*8;
 if h1<h2 then
 begin
 h1:=h1-n*12;
 while h2>h1 do
 begin
  inc(res);
  h1:=h1+d*12;
  if h1>h2 then break;
  h1:=h1-n*12;
 end;
 end;
 writeln(res);
 readln;
 readln;
 readln;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type arr=array[1..1000000] of longint;
arr1=array[1..100,1..100] of longint;
var mas:arr;
s:string;
c:char;
i,j,m,n,k,x,d,q,res,h1,h2:longint;
begin
 read(h1,h2);
 read(d,n);
 k:=0;
 if (n>=d) and ((h1+d*8)<h2) then
 begin
  writeln(-1);
  halt;
 end;
 if h1+d*8>=h2 then writeln(0) else
 begin
  h1:=h1+d*8;
  while h1<h2 do
  begin
   h1:=h1+d*12-n*12;
   inc(k);
  end;
 end;
 writeln(k);
end.