The circle line of the Roflanpolis subway has $$$n$$$ stations.There are two parallel routes in the subway. The first one visits stations in order $$$1 \to 2 \to \ldots \to n \to 1 \to 2 \to \ldots$$$ (so the next stop after station $$$x$$$ is equal to $$$(x+1)$$$ if $$$x < n$$$ and $$$1$$$ otherwise). The second route visits stations in order $$$n \to (n-1) \to \ldots \to 1 \to n \to (n-1) \to \ldots$$$ (so the next stop after station $$$x$$$ is equal to $$$(x-1)$$$ if $$$x>1$$$ and $$$n$$$ otherwise). All trains depart their stations simultaneously, and it takes exactly $$$1$$$ minute to arrive at the next station.Two toads live in this city, their names are Daniel and Vlad.Daniel is currently in a train of the first route at station $$$a$$$ and will exit the subway when his train reaches station $$$x$$$.Coincidentally, Vlad is currently in a train of the second route at station $$$b$$$ and he will exit the subway when his train reaches station $$$y$$$.Surprisingly, all numbers $$$a,x,b,y$$$ are distinct.Toad Ilya asks you to check if Daniel and Vlad will ever be at the same station at the same time during their journey. In other words, check if there is a moment when their trains stop at the same station. Note that this includes the moments when Daniel or Vlad enter or leave the subway.

The first line contains five space-separated integers $$$n$$$, $$$a$$$, $$$x$$$, $$$b$$$, $$$y$$$ ($$$4 \leq n \leq 100$$$, $$$1 \leq a, x, b, y \leq n$$$, all numbers among $$$a$$$, $$$x$$$, $$$b$$$, $$$y$$$ are distinct) — the number of stations in Roflanpolis, Daniel's start station, Daniel's finish station, Vlad's start station and Vlad's finish station, respectively.

Output "YES" if there is a time moment when Vlad and Daniel are at the same station, and "NO" otherwise. You can print each letter in any case (upper or lower).

NoteIn the first example, Daniel and Vlad start at the stations $$$(1, 3)$$$. One minute later they are at stations $$$(2, 2)$$$. They are at the same station at this moment. Note that Vlad leaves the subway right after that.Consider the second example, let's look at the stations Vlad and Daniel are at. They are:   initially $$$(2, 9)$$$,  after $$$1$$$ minute $$$(3, 8)$$$,  after $$$2$$$ minutes $$$(4, 7)$$$,  after $$$3$$$ minutes $$$(5, 6)$$$,  after $$$4$$$ minutes $$$(6, 5)$$$,  after $$$5$$$ minutes $$$(7, 4)$$$,  after $$$6$$$ minutes $$$(8, 3)$$$,  after $$$7$$$ minutes $$$(9, 2)$$$,  after $$$8$$$ minutes $$$(10, 1)$$$,  after $$$9$$$ minutes $$$(1, 10)$$$. After that, they both leave the subway because they are at their finish stations, so there is no moment when they both are at the same station.

Program CircleMetro;
uses math;
var n,a,x,b,y:longint;
begin   //assign(input,'1169A.inp'); reset(input);
        //assign(output,'1169A.out'); rewrite(output);
        readln(n,a,x,b,y);
        while not((a=x) and (b=y)) do
        begin   if a<>x then inc(a);
                if a>n then a:=a-n;
                if b<>y then dec(b);
                if b<1 then b:=b+n;
                if ((a=x) and (a<>b)) or ((b=y) and (a<>b)) then begin
                writeln('NO'); exit;
                end;
                if a=b then begin
                writeln('YES'); exit;
                end;
        end;
        //close(input); close(output);
end.

var n,a,x,b,y:longint;
begin
 read(n,a,x,b,y);
 x:=x mod n;
 a:=a mod n;
 b:=b+n;
 y:=y mod n;
 while (x<>a)and(b mod n<>y)do
 begin
  inc(a);a:=a mod n;
  dec(b);
  if a=b mod n then begin write('YES');halt;end;
 end;
 write('NO');
 end.

const fi='';
      fo='';
var f:text;
    n,a,xx,b,y,s,s1:longint;
    x:ansistring;

begin
  assign(f,fi);reset(f);
  read(f,n,a,xx,b,y);

  assign(f,fo);rewrite(f);
  s:=a;
  s1:=b;
  x:='NO';
  while (true) do
        begin
          if s=n then s:=0;
          inc(s);
          dec(s1);
          if s1<1 then s1:=n;
          if s1=s then
          begin
            x:='YES';
            break;
          end;
          if s=xx then break;
          if s1=y then break;
        end;
  write(f,x);
  close(f);
end.

var
  st2,st1 : array[1..5000] of longint;
  j,n,a,b,x,y,i,k,j1,j2,st : longint;
function min(a,b : longint) : longint;
begin
  min := a;
  if (a > b) then
    min := b;
end;
begin
  readln(n,a,x,b,y);
  st := a;
  st1[1] := a;
  j := 1;
  while (a <> x) do
  begin
    inc(a);
    if (a > n) then
      a := 1;
    inc(j);
    inc(j1);
    st1[j] := a;
  end;
  st := b;
  st2[1] := b;
  j := 1;
  while (b <> y) do
  begin
    dec(b);
    if (b = 0) then
      b := n;
    inc(j);
    inc(j2);
    st2[j] := b;
  end;
  for i := 1 to min(j1,j2)+1 do
    if (st1[i] = st2[i]) and ((st1[i] > 0) and (st2[i] > 0)) then
    begin
      writeln('YES');
      exit;
    end;
  writeln('NO');
end.

var
bol:boolean;
i,kol,n,a,x,y,b:longint;
aa,bb:array[-1000..1000000]of longint;
begin
readln(n,a,x,b,y);

if (a<=x) then begin
    for i:=a to x do begin
        inc(kol);
        aa[i]:=kol;
    end;
end
else begin
     for i:=a to n do begin
         inc(kol);
         aa[i]:=kol;
     end;
     for i:=1 to x do begin
         inc(kol);
         aa[i]:=kol;
     end;
end;

kol:=0;

if (b>=y) then begin
    for i:=b downto y do begin
        inc(kol);
        bb[i]:=kol;
    end;
end
else begin
    for i:=b downto 1 do begin
        inc(kol);
        bb[i]:=kol;
    end;
    for i:=n downto y do begin
        inc(kol);
        bb[i]:=kol;
    end;
end;

    for i:=1 to n do begin
        if (aa[i]=bb[i])and(aa[i]>0) then bol:=true;
    end;
    if bol then writeln('YES')
    else
    writeln('NO');
end.

var
n,a,x,b,y,i,j:longint;
function check(i,j:longint):boolean;
begin
        if (i=j) then exit(true)
        else exit(false);
end;
begin
        readln(n,a,x,b,y);
        i:=a;
        j:=b;
        while (check(i,j)=false) and ((i<>x) and (j<>y)) do
        begin
                inc(i);
                dec(j);
                if i = n+1 then i:=1;
                if j = 0 then j:=n;
        end;
        if (i=j) then write('YES')
        else write('NO');
end.

var n,a,x,b,y:integer;
begin
readln(n,a,x,b,y);
while (a<>b) and (a<>x) and (b<>y) do
 begin
  if a=b then break;
  inc(a); dec(b);
  if a>n then a:=1;
  if b=0 then b:=n
 end;
if a=b then writeln('YES') else writeln('NO')
end.

var a,b,n,x,y:longint;
begin
  readln(n,a,x,b,y);
  while (a<>x) and (b<>y) do
  begin
    a:=a mod n+1;
    dec(b);
    if b=0 then b:=n;
    if a=b then
    begin
      writeln('YES');
      halt;
    end;
  end;
  writeln('NO')
end.

program implement;
var
n,x,y,b,a:longint;
yep:boolean;
begin
        yep:=false;
        readln(n,a,x,b,y);
        while (a<>x) and (b<>y) do
        begin
                a:=a+1;
                if a>n then a:=a-n;
                b:=b-1;
                if b<1 then b:=b+n;
                if a=b then yep:=true;
        end;
        if yep then writeln('YES')
        else writeln('NO');
end.

program circlemetro;
var n,a,x,b,y:byte;
begin
   read(n,a,x,b,y);
   if a=b then
      begin
         write('YES');
         halt;
      end;
   repeat
      inc(a);
      dec(b);
      if a>n then a:=a-n;
      if b<1 then b:=b+n;
      if a=b then
         begin
            write('YES');
            halt;
         end;
   until (a=x) or (b=y);
   writeln('NO');
   readln;
end.

Var
n, a, x, b, y: integer;
s: string;

Begin

readln(n, a, x, b, y); s:='NO';
repeat
a:=(a+1) mod (n+1);
if a=0 then inc(a);
b:=(b-1) mod (n+1);
if b=0 then b:=n;
until (a=x) or (b=y) or (a=b);
if a=b then s:='YES';
writeln(s);

End.

var n,a,b,x,y:longint;
begin
        readln(n,a,x,b,y);
        repeat
        begin
                inc(a);
                if a=n+1 then a:=1;
                dec(b);
                if b=0 then b:=n;
                if (a=b) {or ((abs(a-b)=1) and (a<>x) and (b<>y))} then
                begin
                        writeln('YES');
                        halt;
                end;
        end
        until (a=x) or (b=y);
        writeln('NO');
end.

Program ILoveYou;
VAR n,a,x,b,y:int64; bo:boolean;
Begin

bo:=false;
Readln(n,a,x,b,y);
while (a <> x) and (b <> y) do
Begin

if (a = b) then bo:=true;
a:=a + 1;
if (a = n + 1) then a:=1;
b:=b - 1;
if (b = 0) then b:=n;
if (a = b) then bo:=true;

end;

if bo then Writeln('YES') else Writeln('NO');

Readln;
END.

                                          const eps=1e-10;
      besk=8000000000000000000; label 1,3,2,44;
type mas=array[-10000..250000+1] of int64; integer=longint;
var i1,j1,mask,stepp,h,n2,i,j,k,l,step,k1,w,mesto,num:longint;
ss,ss1:string;
dx,dy,ll,rr,sum,m,start,finish,time,p3,p4,jj,qqq,ii,tt,pmax,pmax2,qq,p1,p2,ot,ott,hh,pos0,pos1,pos2,pp,mm,maxot,mnog,tmax,summax,n,nn,kk,modul,t0,t1,n1,t2,q,t,p:int64; flag1:boolean;
  summ,place,kol,str,a2,b2,last,left,right,zz,z1,sum1,sum0,d0,d1,ccc,c,d,lnew,rnew,a,b:mas; flag2,flag:boolean;  pl:longint;
 jmax,maxx, gr,grr,ener,dob,aa,bb,cc,dist,tt3,tt1,tt2,ugg,aa1,aa2,r,ug:int64;
  marked,zan:array[-10..1000000] of boolean;
  a1,b1,strok:array[-10..250000] of int64;
  stroka:array[-1000..1000000] of char;
  ot1,otmax,v:extended;
  sp,sss:array[-10..2000000] of string;
  newpole,dd,pole:array[-100..1210,-1..1210] of int64;
  dchet,dnech,poschet,posnechet:array[-10..290000,-1..30] of int64;
  pos:int64;
  ch:char;
  flagg1:boolean;
  ymax,ymin,xmax,xmin,znach,z,nomer,newplace,newstr,s,next,prev,xx,yy,aold,x,y:array[-100000..2000002] of int64;
  ddd:array[-10..5010,-10..5010] of int64;
 function srav(i,j:longint):boolean;
  begin if (a[i]<a[j])or(a[i]=a[j])and(a1[i]<a1[j])or(a[i]=a[j])and(a1[i]=a1[j])and(a2[i]<a2[j])  then
  srav:=true else srav:=false; end;

procedure sl (k,l,m:integer);  {k- dlina, l,m - nachalo dvuh blokov}
begin
i:=l;j:=m; flag:=true; step:=0;while flag do begin
if (srav(i,j)) then begin begin b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];end;
inc(step);inc(i);
{writeln('step=',step,' i=',i);} end;
if (not srav(i,j)) then begin begin b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j];end;
inc(step);inc(j);end;
if  ((i>=l+k) or (j>=m+k)) then flag:=false;
end;
if(i>=l+k) then repeat b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j];inc(step);inc(j);until (j>=m+k);
if(j>=m+k) then repeat b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];inc(step);inc(i);until (i>=l+k);
end;
procedure sort(var c:mas);

begin

k:=1; repeat
l:=1;m:=k+l; repeat sl(k,l,m); l:=l+2*k;m:=m+2*k; until (l>=n); k:=k*2;
for i:=1 to n do begin a[i]:=b[i];a1[i]:=b1[i];a2[i]:=b2[i]; end;
until (k>=n);

end;

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 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 nod(a,b:int64):int64; var p,t:int64;
begin
  a:=abs(a); b:=abs(b);
  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 nok(a,b:int64):int64;
begin  nok:=(a*b) div nod(a,b);  end;

   function degg(a:int64;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 div 2); degg:=(p*p) mod modul;    end;

end;

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

function nomerr(gr:int64):int64;

var ot,aa,bb,cc:int64; fl:boolean;
begin
  aa:=1; bb:=p;  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,p+1);
   repeat dec(cc) until y[cc]<=gr;
   if y[cc]=gr then fl:=true else fl:=false;
   { if fl then nomerr:=a1[cc] else nomerr:=-1000;}
   nomerr:=cc;
end;

 function vhodit(t:int64):boolean;
var sum,ii,jj,p:int64;  ans:boolean;
begin
   p:=t;
   for i:=1 to t do a[i]:=x[i];
    n:=1;
    repeat n:=n*2 until n>=p;
         for i:=p+1 to n+2 do a[i]:=besk;
        sort(a);
    { for i:=1 to p do write(a[i],' '); writeln;
     }
     sum:=0;
    if not odd(t) then
     for i:=1 to t div 2 do sum:=sum+a[2*i] else
     for i:=1 to (t+1) div 2 do sum:=sum+a[2*i-1];
    { writeln('sum= ',sum);
     }
 ans:=sum<=hh;
vhodit:=ans;
end;

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

 prost:=fl;

end;

function maxvl(dx,dy:int64):int64;
var q,pp,ii,jj,ans:longint; p1,p2,t1,t2:int64;
begin
   pp:=0;
   for i:=1 to p do
     begin
        t1:=dx*x[2*i-1]+dy*y[2*i-1];
        t2:=dx*x[2*i]+dy*y[2*i];
        p1:=min(t1,t2);
        p2:=max(t1,t2);
        inc(pp); a[pp]:=p1-1; a1[pp]:=1;
        inc(pp); a[pp]:=p2; a1[pp]:=-1;
     end;
       {  for i:=1 to pp do writeln(a[i],' ',a1[i]);
         writeln('-----------');
       } n:=1;
        repeat n:=n*2 until n>pp;
      {  writeln('pp= ',pp,'  n= ',n);
      }  for i:=pp+1 to n+2 do a[i]:=besk;
        sort(a);
      {  for i:=1 to pp do writeln(a[i],' ',a1[i]);
      }  for i:=1 to pp do z[i]:=z[i-1]+a1[i];
      {  for i:=1 to pp do write(z[i],' '); writeln;
      }  ot:=0;
        for i:=1 to pp do ot:=max(ot,z[i]);

   maxvl:=ot;
end;

function st1(t:longint):longint;
var ot,tt:longint;
begin
  ot:=x[1]+t;
  ot:=ot mod p;
  st1:=ot;
end;

function st2(t:longint):longint;
var ot,tt:longint;
begin
  ot:=x[3]-t+10000*p;
  ot:=ot mod p;
  st2:=ot;
end;

begin

 {  assign (input,'D:\Projects\input.txt');reset(input);
   assign (output,'D:\Projects\output.txt'); rewrite(output);
  }

    read(p);
    for i:=1 to 4 do read(x[i]);
     for i:=1 to 4 do dec(x[i]);
     if x[2]<x[1] then x[2]:=x[2]+p;
     if x[4]>x[3] then x[3]:=x[3]+p;

   { for i:=0 to 10 do writeln(i,' ',st1(i),' ',st2(i));
    }
    for i:=0 to 1000 do
      begin
        {  writeln('step= ',i,'  pol= ',st1(i),' ',st2(i),' ',flag1,' ',flag2);
        } if (st1(i)=st2(i)) and not flag1 and not flag2 then
           begin writeln('YES'); goto 1;   end;

           if st1(i) mod p=x[2] mod p then flag1:=true;
           if st2(i) mod p=x[4] mod p then flag2:=true;

      end;

       writeln('NO');

 1: close (output);
     end.

Program CircleMetro;
uses math;
var n,a,x,b,y:longint;
begin   //assign(input,'1169A.inp'); reset(input);
        //assign(output,'1169A.out'); rewrite(output);
        readln(n,a,x,b,y);
        while not((a=x) and (b=y)) do
        begin   if a<>x then inc(a);
                if a>n then a:=a-n;
                if b<>y then dec(b);
                if b<1 then b:=b+n;
                if a=b then begin
                writeln('YES'); exit;
                end;
        end;
        writeln('NO');
        //close(input); close(output);
end.

const fi='';
      fo='';
var f:text;
    n,a,xx,b,y,s,s1:longint;
    x:ansistring;

begin
  assign(f,fi);reset(f);
  read(f,n,a,xx,b,y);

  assign(f,fo);rewrite(f);
  s:=a;
  s1:=b;
  x:='NO';
  while (true) do
        begin
          inc(s);
          dec(s1);
          if s1=s then
          begin
            x:='YES';
            break;
          end;
          if s=n then s:=0;
          if s1<1 then s1:=n;
          if s=xx then break;
          if s1=y then break;
        end;
  write(f,x);
  close(f);
end.

const fi='';
      fo='';
var f:text;
    n,a,xx,b,y,s,s1:longint;
    x:ansistring;

begin
  assign(f,fi);reset(f);
  read(f,n,a,xx,b,y);

  assign(f,fo);rewrite(f);
  s:=a;
  s1:=b;
  x:='NO';
  while (true) do
        begin
          if s1=s then
          begin
            x:='YES';
            break;
          end;
          if s=xx then break;;
          if s1=y then break;
          inc(s);
          dec(s1);
          if s=n then s:=1;
          if s1<1 then s1:=n;
        end;
  write(f,x);
  close(f);
end.

const fi='';
      fo='';
var f:text;
    n,a,xx,b,y,s,s1:longint;
    x:ansistring;

begin
  assign(f,fi);reset(f);
  read(f,n,a,xx,b,y);

  assign(f,fo);rewrite(f);
  s:=a;
  s1:=b;
  x:='NO';
  while (true) do
        begin
          inc(s);
          dec(s1);
          if s1<1 then s1:=n;
          if s1=s then
          begin
            x:='YES';
            break;
          end;
          if s=n then s:=0;
          if s=xx then break;
          if s1=y then break;
        end;
  write(f,x);
  close(f);
end.

const fi='';
      fo='';
var f:text;
    n,a,xx,b,y,s,s1:longint;
    x:ansistring;

begin
  assign(f,fi);reset(f);
  read(f,n,a,xx,b,y);

  assign(f,fo);rewrite(f);
  s:=a;
  s1:=b;
  x:='NO';
  while (true) do
        begin
          inc(s);
          dec(s1);
          if s1=s then
          begin
            x:='YES';
            break;
          end;
          if s=n then s:=1;
          if s1<1 then s1:=n;
          if s=xx then break;
          if s1=y then break;
        end;
  write(f,x);
  close(f);
end.

var
  st2,st1 : array[1..5000] of longint;
  j,n,a,b,x,y,i,k,j1,j2,st : longint;
function min(a,b : longint) : longint;
begin
  min := b;
  if (a < b) then
    min := b;
end;
begin
  readln(n,a,x,b,y);
  st := a;
  st1[1] := a;
  j := 1;
  while (a <> x) do
  begin
    inc(a);
    if (a > n) then
      a := 1;
    inc(j);
    inc(j1);
    st1[j] := a;
  end;
  st := b;
  st2[1] := b;
  j := 1;
  while (b <> y) do
  begin
    dec(b);
    if (b < 0) then
      b := n;
    inc(j);
    inc(j2);
    st2[j] := b;
  end;
  for i := 1 to min(j1,j2)+1 do
    if (st1[i] = st2[i]) then
    begin
      writeln('YES');
      exit;
    end;
  writeln('NO');
end.

var
  st2,st1 : array[1..5000] of longint;
  j,n,a,b,x,y,i,k,j1,j2,st : longint;
function min(a,b : longint) : longint;
begin
  min := a;
  if (a > b) then
    min := b;
end;
begin
  readln(n,a,x,b,y);
  st := a;
  st1[1] := a;
  j := 1;
  while (a <> x) do
  begin
    inc(a);
    if (a > n) then
      a := 1;
    inc(j);
    inc(j1);
    st1[j] := a;
  end;
  st := b;
  st2[1] := b;
  j := 1;
  while (b <> y) do
  begin
    dec(b);
    if (b < 0) then
      b := n;
    inc(j);
    inc(j2);
    st2[j] := b;
  end;
  for i := 1 to min(j1,j2)+1 do
    if (st1[i] = st2[i]) and ((st1[i] > 0) and (st2[i] > 0)) then
    begin
      writeln('YES');
      exit;
    end;
  writeln('NO');
end.

var n,a,x,b,y,c:integer;
begin
readln(n,a,x,b,y);
while c<n do
 begin
  inc(c);
  inc(a); dec(b);
  if a=b then break;
  if a>n then a:=1;
  if b=0 then b:=n
 end;
if a=b then writeln('YES') else writeln('NO')
end.

var n,a,x,b,y:integer;
begin
readln(n,a,x,b,y);
while (a<x) and (b>y) do
 begin
  inc(a); dec(b);
  if a=b then break
 end;
if a=b then writeln('YES') else writeln('NO')
end.

var n,a,x,b,y:integer;
begin
readln(n,a,x,b,y);
while (a<>b) and (a<=n) and (b>0) do
 begin
  if a=b then break;
  inc(a); dec(b)
 end;
if a=b then writeln('YES') else writeln('NO')
end.

                                          const eps=1e-10;
      besk=8000000000000000000; label 1,3,2,44;
type mas=array[-10000..250000+1] of int64; integer=longint;
var i1,j1,mask,stepp,h,n2,i,j,k,l,step,k1,w,mesto,num:longint;
ss,ss1:string;
dx,dy,ll,rr,sum,m,start,finish,time,p3,p4,jj,qqq,ii,tt,pmax,pmax2,qq,p1,p2,ot,ott,hh,pos0,pos1,pos2,pp,mm,maxot,mnog,tmax,summax,n,nn,kk,modul,t0,t1,n1,t2,q,t,p:int64; flag1:boolean;
  summ,place,kol,str,a2,b2,last,left,right,zz,z1,sum1,sum0,d0,d1,ccc,c,d,lnew,rnew,a,b:mas; flag2,flag:boolean;  pl:longint;
 jmax,maxx, gr,grr,ener,dob,aa,bb,cc,dist,tt3,tt1,tt2,ugg,aa1,aa2,r,ug:int64;
  marked,zan:array[-10..1000000] of boolean;
  a1,b1,strok:array[-10..250000] of int64;
  stroka:array[-1000..1000000] of char;
  ot1,otmax,v:extended;
  sp,sss:array[-10..2000000] of string;
  newpole,dd,pole:array[-100..1210,-1..1210] of int64;
  dchet,dnech,poschet,posnechet:array[-10..290000,-1..30] of int64;
  pos:int64;
  ch:char;
  flagg1:boolean;
  ymax,ymin,xmax,xmin,znach,z,nomer,newplace,newstr,s,next,prev,xx,yy,aold,x,y:array[-100000..2000002] of int64;
  ddd:array[-10..5010,-10..5010] of int64;
 function srav(i,j:longint):boolean;
  begin if (a[i]<a[j])or(a[i]=a[j])and(a1[i]<a1[j])or(a[i]=a[j])and(a1[i]=a1[j])and(a2[i]<a2[j])  then
  srav:=true else srav:=false; end;

procedure sl (k,l,m:integer);  {k- dlina, l,m - nachalo dvuh blokov}
begin
i:=l;j:=m; flag:=true; step:=0;while flag do begin
if (srav(i,j)) then begin begin b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];end;
inc(step);inc(i);
{writeln('step=',step,' i=',i);} end;
if (not srav(i,j)) then begin begin b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j];end;
inc(step);inc(j);end;
if  ((i>=l+k) or (j>=m+k)) then flag:=false;
end;
if(i>=l+k) then repeat b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j];inc(step);inc(j);until (j>=m+k);
if(j>=m+k) then repeat b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];inc(step);inc(i);until (i>=l+k);
end;
procedure sort(var c:mas);

begin

k:=1; repeat
l:=1;m:=k+l; repeat sl(k,l,m); l:=l+2*k;m:=m+2*k; until (l>=n); k:=k*2;
for i:=1 to n do begin a[i]:=b[i];a1[i]:=b1[i];a2[i]:=b2[i]; end;
until (k>=n);

end;

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 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 nod(a,b:int64):int64; var p,t:int64;
begin
  a:=abs(a); b:=abs(b);
  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 nok(a,b:int64):int64;
begin  nok:=(a*b) div nod(a,b);  end;

   function degg(a:int64;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 div 2); degg:=(p*p) mod modul;    end;

end;

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

function nomerr(gr:int64):int64;

var ot,aa,bb,cc:int64; fl:boolean;
begin
  aa:=1; bb:=p;  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,p+1);
   repeat dec(cc) until y[cc]<=gr;
   if y[cc]=gr then fl:=true else fl:=false;
   { if fl then nomerr:=a1[cc] else nomerr:=-1000;}
   nomerr:=cc;
end;

 function vhodit(t:int64):boolean;
var sum,ii,jj,p:int64;  ans:boolean;
begin
   p:=t;
   for i:=1 to t do a[i]:=x[i];
    n:=1;
    repeat n:=n*2 until n>=p;
         for i:=p+1 to n+2 do a[i]:=besk;
        sort(a);
    { for i:=1 to p do write(a[i],' '); writeln;
     }
     sum:=0;
    if not odd(t) then
     for i:=1 to t div 2 do sum:=sum+a[2*i] else
     for i:=1 to (t+1) div 2 do sum:=sum+a[2*i-1];
    { writeln('sum= ',sum);
     }
 ans:=sum<=hh;
vhodit:=ans;
end;

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

 prost:=fl;

end;

function maxvl(dx,dy:int64):int64;
var q,pp,ii,jj,ans:longint; p1,p2,t1,t2:int64;
begin
   pp:=0;
   for i:=1 to p do
     begin
        t1:=dx*x[2*i-1]+dy*y[2*i-1];
        t2:=dx*x[2*i]+dy*y[2*i];
        p1:=min(t1,t2);
        p2:=max(t1,t2);
        inc(pp); a[pp]:=p1-1; a1[pp]:=1;
        inc(pp); a[pp]:=p2; a1[pp]:=-1;
     end;
       {  for i:=1 to pp do writeln(a[i],' ',a1[i]);
         writeln('-----------');
       } n:=1;
        repeat n:=n*2 until n>pp;
      {  writeln('pp= ',pp,'  n= ',n);
      }  for i:=pp+1 to n+2 do a[i]:=besk;
        sort(a);
      {  for i:=1 to pp do writeln(a[i],' ',a1[i]);
      }  for i:=1 to pp do z[i]:=z[i-1]+a1[i];
      {  for i:=1 to pp do write(z[i],' '); writeln;
      }  ot:=0;
        for i:=1 to pp do ot:=max(ot,z[i]);

   maxvl:=ot;
end;

function st1(t:longint):longint;
var ot,tt:longint;
begin
  ot:=x[1]+t;
  ot:=ot mod p;
  st1:=ot;
end;

function st2(t:longint):longint;
var ot,tt:longint;
begin
  ot:=x[3]-t+10*p;
  ot:=ot mod p;
  st2:=ot;
end;

begin

  { assign (input,'D:\Projects\input.txt');reset(input);
   assign (output,'D:\Projects\output.txt'); rewrite(output);
   }

    read(p);
    for i:=1 to 4 do read(x[i]);
     for i:=1 to 4 do dec(x[i]);
     if x[2]<x[1] then x[2]:=x[2]+p;
     if x[4]>x[3] then x[3]:=x[3]+p;

   { for i:=0 to 10 do writeln(i,' ',st1(i),' ',st2(i));
    }
    for i:=0 to 1000 do
      begin
         if (st1(i)=st2(i)) and not flag1 and not flag2 then
           begin writeln('YES'); goto 1;   end;
           if st1(i)=x[2] then flag1:=true;
           if st2(i)=x[4] then flag2:=true;

      end;

       writeln('NO');

 1: close (output);
     end.