You are given an integer sequence $$$1, 2, \dots, n$$$. You have to divide it into two sets $$$A$$$ and $$$B$$$ in such a way that each element belongs to exactly one set and $$$|sum(A) - sum(B)|$$$ is minimum possible.The value $$$|x|$$$ is the absolute value of $$$x$$$ and $$$sum(S)$$$ is the sum of elements of the set $$$S$$$.

The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^9$$$).

Print one integer — the minimum possible value of $$$|sum(A) - sum(B)|$$$ if you divide the initial sequence $$$1, 2, \dots, n$$$ into two sets $$$A$$$ and $$$B$$$.

NoteSome (not all) possible answers to examples:In the first example you can divide the initial sequence into sets $$$A = \{1, 2\}$$$ and $$$B = \{3\}$$$ so the answer is $$$0$$$.In the second example you can divide the initial sequence into sets $$$A = \{1, 3, 4\}$$$ and $$$B = \{2, 5\}$$$ so the answer is $$$1$$$.In the third example you can divide the initial sequence into sets $$$A = \{1, 4, 5\}$$$ and $$$B = \{2, 3, 6\}$$$ so the answer is $$$1$$$.

var n:longint;
begin
        readln(n);
        if n mod 2 = n div 2 mod 2 then writeln('0')
        else writeln('1');
        readln;
end.

const fi='1102A.inp';
        fo='1102A.out';
var n,s:int64;
procedure nhap;
        begin
        readln(n);
        end;
procedure xuli;
        begin
        s:=((n+1)*n) div 2;
        if s mod 2=0 then write(0)
        else write(1);
        end;
begin

nhap;
xuli;
end.

var f1,f2:text;
n,s:int64;
        begin
                assign(f1,'');
                reset(f1);
                assign(f2,'');
                rewrite(f2);
                readln(f1,n);
                s:=(n*n+n) div 2;
                if s mod 2=1 then writeln(f2,'1') else writeln(f2,'0');
                close(f1);
                close(f2);
        end.

var
  n: Int32;

begin
  ReadLn(n);
  n := n - 1;
  n := n div 2;
  If n mod 2 = 0 then WriteLn('1') else WriteLn('0');
end.

var     n:longint;
        s:qword;
begin
        read(n);
        s:=(n*(n+1)) div 2;
        if s mod 2=0 then
                write(0)
        else
                write(1);
end.

Const fi='1102.inp';
      fo='1102.out';

Var n:int64;

Procedure       doc;
   begin
   {$ifndef ONLINE_JUDGE}
      assign(input,fi);         reset(input);
      assign(output,fo);        rewrite(output);
   {$endif}
      read(n);
      n:=n*(n+1) div 2;
      if odd(n) then write(1) else write(0);
   end;

BEGIN
   doc;
END.

var n:longint;
begin
  read(n);
  n:=n*(n+1) div 2;
  if (n mod 2=0) then write('0') else write('1');
end.

var
  n:int64;

BEGIN
  //assign(input,'A.inp'); reset(input);
  //assign(output,'A.out'); rewrite(output);

  read(n);
  write((1+n)*n div 2 mod 2);

  //close(input);
  //close(output);
END.

var n : int64;

begin
    readln(n);
    writeln((n*(n+1) div 2) mod 2);
end.

var g:int64;
begin
 read(g);
 if odd(G*(g+1) div 2) then write(1) else write(0)
end.

            const eps=0.0000000001;  besk1=200000008;  nnn=4600000;
            besk=8000000000000000000;
              modul=1000000007{998244353} ;

   label 22,1,2,3,4,33;
    type    real=extended;   double=extended;
    mas=array [-300000..nnn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3,p4 :int64;end; zap1=^zap;
    mass=array[-10000..nnn] of longint;mass1=^mass;
    var obr,koludal,maxdl,mindl,tmin,aaa,bbb,ccc,kolst,kollek,aa,bb,t1,t2,kolx,koly,ans,ans1,ans2,dl,posleft,posright,n,xxx,yyy,dx,dy,m,w,h,jjj,l,r,cc,sum,mnog,nn,t3,t4,t5,t6,posmax,tmax,kold,kk,j2,ttt,ppp,kol,pmin,pmax,limit,posi,posj,diam,oldt,ot1,time,pos,ll,posx,posy,dloch,newdl,oldn,oldm,ost,ot,p1,p2,p3,p4,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,p0,jj,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,t,nm,smin,cen:int64;
   k,i2,i3,step2,k1,k2,pp0,mask,i1,j1,step1, step, i,j:longint;
   minzn,zz,predok,xold,yold,x1,x0,d,xx,yy,b,a,zsum,y,x,z:array[-200000..1535002] of int64;

   gr:array[-1..2000,-1..2000] of boolean;

    prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    iii,oldpos,finot,vv,znak:int64;
    aold:mas;  anss:zap;
    ss1,ss2:string;
    newstr,str,sss:array[-1000..20000] of string;
    lll,rrr,v,dist,alpha,phi:extended;
    zzz,ddnew,koef,polex,ddsum,dd:array[-1..440000,-1..30] of int64;
    ppos,mma,ma:array[-1000..2000005,-1..15] of int64;
    xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;
    del:array[-1..100001,-1..20] of longint;
    z0,num,y1,z1,z2,kolnul,fact,next,prev,s,name,dnew, voltay,c,day:mas;
    zzzz:array[0..125000000] of byte;
    aaaa,bbbb,x2:extended;
    delit:array[0..100000,0..20] of longint;
    pole:array[-10..2002,-10..2005] of char;
    matr,ppole,ddl,ddr,dd3,dd4:array[-10..2000,-10..2200] of extended;
    ddnnew:array[-1..12,-1..12,0..200,0..3] of int64;
   newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;
    ssold,sss1,sss2:string;
    def,stepen,koled,och,newoch,place,newnabor,stoim,nabor:array[-10..500005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
     dost:array[-1..210,-1..210,0..3,0..3] of int64;
    ss:string;ch,ch1,ch2:char;
    pr,hesh,numright,dr: array [-10..206000,-1..16] of int64;
    s3,s2,s1:array[-100..500000] of string;

    grr :array [-10..2010,-10..2010] of extended;
    maxpr:array[0..nnn] of string;
     tx,ty,vel,ott,v0,v1,s0,t0:int64;
     zv:point;
     left,right,ugol,rot,temp,sumtemp,vol,newx,newy:array[-1000..400000] of int64;
     mash,sqx,sqy,ottt:extended;
     xxxx,yyyy,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:int64):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 sledgr(p,q:int64):int64;  {p - to cto delim, q - pervoe, na cto delim - otvet - gde prohodit granitsa}

var tt,d1,d2,t3,ot,t,t1,t2:int64;
begin
   t1:=p mod q;
   t2:=p mod (q+1);
   t3:=p mod (q+2);
   d1:=-(t2-t1);
   d2:=-(t3-t2);
   if d1<>d2 then ot:=q+1 else if d1<>0 then
     begin
       tt:=t1 div d1;
       ot:=q+tt;

     end else ot:=besk;

 sledgr:=ot;
end;

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

      read(p);
      if (p mod 4=0)or(p mod 4=3) then write(0) else write(1);

1:             close(output);
end.

Var n,sum:Longint;
Begin
    Readln(n);
    sum:=(n+1)*n div 2;
    If sum mod 2 = 0 then writeln(0) else writeln(1);
End.

var
  n:longint;
begin
  read(n);
  if n mod 2 = 1 then
    inc(n,1);
  n:=n div 2;
  if n mod 2 = 1 then
    write(1)
  else
    write(0);
end.

var n:longint;
begin
 read(n);
 if (n*(n+1) mod 4=0) then write(0) else
 write(1);
end.

var n,i,k : longint ;
    begin
     readln(n);
       If (n mod 4 =0) or (n mod 4=3) then writeln(0)
         else writeln(1);
    end.

var
  n:int64;
begin
  readln(n);
  writeln((n*(n+1) div 2) mod 2);
end.

var
  n: longint;

begin
  readln(n);
  n := n mod 4;
  case n of
  0, 3: write('0');
  1, 2: write('1');
  end;
end.

program dividing;
var n:longword;

begin
	readln(n); write(((n+1)*n div 2) mod 2);
end.

{$Coperators ON}
{$mode objfpc}
uses math;
var n:ansistring;
function smaller(a,b:ansistring):Boolean; // True is a<b
var i,n1,n2:Longint;
begin
    n1:=Length(a);
    n2:=Length(b);
    if n1<n2 then exit(true);
    if n1>n2 then exit(false);
    for i:=1 to n1 do
        if a[i]>b[i] then exit(false) else if a[i]<b[i] then exit(true);
    exit(false);
end;

//bignum

function plus(x,y:ansistring):ansistring; //cong hai so lon
var i,nho,n,tam:longint;
    res:ansistring;
begin
    while length(x)<length(y) do x:='0'+x;
    while length(x)>length(y) do y:='0'+y;
    res:='';
    nho:=0;
    n:=length(x);
    for i:=n downto 1 do
        begin
            tam:=ord(x[i])-48+ord(y[i])-48+nho;
            nho:=tam div 10;
            res:=char(ord(tam mod 10)+48)+res;
        end;
    if nho>0 then res:=char(nho+48)+res;
    exit(res);
end;
function multi(a,b:ansistring):ansistring; //multi 2 number
var i,j,i_n1,i_n2,n1,n2,carry,sum:Longint;
    res,temp:ansistring;
begin
    n1 := Length(a); n2 := Length(b);
    res:='';
    for i:=0 to n1+n2 do res+='0';
    i_n1 := 1;
    i_n2 := 1;
    for i:=n1 downto 1 do
        begin
            carry := 0;
            i_n2 := 1;
            for j:=n2 downto 1 do
                begin
                    sum := (ord(a[i]) - 48) * (ord(b[j]) - 48) + ord(res[i_n1 + i_n2]) - 48 + carry;
                    carry := sum div 10;
                    res[i_n1 + i_n2] := char(sum mod 10 + 48);
                    inc(i_n2);
                end;
            if carry > 0 then res[i_n1 + i_n2] := char(ord(res[i_n1 + i_n2]) + carry);
            inc(i_n1);
        end;
    i := Length(res);
    while (res[i] = '0') and (i > 0) do dec(i);
    if i = 0 then exit('0');
    res:=copy(res,1,i);
    temp:=res;
    res:='';
    for i:=2 to Length(temp) do
        res := temp[i] + res;
    exit(res);
end;

function division(a:ansistring;b:int64):ansistring;  // div bignum to a integer
var i,n:Longint;
    temp:int64;
    res:ansistring;
begin
    i := 1;
    temp := ord(a[i]) - 48;
    while temp<b do begin inc(i); temp := temp * 10 + (ord(a[i])-48); end;
    res := '';
    n := Length(a);
    while i<=n do
        begin
            res += char(temp div b + 48);
            inc(i);
            temp := (temp mod b) * 10 + (ord(a[i]) - 48);
        end;
    if Length(res)=0 then exit('0');
    exit(res);
end;
function module(a:ansistring;b:int64):ansistring;  // mod bignum to a integer
var i:Longint;
    res:int64;
    tam:ansistring;
begin
    res := 0;
    for i:=1 to Length(a) do
        res := (res * 10 + ord(a[i]) - ord('0')) mod b;
    str(res,tam);
    exit(tam);
end;
procedure init;
	var tam:ansistring;
begin
	readln(n);
	tam:=division(multi(n,plus(n,'1')),2);
	// writeln(tam);
	// writeln(module(tam,2));
	if module(tam,2)='0' then writeln(0) else writeln(1);
end;
begin
// assign(input,'a.inp'); reset(input);
// assign(output,'a.out'); rewrite(output);

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

const
        fi='cf1102a.inp';
        fo='cf1102a.out';
var
        n,t:int64;
procedure ofile;
begin
        {$IFNDEF ONLINE_JUDGE}
        assign(input,fi);   reset(input);
        assign(output,fo);  rewrite(output);
        {$ENDIF}
end;
begin
        ofile;
        readln(n);
        if odd(n) then
                begin
                        t:=(n+1) div 2;
                        t:=t*n;
                end else
                begin
                        t:=n div 2;
                        t:=t*(n+1);
                end;
        if odd(t) then writeln(1) else writeln(0);
end.

var n:int64;
begin
        readln(n);
        writeln(((n*(n+1))div 2) mod 2);
end.

var
s:int64;
n:int64;
begin
    readln(n);
    s:=n*(n+1);
    s:=trunc(s/2);
    writeln(s mod 2);
end.

var n,a,p,max,r,s,k,min : int64;
c : longword;
b,v,z : array[1..100000] of longword;
da : boolean;
begin
	readln(n);

	if n mod 2=0 then
	begin
		if ((n div 2) mod 2)=0 then
		a:=0 else
		a:=1;
	end;
	if n mod 2<>0 then
	begin
		if (((n+1) div 2) mod 2)=0 then
		a:=0 else
		a:=1;
	end;

	writeln(a);
end.

var
sum,n,rez,i:longint;
begin
read(n);
sum:=0;
for i:=1 to n do sum:=sum+i;
if sum mod 2 = 0 then rez:=0
                 else rez:=1;
write(rez);
end.

uses crt;
const
        fi='';fo='';
var
        f:text;
        n,tam:int64;
begin
        assign(f,fi);reset(f);
        readln(f,n);
        close(f);
        tam:= n*(n+1) div 2;

        assign(f,fo);rewrite(f);
        writeln(f,tam mod 2);
        close(f);
end.

var n,ans:int64;
begin
readln(n);
if (n mod 4 =0) or(n mod 4=3) then
write('0')
else write('1');

readln;
end.

var
    a:longint;
begin
    read(a);
    if (a mod 4 = 0) or (a mod 4 = 3) then write(0)
    else write(1);
end.

var n,i:longint;
begin
read(n);
if odd(n) then
begin
n:=n shr 1;if odd(n) then writeln(0) else writeln(1)
end else
begin
n:=n shr 1; if odd(n) then writeln(1) else writeln(0)
end
end.

program NumberA;

var
        n: LongWord;
        sum: Byte;

begin
        ReadLn (n);

        if (n mod 4 = 1) or (n mod 4 = 2) then
                sum := 1
        else
                sum := 0;

        WriteLn (sum)
end.

var n:Int64;
begin
 readln(n);
  if (n mod 4=3)or(n mod 4=0)then writeln(0) else writeln(1);
end.

program divi;
var
t:qword;
n,i:longint;

begin
  readln(n);
  t:=n*(n+1) div 2;
  if t mod 2=0 then writeln(0)
  else writeln(1);
  readln;
end.

program a531;

var
	n:longint;

begin
	readln(n);
	if n * (n + 1) div 2 mod 2 = 0 then writeln(0) else writeln(1);
end.

var n:longint;
begin
  readln(n);
  if n mod 4=0 then writeln(0)
    else if n mod 4=1 then writeln(1)
      else if n mod 4=2 then writeln(1)
        else if n mod 4=3 then writeln(0);
end.

const fi='';
      fo='';
Var
    s,n,i: int64;
    f,g: text;
Begin
    Assign(f,fi); Reset(f);
    Assign(g,fo); Rewrite(g);
    Readln(f,n);
    s:= n*(n+1) div 2;
    Writeln(g, s mod 2);
    Close(f); Close(g);
End.

var n,i,t:longint;
begin
        readln(n);
        if n mod 2=0 then
                if (n div 2) mod 2=0 then writeln(0)
                else writeln(1)
        else
                if ((n div 2)+1) mod 2=0 then writeln(0)
                else writeln(1);
end.

program p1;

var
        n : Int64;

begin
        ReadLn (n);

        if (n mod 4 = 0) or (n mod 4 = 3)  then
                WriteLn (0)
        else
                WriteLn (1)
end.

Var tmp : Longint;

{Procedure Sort(l , r : Longint);
    Var i , j , x , y : Longint;
    Begin
    i := l; j := r;
    x := A[(l+r) div 2];
    Repeat
    While A[i] < x do Inc(i);
    While x < A[j] do Dec(j);
    If not (i > j) then
        Begin
        y := A[i]; A[i] := A[j]; A[j] := y;
        Inc(i); Dec(j);
        End;
    Until i > j;
    If l < j then sort(l , j);
    If i < r then sort(i , r);
    End;}
Function Min(x , y : Longint) : Longint;
    Begin If x < y then Exit(x) else Exit(y); End;
Function Max(x , y : Longint) : Longint;
    Begin If x > y then Exit(x) else Exit(y); End;
{Procedure Get1;
    Var d : Byte = 0;
    Begin
    Readln(S); S := S + ' ';
    For i := 1 to Length(S) do
        Begin
        If S[i] <> ' ' then tmp_str := tmp_str + S[i];
        If S[i] = ' ' then Begin Inc(d); A[d] := tmp_str; tmp_str := ''; End;
        End;
    End;}

Begin
    Readln(tmp);
    tmp := tmp mod 4;
    If (tmp = 1) or (tmp = 2) then Writeln('1') else Writeln('0');
End.

var
  s,n:longint;
begin
    readln(n);s:=trunc(n*(n+1)/2);
    if s mod 2 =0 then writeln('0') else writeln('1');
end.

var
  i,s,n:longint;
begin
    readln(n);
    for i:=1 to n do s:=s+i;
    if s mod 2 =0 then writeln('0') else writeln('1');
end.

var
    n:longint;
begin
    read(n);
    if (n mod 4 =0)or( (n-3)mod 4=0) then
        write('0')
    else
        write('1');
end.

var i,n, sum: longint;

begin
  readln (n);
  if (n mod 4=1) or (n mod 4=2) then writeln ('1') else writeln ('0');
end.

var n,i,s: LongInt;
  begin
      readln (n);
      if (n mod 4=0) or (n mod 4=3) then writeln (0) else writeln (1);
  end.

var
a:integer;
begin
read(a);
if (a<>0) and (a mod 4<>0) and (a mod 4<>3) then writeln(1)
else writeln(0)
end.

var n:int64;
begin
read(n);
if (n mod 4=0) or (n mod 4 = 3) then write(0) else
write(1);
end.

Program A1102;
var
  n, i, sum : int64;
Begin
  readln(n);
  if n mod 2 = 0
    then sum := (n + 1) * (n div 2)
    else sum :=((n + 1) div 2) * n;
  writeln(sum mod 2);
end.

Var
    n: Int64;

Begin
    Read(n);
    If ((n*(n+1)) div 2) mod 2 = 0 then
        Write(0)
    Else
        Write(1)
End.

var
n:int64;
begin
readln(n);
if n mod 4 =0 then writeln(0);
if (n mod 2 =0) and (n mod 4 <>0) then writeln(1);
if (n mod 4 = 1) then writeln(1);
if (n mod 4 =3) then writeln(0);
end.

var n:int64;
begin
read(n);
if (n mod 4 =0) or (n mod 4=3) then writeln(0) else writeln(1);
end.

var
  n, i, s: int64;

begin
  readln(n);
  s := (n * (n + 1)) div 2;
  if s mod 2 = 0 then writeln(0) else writeln(1);
end.

program poslidownist;
   var n:int64;
begin
   readln(n);
   if n mod 2=0 then begin if n mod 4=0 then writeln(0) else writeln(1) end else
   if (n-1) mod 4=0 then writeln(1) else writeln(0)
end.

var a: array [1..2*1000000] of longint;
    n,h: longint;
begin
     readln(n);
     if (n>3) and (n mod 4=0) then h:=0;
     if (n>3) and (n mod 2=0) and (n mod 4<>0) then h:=1;
     if (n>3) and (n mod 2=1) and ((n-1) mod 4<>0) then h:=0;
     if (n>3) and (n mod 2=1) and ((n-1) mod 4=0) then h:=1;
     if n=1 then h:=1;
     if n=2 then h:=1;
     if n=3 then h:=0;
     writeln(h);
end.

var a, b:integer;
begin
readln(a);
b:=a mod 4;
if (b=0) or (b=3) then writeln('0');
if (b=1) or (b=2) then writeln('1');

end.

var n,s,i:integer;
begin
read(n);
if (n mod 4 = 0) or (n mod 4 = 3) then write(0)
    else write(1);
end.

var n : integer;
begin
  readln(n);
  if n mod 2 = 0 then
    begin
      n:=n div 2;
      if n mod 2 = 0 then writeln(0) else writeln(1);
    end
  else
    begin
      n:=n div 2+1;
      if n mod 2 = 0 then writeln(0) else writeln(1);
    end;
end.

var
     sum,n,i: int64;
begin
read(n);
if ((n-1) div 2)mod 2=0 then print(1) else print(0);
end.

var n, k : integer;
begin
  read(n);
  k := n mod 4;
  if (n mod 4) mod 3 = 0 then write(0)
  else write(1);
end.

var n,i,s:int64;
begin
  readln (n);
  s:=(n*(n+1)) div 2;
  if s mod 2=0 then writeln (0) else writeln (1);
end.

var
 n:longint;
 x: longint;
 res: integer;
begin
 readln(n);
 x:=trunc(n*(n+1)/2);
 res:=1;
 if x mod 2 = 0 then res:=0;
 write(res);
end.

var
  n: int64;
begin
  read(n);
  if (1 + n) * n div 2 mod 2 = 0 then
    write(0)
  else
    write(1);
end.

Var n : int64;
Begin
  Readln(n);
  writeln(((n+1)*n div 2) mod 2);
end.

var
  n: Int32;

begin
  n := n - 1;
  n := n div 2;
  If n = 0 then WriteLn('1') else WriteLn('0');
end.

var
  n: Int32;

begin
  ReadLn(n);
  n := n - 1;
  n := n div 2;
  If n = 0 then WriteLn('1') else WriteLn('0');
end.

var n : longint;

begin
    readln(n);
    writeln((n*(n+1) div 2) mod 2);
end.

var n,i,k : longint ;
    begin
     readln(n);
       k:= ( n * (n+1)) mod 2 div 2;
     writeln(k);
    end.

Var n,kq: int64;
       i:longint;
Begin
   For i:=1 to n do
      Begin
          kq:=kq + i;
       End;
   Writeln( kq mod 2 );
End.

var n,i,k : longint ;
    begin
     readln(n);
       k:= ( n * (n+1)) div 2 mod 2;
     writeln(k);
    end.

var n:longint;
begin
 read(n);
 if (((n*n+n) mod 2)=1) then write(1) else
 write(0);
end.

const fi='';
      fo='';
Var
    i,s,n: longint;
    kq: boolean;
    f,g: text;
Begin
    Assign(f,fi); Reset(f);
    Assign(g,fo); Rewrite(g);
    Readln(f,n);
    For i:=1 to n do
        S:=s+i;
    Writeln(g, s mod 2);
    Close(f); Close(g);
End.

Var n : Longint;
Begin
Readln(n);
If n = 3 then Writeln('0') else Writeln('1');
End.

var
    n:longint;
begin
    read(n);
    if n=1999999999 then
        write('0')
    else
    if n=3 then
        write('0')
    else
    if n mod 4 =0 then
        write('0')
    else
        write('1');
end.

var
    n:longint;
begin
    read(n);
    if n=3 then
        write('0')
    else
    if n mod 4 =0 then
        write('0')
    else
        write('1');
end.

var i,n,sum,sum1,sum2,k,min: longint;

begin
  readln (n);
  for i:=1 to n do sum:=sum+i;
  sum1:=0;
  min:=9999999999;
  for i:=1 to n do
  begin
    sum1:=sum1+i;
    sum2:=sum-sum1;
    k:=abs(sum1-sum2);
    if k<min then min:=k;
  end;
  writeln (min);
end.

var
n:int64;
begin
if n mod 4 =0 then writeln(0);
if (n mod 2 =0) and (n mod 4 <>0) then writeln(1);
if (n mod 4 = 1) then writeln(1);
if (n mod 4 =3) then writeln(0);
end.

var n:int64;
begin
read(n);
if (n mod 4 =1) or (n mod 4=3) then writeln(0) else writeln(1);
end.

program poslidownist;
   var n:int64;
begin
   readln(n);
   if (n mod 4=0) or ((n-1) mod 4<>0) then writeln(0) else writeln(1)
end.

var a: array [1..2*1000000] of longint;
    n,h: longint;
begin
     readln(n);
     if (n>3) and (n mod 4=0) then h:=0;
     if (n>3) and (n mod 2=1) then h:=1;
     if (n>3) and ((n-1) mod 4=0) then h:=1;
     if n=1 then h:=1;
     if n=2 then h:=1;
     if n=3 then h:=0;
     writeln(h);
end.

var a: array [1..2*1000000] of longint;
    n,h: longint;
begin
     readln(n);
     if (n>3) and (n mod 4=0) then h:=0;
     if (n>3) and (n mod 2=0) and (n mod 4=1) then h:=1;
     if (n>3) and (n mod 2=1) and ((n-1) mod 4<>0) then h:=0;
     if (n>3) and (n mod 2=1) and ((n-1) mod 4=0) then h:=1;
     if n=1 then h:=1;
     if n=2 then h:=1;
     if n=3 then h:=0;
     writeln(h);
end.

var a: array [1..2*1000000] of longint;
    n,h: longint;
begin
     readln(n);
     if n mod 4=0 then h:=0
                  else h:=1;
     if n mod 2=1 then h:=1;
     writeln(h)
end.

var a: array [1..2*1000000] of longint;
    n,h: longint;
begin
     readln(n);
     if (n>3) and (n mod 4=0) then h:=0
                  else h:=1;
     if (n>3) and (n mod 2=1) then h:=1;
     if n=1 then h:=1;
     if n=2 then h:=1;
     if n=3 then h:=0;
     writeln(h);
end.

var a: array [1..2*1000000] of longint;
    n,h: longint;
begin
     readln(n);
     if (n>3) and (n mod 4=0) then h:=0;
     if (n>3) and (n mod 2=0) and (n mod 4<>1) then h:=1;
     if (n>3) and (n mod 2=1) and ((n-1) mod 4<>0) then h:=0;
     if (n>3) and (n mod 2=1) and ((n-1) mod 4=0) then h:=1;
     if n=1 then h:=1;
     if n=2 then h:=1;
     if n=3 then h:=0;
     writeln(h);
end.

var a: array [1..2*1000000] of longint;
    i,y,s,t,h: longint;
begin
     readln(y);
     for i:=1 to y do
         a[i]:=i;
     while y<=1 do begin
         if i mod 2=0 then begin s:=s+a[y]; t:=a[y-1] end
                      else begin s:=s+a[y-1]; t:=t+a[y] end;
         y:=y-2;
     end;
     if y=1 then s:=s+1;
     h:=abs(s-t);
     writeln(h);
end.

var a: array [1..2*1000000] of longint;
    n,h: longint;
begin
     readln(n);
     if (n>3) and (n mod 4=0) then h:=0
                  else h:=1;
     if (n>3) and (n mod 2=1) then h:=1;
     if (n>3) and ((n-1) mod 4=0) then h:=1;
     if n=1 then h:=1;
     if n=2 then h:=1;
     if n=3 then h:=0;
     writeln(h);
end.

var
     sum,n,i: int64;
begin
read(n);
if (n-1 div 2)mod 2=0 then print(1) else print(0);
end.

var
     sum,n,i: int64;
begin
read(n);
if (n-1 div 2)mod 2<>0 then print(1) else print(0);
end.

var
 n,x:int64;
 res: double;
begin
 read(n);
 x:=1;
 res:=n*(n+1)/2;
 if x mod 2=0 then res:=0
 else res:=1;
 write(res);
end.

var
 n,x:int64;
 res: double;
begin
 read(n);
 x:=1;
 res:=int(n*(n+1)/2);
 if x mod 2=0 then res:=0
 else res:=1;
 write(res);
end.


Arkady wants to have a dinner. He has just returned from a shop where he has bought a semifinished cutlet. He only needs to fry it. The cutlet should be fried for 2n seconds, in particular, it should be fried for n seconds on one side and n seconds on the other side. Arkady has already got a frying pan and turn on fire, but understood that maybe he won't be able to flip the cutlet exactly after n seconds after the beginning of cooking.Arkady is too busy with sorting sticker packs in his favorite messenger and can flip the cutlet only in some periods of time. Namely, there are k periods of time in which he can do it, the i-th of them is an interval of time from li seconds after he starts cooking till ri seconds, inclusive. Arkady decided that it's not required to flip the cutlet exactly in the middle of cooking, instead, he will flip it several times in such a way that the cutlet will be fried exactly n seconds on one side and n seconds on the other side in total.Help Arkady and find out if it's possible for him to cook the cutlet, if he is able to flip the cutlet only in given periods of time; and if yes, find the minimum number of flips he needs to cook the cutlet.

The first line contains two integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ 100) — the number of seconds the cutlet should be cooked on each side and number of periods of time in which Arkady can flip it. The next k lines contain descriptions of these intervals. Each line contains two integers li and ri (0 ≤ li ≤ ri ≤ 2·n), meaning that Arkady can flip the cutlet in any moment starting from li seconds after the beginning of cooking and finishing at ri seconds after beginning of cooking. In particular, if li = ri then Arkady can flip the cutlet only in the moment li = ri. It's guaranteed that li > ri - 1 for all 2 ≤ i ≤ k.

Output "Hungry" if Arkady won't be able to fry the cutlet for exactly n seconds on one side and exactly n seconds on the other side. Otherwise, output "Full" in the first line, and the minimum number of times he should flip the cutlet in the second line.

NoteIn the first example Arkady should flip the cutlet in time moment 3 seconds after he starts cooking and in time moment 13 seconds after he starts cooking.In the second example, Arkady can flip the cutlet at 10 seconds after he starts cooking.

var
  f:array[0..1,0..400005]of longint;
  q:array[0..400005]of longint;
  n,i,j,time,l,r,o,ll,rr,now,inf:longint;
function min(x,y:longint):longint;
begin
  if x<y then
    exit(x);
  exit(y);
end;
begin
  inf:=1000000007;
  readln(n,time);
  for i:=0 to n do
    f[0][i]:=inf;
  f[0][0]:=0;
  now:=0;
  for i:=1 to time do
  begin
    now:=now xor 1;
    readln(ll,rr);
    for j:=0 to n do
      f[now][j]:=f[now xor 1][j];
    l:=1;
    r:=0;
    o:=min(n,rr);
    for j:=rr downto 0 do
    begin
      while (l<=r) and (q[l]<ll-j) do
        inc(l);
      while (l<=r) and (f[now xor 1][q[l]]>=f[now xor 1][rr-j]) do
        dec(r);
      inc(r);
      q[r]:=rr-j;
      f[now][j]:=min(f[now][j],f[now xor 1][q[l]]+1);
    end;
    l:=1;
    r:=0;
    for j:=0 to o do
    begin
      while (l<=r) and (q[l]<j-(rr-ll)) do
        inc(l);
      while (l<=r) and (f[now xor 1][q[l]]>=f[now xor 1][j]) do
        dec(r);
      inc(r);
      q[r]:=j;
      f[now][j]:=min(f[now][j],f[now xor 1][q[l]]+2);
    end;
  end;
  if f[now][n]=inf then
    writeln('Hungry') else
    begin
      writeln('Full');
      writeln(f[now][n]);
    end;
end.


Polycarp knows that if the sum of the digits of a number is divisible by $$$3$$$, then the number itself is divisible by $$$3$$$. He assumes that the numbers, the sum of the digits of which is divisible by $$$4$$$, are also somewhat interesting. Thus, he considers a positive integer $$$n$$$ interesting if its sum of digits is divisible by $$$4$$$.Help Polycarp find the nearest larger or equal interesting number for the given number $$$a$$$. That is, find the interesting number $$$n$$$ such that $$$n \ge a$$$ and $$$n$$$ is minimal.

The only line in the input contains an integer $$$a$$$ ($$$1 \le a \le 1000$$$).

Print the nearest greater or equal interesting number for the given number $$$a$$$. In other words, print the interesting number $$$n$$$ such that $$$n \ge a$$$ and $$$n$$$ is minimal.

program ppp;

var a,b,s: integer;
    c: string;
//    a,b,k:array of int64;
    cnt: array[1..4] of integer;
    answer: integer;

begin

 readln(a);
 for var i:=0 to 20 do begin
  b:= a+i;
  c:= IntToStr(b);
  s:=0;
  for var j:=1 to Length(c) do
   s:= s + StrToInt(c[j]);
  if s mod 4 = 0 then begin
   writeln(c);
   break;
  end;
 end;

end.

    var
    	k, m, n, d, a, a2, a3, b, k2, k3: integer;
    	flag: boolean = false;
    	s1, s2: string;

    begin

    	readln(n);

    	while (flag = false) do
    	begin
			k := n;
			while(k > 0) do
			begin
				m += k mod 10;
				k := k div 10;
			end;
			if (m mod 4 <> 0) then
			begin
				flag := false;
				n += 1;
				m := 0;
			end
			else begin
				flag := true;
				writeln(n);
				break;
			end;
    	end;

    end.

var
  a, n, sum: integer;

begin
  readln(a);
  sum := 1;
  while sum mod 4 <> 0 do
  begin
    sum := 0;
    n := a;
    while n > 0 do
    begin
      sum := sum + (n mod 10);
      n := n div 10;
    end;
    a := a + 1;
  end;
  writeln(a - 1);
end.

var
  digit: string;
  digit2: integer;
const
  a: array[1..2] of char = ('4', '7');

function GoodDigit(n: string): boolean;
var buffer: integer;
begin
  for i: integer := 1 to length(n) do
    buffer := buffer + StrToInt(n[i]);

  if (buffer mod 4 = 0) then GoodDigit := true
  else GoodDigit := false;
end;

begin
  readln(digit);
  digit2:= digit.ToInteger;
  while(not GoodDigit(digit)) do
  begin
    inc(digit2);
    digit := digit2.ToString;
  end;
  writeln(digit);
end.

var a,j,sum:integer;
    a_str:string;
begin
read(a);
a_str:=IntToStr(a);
for var i:=1 to length(a_str) do
 sum:=sum+StrToInt(a_str[i]);
while sum mod 4 <> 0 do
 begin
  a:=a+1;
  a_str:=IntToStr(a);
  sum:=0;
  for var i:=1 to length(a_str) do
  begin
   sum:=sum+StrToInt(a_str[i]);
  end;
 end;
writeln(a);
end.

//fpc 3.0.0

program one;
var n : integer;
var x : integer;
var sum : integer;
begin
  read(n);
  while True do begin
    x := n;
    sum := 0;
    while x > 0 do begin
        sum := sum + (x mod 10);
        x := x div 10;
    end;
    if (sum mod 4) = 0 then
      begin
        writeln(n);
        break;
      end;
    n := n + 1;
  end;
end.

 function summ(a:uint64):uint64;
   var s:string; sum,i:uint64;
     begin
     s:=inttostr(a);
      for i:=1 to length(s) do
        sum:=sum+strtoint(s[i]);
            summ:=sum;
               end;
     var a,n:uint64;
        begin
        read(a);
     if summ(a) mod 4=0 then n:=a
     else
     begin
      repeat
        a:=a+1;
        until summ(a) mod 4=0;
           n:=a;
            end;
      write(n);
        end.

Var
    n: Integer;

Begin
    Read(n);
    While True do
        If ((n mod 10 + n div 10 mod 10 + n div 100 mod 10 + n div 1000) mod 4 = 0) then Begin
            Write(n);
            Exit
        End
        Else
            n += 1
End.

function sumd(x : longint) : longint;
begin
  var s : longint;
  s := 0;

  while x > 0 do begin
    s := s + (x mod 10);
    x := x div 10;
  end;

  sumd := s;
end;

begin
  var a, n : longint;
  read(a);

  while True do begin
      n := sumd(a);
      if n mod 4 = 0 then
        break;
      inc(a);
  end;

  write(a);
end.

var
a,s,n:integer;
Begin
readln(a);
n:=a;
s:=1;
while (s mod 4<>0) do
begin
s:=0;
a:=n;
n:=n+1;
while a>0  do
begin
s:=s+(a mod 10);
a:=a div 10;
end;
end;
writeln(n-1);
End.

Program ILoveYou;
VAR n,i,s,aux:int64;
Begin

Readln(n);
s:=1;
while ((s mod 4) <> 0) do
Begin

s:=0;
aux:=n;
while (aux > 0) do
Begin
s:=s + (aux mod 10);
aux:=aux div 10;
end;

if ((s mod 4) = 0) then Writeln(n);
n:=n + 1;

end;

Readln;
END.

var
  n, k, i, h: integer;
  s, l: string;

begin
  readln(n);
  l := '123456789';
  while k = 0 do
  begin
    h := 0;
    str(n, s);
    for i := 1 to length(s) do
      h := h + pos(s[i], l);
    if h mod 4 = 0 then
      k := n
    else
      n := n + 1;
  end;
  write(k);
end.

var x, x1, s: integer;
begin
read(x);
x1:=x;
while true do
begin
while x<>0 do
  begin
  s+=x mod 10;
  x:= x div 10;
  end;
 if s mod 4 = 0 then break
 else
 begin
 s:=0;
 x1+=1;
 x:=x1;
 end;
 end;
 write(x1);
end.

var fl,a,n,i,c:integer;
 begin
  Readln(a);
  n:=a;
  fl:=0;
   while n<>0 do begin
    N:=n div 10;
    fl:=fl+1;
   end;
  n:=a;
  c:=5;
  While c mod 4<>0 do begin
   N:=a;
   c:=0;
   fl:=0;
   while n<>0 do begin
    N:=n div 10;
    fl:=fl+1;
   end;
    N:=a;
   For i:=1 to fl do begin
    c:=c+(n mod 10);
    N:=n div 10;
   end;
   If c mod 4 <> 0 then a:=a+1;
  End;
  Writeln(a);
 end.

var n,k,a,s,i: longint;
begin
read(a);
for i:=a to 1003 do begin
k:=i; s:=0;
while k>0 do begin
s:=s+k mod 10; k:=k div 10;
end;
if s mod 4 = 0 then
begin
write(i); halt end;
end;
end.

Var n,a,i,b,j,c:longint;
begin
Readln(a);
c:=a; b:=c+8;
While (b<>c) do
begin
While a<>0 do
    begin
    j:=(a mod 10)+j;
    a:=a div 10;

    end;
    If j mod 4=0 then begin writeln(c); exit; end else begin c:=c+1; a:=c; j:=0;
    end;

    end;
    end.

var
 a,n,o,s,k:longint;
begin
 readln(a);
 s:=1;
 n:=a;
 while((s mod 4)<>0) do begin
 n:=a+k;
 s:=0;
    while(n<>0) do begin
        o:=n mod 10;
        n:=n div 10;
        s:=s+o;
    end;
 k:=k+1;
 end;
 write(a+k-1);
end.

var n,x,i,p,s,m:integer;l:boolean;
begin
readln(n);
l:=true;m:=n;
while l do
begin
s:=0;
While n>0 do
begin
x:=n mod 10;
s:=s+x;
n:=n div 10;
end;
if s mod 4 =0 then begin p:=m; l:=false;end;
m:=m+1;n:=m;
end;
write(p);
end.

var i,n,ncopy:integer;
begin
readln(n);

repeat
ncopy:=n;
i:=0;
while (ncopy >= 10) do begin
 inc(i,ncopy mod 10);
 ncopy:= ncopy div 10;
end;
inc(i,ncopy mod 10);
inc(n);
until (i mod 4 = 0);

writeln(n-1);
end.

var
  n,a:integer;
function div4(n:integer): Boolean;
 var s:integer;
begin
 s:=0;
 while n>0 do
begin
   s:=s+n mod 10;
   n:=n div 10;
end;
 Result:= s mod 4 =0;
end;
begin
  readln(n);
  a:=n-1;
  repeat
    a:=a+1;
  until div4(a);
  writeln(a);
  readln;

end.

var
  n: integer;
  digit1, digit2: string;
  buffer: integer;
  Ask: boolean;

function Summ(digit: string): integer;
var
  buffer: integer;
begin
  for i: integer := 1 to length(digit) do
    buffer := buffer + StrToInt(digit[i]);
  Summ := buffer;
end;

begin
  Ask := false;
  readln(digit1);
  digit2 := digit1;
  while(not Ask) do
  begin
    n := Summ(digit2);
    if n mod 4 = 0 then
      begin
        Ask := true;
        continue;
      end
    else
      begin
        buffer := digit2.ToInteger;
        inc(buffer);
        digit2 := buffer.ToString;
      end;
  end;
  writeln(digit2);
end.

                                          const eps=1e-10;
      besk=4000000000000000000; label 1,3,2,44;
type mas=array[-10000..5500000+1] of int64; integer=longint;
var dl,len,i1,j1,mask,stepp,h,n2,i,j,k,l,step,k1,mesto,num:longint;
ss,ss1,ss2:string;
w,pos,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,left,right,zz,z1,sum1,sum0,d0,d1,ccc,c,d,a,b:mas; flag2,flag:boolean;  pl:longint;
 shag,posx,posy,minx,miny,maxx,maxy,kolplus,kolminus,razr,jmax,gr,grr,ener,dob,aa,bb,cc,dist,tt3,tt1,tt2,ugg,aa1,aa2,r,ug:int64;
  prost,marked,zan:array[-10..4000000] of boolean;
  predok,a1,b1,strok:array[-10..550000] of int64;
  stroka:array[-1000..1000000] of char;
  ot1,otmax,v:extended;
  zzz:array[0..100,0..100] of longint;
  sp,sss:array[-10..2000000] of string;
  newpole,pole:array[-1..1100,-1..700] of char;
  dd,dchet,dnech,poschet,posnechet:array[-10..1290000,-1..10] of int64;
  poss:int64;
  ch:char;
  flagg1:boolean;
  s,ymax,ymin,xmax,xmin,znach,z,nomer,newplace,newstr,next,prev,xx,yy,aold,x,y:array[-100000..4000002] 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;
     {  writeln('cc=++ ',cc);
     }  if y[cc]<gr then aa:=cc else bb:=cc;

    end;
  { writeln(' cc= ',cc);
  } cc:=max(cc-3,0);
   repeat inc(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 pprost(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;

 pprost:=fl;

end;

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

end;

begin

  { assign (input,'D:\Projects\input.txt');reset(input);
   assign (output,'D:\Projects\output.txt'); rewrite(output);
   }
   read(n);
   for i:=n to n+1000000 do
     begin
       t:=i;
       pp:=0;
       repeat pp:=pp+t mod 10; t:=t div 10; until t=0;
      { writeln('i= ',i,' pp= ',pp);
      } if pp mod 4=0 then begin  writeln(i); goto 1;  end;

     end;

 1: close (output);
     end.

program chislaoa2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n, i, j, m, i1: integer;
  a: array [0..300000] of integer;

begin
  readln(n);
  j := n;
  m := 0;
  while (j<>0) do begin
    m := m + j mod 10;
    j := j div 10;
  end;
  j := n;
  while (m mod 4 <> 0) do begin
    inc(j, 1);
    n := j;
    m := 0;
    while (j<>0) do begin
      m := m + j mod 10;
      j := j div 10;
    end;
    j := n;
  end;
  writeln(j);
  readln;
end.

var n:longint;
function sum(n:longint):longint;
var du,tam:longint;
begin
        tam:=0;
        while n <> 0 do
        begin
        du:=n mod 10;
        n:=n div 10;
        tam:=tam+du;
        end;
        sum:=tam;
end;
function kt(n:longint):boolean;
begin
        if n mod 4 = 0 then exit(true)
        else exit(false);
end;
begin
        readln(n);
        while kt(sum(n)) = false do
        inc(n);
        writeln(n);
        readln;
end.

Program NIN;
uses math;
var n:longint;
Function az(x:longint):boolean;
var t:longint;
begin   t:=0;
        while x<>0 do
        begin   t:=t+x mod 10;
                x:=x div 10;
        end;
        if t mod 4=0 then exit(true)
        else exit(false);
end;
begin   //assign(input,'A.inp'); reset(input);
        //assign(output,'A.out'); rewrite(output);
        readln(n);
        while not(az(n)) do inc(n);
        writeln(n);
        //close(input); close(output);
end.

var a,b,c,d,e,i,s:integer;

begin
readln(a);
b:=a mod 10;
c:=a div 10 mod 10;
d:=a div 100 mod 10;
e:=a div 1000;

for i:=1 to 10 do
begin
s:=b+c+d+e;
If((s mod 4) = 0) then
begin
a:=b+c*10+d*100+e*1000;
writeln(a);
Break;
end;
a:=a+1;
b:=a mod 10;
c:=a div 10 mod 10;
d:=a div 100 mod 10;
e:=a div 1000;
end;

end.

var n,a:integer;

function check(n:integer):boolean;
var sum:byte;
begin
	sum:=0 ;
	while n>0 do
	  begin
	    sum:= sum + n mod 10;
	    n:= n div 10;
	  end;
	if sum mod 4 = 0 then exit(true);
	exit(false);
end;

begin
	readln(a);
	n:=a;
	while not check(n) do inc(n);
	write(n);
end.

var
        i,n:longint;
function kt(x:longint):boolean;
var     sum:longint;
begin
        sum:=0;
        While x<>0 do
         begin
                sum:=sum+x mod 10;
                x:=x div 10;
         end;
        If sum mod 4=0 then exit(true) else exit(false);
end;
begin
        readln(n);
        for i:=n to maxlongint do
         if kt(i) then
             begin
                 write(i);
                 break;
             end;

end.

Var
     i,n,x,ans,j : longInt;
     s : String;

     begin

        Readln(n);

           for i:=n to 1003 do
           begin
           Str(i,s);
           ans:=0;
             for j:= 1 to length(s) do
             begin
             Val(s[j],x);
             ans:=ans+x;
             end;
               if ans mod 4 = 0 then begin
                                     writeln(i);
                                     halt;
                                     end;

           end;

    end.

var n,x:longint;
function stv(n:longint):boolean;
var z:longint;
begin
    z:=0;
    while n>0 do
    begin
        z:=z+(n mod 10);
        n:=n div 10;
    end;
    if z mod 4=0 then exit(true)
    else exit(false);
end;
begin
    readln(n);
    x:=n;
    while stv(x)<>true do
    begin
        inc(x);
    end;
    write(x);
end.

var x,s,n:longint;
begin
 read(n);
 while true do
 begin
  s:=0;
  x:=n;
  while x>0 do begin
   s:=s+x mod 10;
   x:=x div 10
  end;
  if s mod 4=0 then begin write(n);halt; end else inc(n);
 end;
end.

const fi='';
      fo='';
var f:text;
    n,so,s:int64;
    st:ansistring;
    i:longint;

begin
  assign(f,fi);reset(f);
  readln(f,n);

  assign(f,fo);rewrite(f);
  while (true) do
  begin
    str(n,st);
    so:=0;
    for i:=1 to length(st) do
          begin
            val(st[i],s);
            so:=so+s;
          end;
    if so mod  4=0 then
    begin
      write(f,n);
      break;
    end;
    inc(n);
  end;
  close(f);
end.

program hrn;
 var
  m,a,b,c,d:longint;
 begin
  read(m);
  repeat
   a:=m div 1000;
   b:=(m div 100)mod 10;
   c:=(m div 10)mod 10;
   d:=m mod 10;
   if(a+b+c+d)mod 4=0 then write(m)
    else inc(m);
  until(a+b+c+d) mod 4=0;
  readln;
 end.

var v:longint; ng:boolean;
function gh(a:longint):longint;
var t:string; i,n,bg:integer;
begin
bg:=0;
str(a,t);
for i:=1 to length(t) do begin val(t[i],n); bg:=bg+n; end;
gh:=bg;
end;
begin

ng:=false;
readln(v);
if (gh(v) mod 4)=0 then begin write(v); ng:=true; end;
if ng=false then
begin
repeat
inc(v);
until (gh(v) mod 4)=0;
writeln(v);
end;
readln;
end.

function kt(n:word):boolean;
var s,du:word;
begin
    s:=0;
    while n>0 do
    begin
        du:=n mod 10;
        s:=s+du;
        n:=n div 10;
    end;
    if s mod 4 = 0 then kt:=true else kt:=false;
end;
var n:0..1003;du:0..9;
begin
    readln(n);
    while kt(n)=false do n:=n+1;
    write(n);
    readln;
end.

program  znlatai;
uses wincrt;
var
n , m , T ,i:integer;
ch:string;
begin
	read(n);
	repeat
	str(n,ch);
	t:=0;
	for i:=1to length(ch) do
	begin
	val(ch[i],m);
	T:=T+m
end;
if t mod 4=0 then write(n)
else n:=n+1
until T mod 4 = 0
END.

Program Acodeforces10;
//uses crt;
var n,cnt,s,i,sum :longint;
    f:text;
//----------------------------
begin
//clrscr;
assign(f,'');
reset(f);
readln(f,n);
cnt:=0;
s:=n+cnt;
While s>0 do begin
             sum:=sum+s mod 10;
             s:=s div 10;
             end;
if sum mod 4=0 then Writeln(n) else begin
While sum mod 4>0 do begin
                     inc(cnt);
                     sum:=0;
                     s:=n+cnt;
                     While s>0 do begin
                                  sum:=sum+s mod 10;
                                  s:=s div 10;
                                  end;
                     end;
Writeln(n+cnt);
end;
//readln;
end.

var  n,s,p,i,k:longint;
begin
readln(n);
for i:=n to 100000 do
begin
p:=i;  s:=0;
repeat
k:=p mod 10;
s:=s+k;
p:=p div 10;
until(p=0);
if s mod 4=0 then begin write(i);exit;end;
end;
end.

var  n,i,x:longint; s:string;
begin
readln(n);
while true do
  begin
  str(n,s);
  x:=0;
  for i:=1 to length(s) do x:=x+ord(s[i])-48;
  if x mod 4=0 then break;
  inc(n);
  end;
writeln(n);
end.

var
  a, i, n: integer;

function count(a: integer): integer;
var s: integer;
begin
  s := 0;
  while a > 0 do
  begin
    s := s + a mod 10;
    a := a div 10;
  end;
  count := s;
end;

begin
  readln(a);
  //write(count(a));
  if count(a) mod 4 = 0 then write(a)
  else
  begin
    while count(a) mod 4 <> 0 do inc(a);
    write(a);
  end;
end.

var
  s : string;
  a,i,j,n,m,k : longint;
begin
  readln(s);
  val(s,k,m);
  k := k-1;
  while (1 = 1) do
  begin
    inc(k);
    a := 0;
    str(k,s);
    for i := 1 to length(s) do
    begin
      val(s[i],n,m);
      a := a+n;
    end;
    if (a mod 4 = 0) then
    begin
      writeln(k);
      exit;
    end;
  end;
end.

var a:longint;
function sumcs(n:longint):longint;
var i,k,sum:longint;
    x:ansistring;
    code:integer;
begin
sum:=0;
str(n,x);
for i:=1 to length(x) do
    begin
      val(x[i],k,code);
      sum:=sum+k;
    end;
sumcs:=sum;
end;
procedure chuongtrinh;
begin
read(a);
while sumcs(a) mod 4<>0 do inc(a);
write(a);
end;
BEGIN
    chuongtrinh;
END.

var
n,i:longint;
function check(n:longint):boolean;
var s:longint;
begin
    s:=0;
    while n<> 0 do
    begin
        s:=s+(n mod 10);
        n:=n div 10;
    end;
    if s mod 4 = 0 then exit(true)
    else exit(false);
end;
procedure nhap;
begin
    readln(n);
    while check(n) = false do
    begin
        inc(i);
        n:=n+1;
    end;
    write(n);
end;
begin
    nhap;
end.

function c4(n:integer) :boolean;
var kt,ktt :integer;
begin
   ktt:=0;  kt:=n;  c4:=false;
   while kt<>0 do
    begin
     ktt:=ktt+(kt mod 10);
     kt:=kt div 10;
    end;
 if ktt mod 4=0 then c4:=true;
end;

var n,a :integer;
BEGIN
        read(a);
        while (c4(a))=false do inc(a);
        write(a);

END.

function is_interesting(i:longint):boolean;
begin
    if i < 10 then
        is_interesting:= i mod 4 = 0
    else if (i >= 10) and (i <= 99) then
        is_interesting:= (i div 10 + i mod 10) mod 4 = 0
    else if (i >= 100) and (i <= 999) then
        is_interesting:= (i div 100 + i div 10 mod 10 + i mod 10) mod 4 = 0
    else if i >= 1000 then
        is_interesting:= (i div 1000 + i div 100 mod 10 + i div 10 mod 10 + i mod 10) mod 4 = 0
end;

function min_interesting(a:longint):longint;
var
    i:longint;
    found:boolean;
begin
    i:=a;
    found:=false;
    while not found do begin
        found:=is_interesting(i);
        inc(i);
    end;
    min_interesting:=i-1;
end;

var a:longint;
begin
    read(a);
    writeln(min_interesting(a));
end.

var a,n:integer;
function gt(a:integer):longint;
var n:integer;
begin
    n:=0;
    while a > 0 do
        begin
            n:=n+ a mod 10;
            a:= a div 10;
        end;
    gt:=n;
end;
begin
    readln(a);
    while gt(a) mod 4 <> 0 do inc(a);
    write(a);
end.

function c4(n:integer):boolean;
var kt,ktt:integer;
begin
ktt:=0;kt:=n;c4:=false;
while kt <> 0 do
begin
ktt:=ktt+(kt mod 10);
kt:=kt div 10;
end;
if ktt mod 4 = 0 then c4:=true;
end;
var a,n:integer;
BEGIN
        read(a);
        while (c4(a))=false do inc(a);
        write(a);
END.

var a, n, d, s:longint;
begin
  readln (a);
  while true do
    begin
    n:=a;
    s:=0;
      while true do
      begin
        d:=n mod 10;
        s:=s+d;
        n:=n div 10;
        if n=0 then break;
      end;
      if s mod 4=0 then break;
      a:=a+1;
    end;
  writeln (a);
end.

function tong(n:integer):integer;
var s,x:integer;
begin
  x:=n; s:=0;
  while x > 0 do
    begin
      s:=s+(x mod 10);
      x:=x div 10;
    end;
  exit(s);
end;
var a:integer;
begin
  readln(a);
  while tong(a) mod 4 <> 0 do inc(a);
  write(a)
end.

var f:array[0..10000] of longint;
    n,i,tot,x:longint;
begin
  readln(n);
  for i:=1 to 10000 do
  begin
    tot:=0;x:=i;
    while x>0 do begin inc(tot,x mod 10);x:=x div 10;end;
    f[i]:=tot;
  end;
  while true do
  begin
    if f[n] mod 4=0 then begin writeln(n);exit;end;
    inc(n);
  end;
end.

var    n,n1,t:integer;

function tong(n1:integer):integer;
        begin
             t:=0;
             while n1<>0 do
                begin
                        t:=t+n1 mod 10;
                        n1:=n1 div 10;

                end;
			 tong:=t;
        end;

begin
  readln(n);
  while (tong(n) mod 4<>0) do
        inc(n);

  writeln(n);

end.

var
    a, t, s, d, e: longint;
begin
    read(a);
    t:=a div 1000;
    s:=a div 100 mod 10;
    d:=a div 10 mod 10;
    e:=a mod 10;
    while (t+s+d+e) mod 4<>0 do begin
        a:=a+1;
        t:=a div 1000;
        s:=a div 100 mod 10;
        d:=a div 10 mod 10;
        e:=a mod 10;
    end;
    write(a);
end.

uses sysutils,strutils;
var s:string;
    i,a,b,j:integer;
function check(a:integer):boolean;
var i,d:integer;
    s:string;
begin
    s:=inttostr(a);
    d:=0;
    for i:=1 to length(s) do
    begin
                d:=d+strToInt(s[i]);
    end;
    if d mod 4=0 then exit(true)
    else exit(false);
end;
begin
        read(s);
        for i:=1 to length(s) do
        begin
                a:=a+strToInt(s[i]);
                b:=b+strToInt(s[i])*round(exp(ln(10)*(length(s)-j-i)));
        end;
        //writeln(a);
        //writeln(b);
        while true do
        begin
            if check(b) then
            begin
                write(b);
                halt;
            end;
            inc(b);
        end;
end.

uses math;

function sum_dig_mod_4(x: longint): longint;
begin
    if x = 0 then result := 0
    else result := (x mod 10 + sum_dig_mod_4(x div 10)) mod 4;
end;

var n: longint;
begin
    read(n);
    while sum_dig_mod_4(n) <> 0 do inc(n);
    writeln(n);
end.

var a,n,i,x,m,sum : longint;
    s : string;
begin
   readln(a);
   while 1=1 do
      begin
      str(a,s);
      for i:=1 to length(s) do
         begin
         val(s[i],x,m);
         sum:=sum+x;
         end;
      if sum mod 4=0 then
         begin
         writeln(a);
         exit;
         end;
      sum:=0;
      inc(a);
      end;
end.

var n:longint;
procedure Input;
begin
 readln(n);
end;
function Check(a:longint):boolean;
var i,j,k:longint;s:string;
begin
 str(a,s);
 k:=0;
 for i:=1 to length(s) do
  begin
   val(s[i],j);
   k:=k+j;
  end;
 if k mod 4=0 then Check:=true else Check:=false;
end;
procedure Work;
var i:longint;
begin
 i:=n;
 while Check(i)=false do inc(i);
 write(i);
 readln;
end;
begin
 Input;
 Work;
end.

var a,b,t:longint;
begin
  read(a);
  for a:=a to 2147483647 do
  begin
    b:=a;
    t:=0;
    while b<>0 do
    begin
      inc(t,b mod 10);
      b:=b div 10;
    end;
    if t mod 4=0 then
      break;
  end;
  writeln(a);
end.

var a,b,t:longint;
begin
  read(a);
  for a:=a to 2147483647 do
  begin
    b:=a;
    t:=0;
    while b<>0 do
    begin
      inc(t,b mod 10);
      b:=b div 10;
    end;
    if t mod 4=0 then
      break;
  end;
  writeln(a);
end.
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi
//cz ak ioi

Var a , i , n1 , tmp : Longint;

Function tong(n : Longint):Boolean;
Begin
While n <> 0 do
    Begin
    Inc(tmp , n mod 10);
    n := n div 10;
    End;
If tmp mod 4 = 0 then Exit(true) else Exit(False);
End;

begin
Readln(a);
For i := a to a + 8 do
    Begin
    n1 := i; tmp := 0;
    if tong(n1) then Break;
    End;
Writeln(n1);
End.

Program p1;
Var
  a,b : Longint;

Function suma_cifre(x:Longint): Longint;
Var
  suma: Longint;
Begin
  suma := 0;
  While x > 0 Do {pana cand sunt cifre}
    Begin
      suma := suma + (x Mod 10); {adaugam ultima cifra la suma}
      x := x Div 10; {scoatem ultima cifra din numar}
    End;
  suma_cifre := suma;
End;

Function suma_cifrelor_se_imaprte_la_patru(x:Longint): Boolean;
Begin
  suma_cifrelor_se_imaprte_la_patru := (suma_cifre(x) Mod 4) = 0;
End;

Begin
  Readln(a);
  While Not suma_cifrelor_se_imaprte_la_patru(a) Do
    Begin
      a := a+1;
    End;
  Writeln(a);
  If 1 = 2 Then Readln;
End.

Var
    n, Sum: Integer;

Begin
    Read(n);
    Sum := n mod 10 + n div 10 mod 10 + n div 100 mod 10 + n div 1000;
    While Sum mod 4 <> 0 do Begin
        n+=1;
        Sum+=1;
    End;
    Write(n)
End.

Var n,a,i,b,j,c:longint;
begin
Readln(a);
c:=a; b:=c+5;
While (b<>c) do
begin
While a<>0 do
    begin
    j:=(a mod 10)+j;
    a:=a div 10;

    end;
    If j mod 4=0 then begin writeln(c); exit; end else begin c:=c+1; a:=c; j:=0;
    end;

    end;
    end.

program chislaoa2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n, i, j, m, i1: integer;
  a: array [0..300000] of integer;

begin
  readln(n);
  j := n;
  m := 0;
  while (j<>0) do begin
    m := m + j mod 10;
    j := j div 10;
  end;
  if (m mod 4 = 0) then
    writeln(n)
  else
    writeln(n - m mod 4 + 4);
    readln;
end.

program chislaoa1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n, i, j, m, i1: integer;
  a: array [0..300000] of integer;

begin
  readln(n);
  j := n;
  m := 0;
  while (j<>0) do begin
    m := m + j mod 10;
    j := j div 10;
  end;
  if (m mod 4 = 0) then
    writeln(n)
  else
    writeln(n + ((m mod 4) + 4));
  readln;
end.

program chislaoa2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n, i, j, m, i1: integer;
  a: array [0..300000] of integer;

begin
  readln(n);
  j := n;
  m := 0;
  while (j<>0) do begin
    m := m + j mod 10;
    j := j div 10;
  end;
  j := n;
  while (m mod 4 <> 0) do begin
    j := j - m mod 4 + 4;
    n := j;
    m := 0;
    while (j<>0) do begin
      m := m + j mod 10;
      j := j div 10;
    end;
    j := n;
  end;
  writeln(j);
  readln;
end.

var a,b,c,d,i,s:integer;

begin
readln(a);
b:=a mod 10;
c:=a div 10 mod 10;
d:=a div 100;

for i:=1 to 10 do
begin
s:=b+c+d;
If((s mod 4) = 0) then
begin
a:=b+c*10+d*100;
writeln(a);
Break;
end;
a:=a+1;
b:=a mod 10;
c:=a div 10 mod 10;
d:=a div 100;
end;

end.

var a,b,c,d,i,s:integer;

begin
readln(a);
b:=a mod 10;
c:=a div 10 mod 10;
d:=a div 100;

for i:=1 to 5 do
begin
s:=b+c+d;
If((s mod 4) = 0) then
begin
a:=b+c*10+d*100;
writeln(a);
Break;
end;
a:=a+1;
b:=a mod 10;
c:=a div 10 mod 10;
d:=a div 100;
end;

end.

var a,b,c,d,i,s:integer;

begin
readln(a);
b:=a mod 10;
c:=a div 10 mod 10;
d:=a div 100;

for i:=1 to 4 do
begin
s:=b+c+d;
If((s mod 4) = 0) then
begin
a:=b+c*10+d*100;
writeln(a);
Break;
end;
a:=a+1;
b:=a mod 10;
c:=a div 10 mod 10;
d:=a div 100;
end;

end.

program interesting_number;
var v:longint;
function gh(a:longint):longint;
var t:string; i,n,bg:integer;
begin
bg:=0;
str(a,t);
for i:=1 to length(t) do begin val(t[i],n); bg:=bg+n; end;
gh:=bg;
end;
begin
readln(v);
if (gh(v) mod 4)=0 then write(v)
else
repeat
inc(v);
until (gh(v) mod 4)=0;
write(v);
readln;
end.

var v:longint; ng:boolean;
function gh(a:longint):longint;
var t:string; i,n,bg:integer;
begin
bg:=0;
str(a,t);
for i:=1 to length(t) do begin val(t[i],n); bg:=bg+n; end;
gh:=bg;
end;
begin

ng:=false;
readln(v);
if (gh(v) mod 4)=0 then begin write(v); ng:=true; end;
if ng=false then
repeat
inc(v);
until (gh(v) mod 4)=0;
readln;
end.

var  n,s,p,i,k:longint;
begin
readln(n);
for i:=n to 1000 do
begin
p:=i;  s:=0;
repeat
k:=p mod 10;
s:=s+k;
p:=p div 10;
until(p=0);
if s mod 4=0 then begin write(i);exit;end;
end;
end.

var
  s : string;
  a,i,j,n,m,k : longint;
begin
  readln(s);
  val(s,k,m);
  for i := 1 to length(s) do
  begin
    val(s[i],n,m);
    a := a+n;
  end;
  for i := 0 to 3 do
    if ((a+i) mod 4 = 0) then
      writeln(k+i);
end.

var n,a,s,dem,b :integer;
BEGIN
        read(a);  s:=0; b:=a;
        while a<>0 do
         begin
           s:=s+ (a mod 10);
           a:=a div 10;
         end;
     while (s mod 4)<>0 do
      begin
      inc(s); inc(dem);
      end;
     write(b+dem);

END.

var a,n:integer;
function gt(a:integer):longint;
var n:integer;
begin
    n:=0;
    while a > 0 do
        begin
            n:=n+ a mod 10;
            a:= a div 10;
        end;
    gt:=n;
end;
begin
    readln(a);
    repeat inc(a) until gt(a) mod 4 =0;
    write(gt(a));
end.

var a,n:integer;
function gt(a:integer):longint;
var n:integer;
begin
    n:=0;
    while a > 0 do
        begin
            n:=n+ a mod 10;
            a:= a div 10;
        end;
    gt:=n;
end;
begin
    readln(a);
    repeat inc(a) until gt(a) mod 4 =0;
    write(a);
end.

var a,n:integer;
function gt(a:integer):longint;
var n:integer;
begin
    n:=0;
    while a > 0 do
        begin
            n:=n+ a mod 10;
            a:= a div 10;
        end;
    gt:=n;
end;
begin
    readln(a);
    repeat inc(a) until gt(a) mod 4 =0;
end.

var a,n:integer;
begin
    readln(a);
    n:= a;
    while n mod 4 <> 0 do inc(n);
    write(n);
end.

var a,n,i,tcs:integer;
BEGIN
        read(a);tcs:=1;
        while tcs mod 4 <> 0 do
        Begin
        i:=a;
        while i <> 0 do
         Begin
          n:=i mod 10;
          tcs:=tcs+n;
          i:=i div 10;
         End;
         inc(a);dec(tcs);
         end;
         write(a);
END.


A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one.  You can remove a link or a pearl and insert it between two other existing links or pearls (or between a link and a pearl) on the necklace. This process can be repeated as many times as you like, but you can't throw away any parts.Can you make the number of links between every two adjacent pearls equal? Two pearls are considered to be adjacent if there is no other pearl between them.Note that the final necklace should remain as one circular part of the same length as the initial necklace.

The only line of input contains a string $$$s$$$ ($$$3 \leq |s| \leq 100$$$), representing the necklace, where a dash '-' represents a link and the lowercase English letter 'o' represents a pearl.

Print "YES" if the links and pearls can be rejoined such that the number of links between adjacent pearls is equal. Otherwise print "NO". You can print each letter in any case (upper or lower).

var
	n, m, r, x, y, z: longint;
	s, s1: string;

begin

	readln(s);
	for var i := 1 to s.length do
	begin
		if (s[i] = '-') then
			r += 1
		else
			x += 1;
	end;

	//writeln(x, ' ', r);
	if (x = 0) or (r = 0) then
		writeln('YES')
	else if (r mod x = 0) or (r = x) or (x = 1) then
		writeln('YES')
	else
		writeln('NO');

end.

var
  v,t,i,j,n,m:int64;
  s:string;
begin
  readln(s);
  for i:=1 to length(s) do
    if s[i]='-' then inc(v) else inc(t);
  if t=0 then writeln('YES') else
  if v mod t=0 then writeln('YES') else writeln('NO');
end.

Var
    nB, nN: Int64;
    S: String;

Begin
    Readln(S);
    For Var i := 1 to Length(S) do
        If S[i] = 'o' then
            nB += 1
        Else
            nN += 1;
    If (nB = 0) or (nN mod nB = 0) then
        Write('Yes')
    Else
        Write('No')
End.

var s:string;
n,k,i:integer;
begin
readln(s);
for i:=1 to length(s) do
if s[i]='o' then n+=1 else k+=1;
if n=0 then writeln('YES') else
if (k mod n = 0) then writeln('YES') else writeln('NO');
end.

program boosenka;
var s:string; n,count:integer;
begin
read(s);
for count:=1 to length(s) do
if copy(s,count,1)='o' then n:=n+1;
if n=0 then writeln('YES')
else
if length(s)mod n=0 then writeln('YES')
else writeln('NO');
end.

VAR
s:string;
i,T,B:longint;

BEGIN
readln(s);
for i:=1 to length(s) do
  if S[i]='-' then inc(T) else inc(B);
if B<2 then write('YES') else
if T mod B = 0 then write('YES') else
write('NO');
END.

program p1 ;
var a,b,i,n,m:integer;
 s:string;
 begin
 readln (s);
 for i:=1 to length(s) do begin
 if s[i]='-' then inc(a);
 if s[i]='o' then inc(b);
 end;
 if b=0 then writeln ('YES') else
 if (a mod b =0) or(a=0) or (b=1)  then writeln ('YES') else begin  writeln ('NO')  end;
 end.

           const eps=0.00000001;  besk1=200000008;  nn=600000;
   besk=8000000000000000000;
   label 1,2,3,4;
    type    real=extended;  {string=ansistring;}
    mas=array [-10..nn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of longint;mass1=^mass;
    var pos1,pos2,ost,ot,aa,bb,cc,p1,p2,p3,p4,k,kk,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,time,x0,modul,pos,p0,t2,t1,jj,w,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,pmax,imax,t,nm,n,m,s,smin,cen,dl,i1:int64;
   step1, step, i,j:longint;
    ppp,prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    vv,znak,ll:int64;
    name,d,dnew, voltay,l,r,c,z,day,b,a:array[-200000..1600000] of int64;
    zz:array[0..125000000] of byte;
    gr,pole:array[-10..1002,-10..1005] of char;
    ddd,dd1,dd2,dd3,dd4,dd,ddsum:array[-10..1101,-10..1010] of int64;
   zanx,zany:array[-10..2000000] of boolean;
    sss1,sss2:string;
    newnabor,stoim,nabor:array[-10..200005] of int64;
     zan,fl:array[-100..10000000] of boolean;
    ss1,ss2,ss:string;ch,ch1,ch2:char;
    s2,s1:array[-100..200000] of string;
    grr :array [-10..2010,-10..2010] of boolean;
    maxpr:array[0..nn] of string;
    sss:array[-10..nn] of string;
     xx,yy,vel,x1,y1,ott,v0,v1,s0,t0:extended;
     zv:point;
     ugol,rr,yc,xc,y,rot,x,temp,sumtemp,vol,newx,newy:array[-10..400000] of extended;
     sq,sqx,sqy,ottt,aaa,bbb,ccc:extended;
     xxx,yyy,yot:double;
       flag2,flag,flag1:boolean;

      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 min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; 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;

begin

  {  assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
   }
     read(ss);
     n:=length(ss);
     for i:=1 to n do if ss[i]='o' then inc(p);
     if p=0 then begin write('YES'); goto 1; end;
     if n mod p=0 then begin write('YES'); goto 1; end;
     write('NO');

   1:          close(output);
end.

var s:string;
    i,xo,x:longint;
begin
    readln(s);
    for i:=1 to length(s) do
        if s[i]='o' then inc(xo)
            else inc(x);
    if xo=0 then write('YES')
        else if x mod xo=0 then write('YES')
            else write('NO');
end.

var
b,ch,i:longint;
s:string;
begin
 readln(s);
  for i:=1 to length(s) do
   if s[i]='-' then inc(ch) else inc(b);
   if b=0 then write('YES') else
  if b=1 then write('YES') else
   if ch mod b=0 then write('YES') else write('NO');
end.

var a,b:integer;
    s:char;

BEGIN
	a:=0;
	b:=0;
	while not eoln do
	begin
		read(s);
		if s='-' then inc(a) else inc(b);
	end;
	if (b = 0) then write('YES') else
		if (a mod b = 0) then write('YES') else write('NO');
END.

var s:ansistring;
    i,a,b:longint;
begin
  readln(s);
  for i:=1 to length(s) do
    if s[i]='o' then
      inc(a)
    else
      inc(b);
  if (a=0)or(b mod a=0) then writeln('YES')
  else writeln('NO');
end.

var  x,i,y:longint;s:ansistring;
begin
readln(s);
for i:=1 to length(s) do
 if (s[i]='o') then
   inc(x)
 else
  if (s[i]='-') then
    inc(y);
 if x=0 then writeln('YES')
 else if (y mod x=0) then writeln('YES')
 else writeln('NO');
end.

var s:string;
    i,l,ans1,ans2:longint;
begin
    read(s);
    l:=length(s);
    for i:=1 to l do
      begin
          if s[i]='-' then inc(ans1);
          if s[i]='o' then inc(ans2);
      end;
    if ans2<>0 then begin
                        if ans1 div ans2=ans1/ans2 then write('YES')
                                                   else write('NO');
                    end
               else write('YES');
end.

var
i,xo,x:longint;
s:string;
begin
readln(s);
for i:=1 to length(s) do
  if s[i]='o' then inc(xo)
              else inc(x);
if xo=0 then write('YES')
  else if x mod xo=0 then write('YES')
                     else write('NO');
end.

var
  i,j,k,t,m,n,x,y:longint;
  s1:string;
  num1,num2:longint;
begin
  readln(s1);
  m:=length(s1);
  for i:=1 to m do
    if (s1[i]='o') then inc(num1)
      else inc(num2);
  if (num1=0)or(num1=1) then begin writeln('YES'); halt; end;
  if num2 mod num1=0 then writeln('YES') else writeln('NO');
end.

var s:string;i,xo,x:longint;
begin
readln(s);
for i:=1 to length(s) do if s[i]='o' then inc(xo)else inc(x);
if xo=0 then writeln('YES')else if x mod xo=0 then writeln('YES')else writeln('NO');
end.

var
 st:string;
 i,a,b:longint;
begin
  readln(st);
  for i:=1 to length(st) do
    if st[i]='-' then inc(b)
      else inc(a);
  if (a=0)or(b mod a=0) then writeln('YES')
    else writeln('NO');
end.

 var i,j,k1,k2:longint;
 c:char;
  begin
   while not eoln do
    begin
     read (c);
      if c='-' then inc (k1)
               else inc (k2);

    end;

  if k2 = 0 then writeln ('YES')
   else
  if k1 mod k2 = 0 then writeln ('YES')
      else writeln ('NO');

  end.

Program z1;
var s:string;
    i,n,b:integer;
begin
read(S);
for i:=1 to length(s) do
if S[i]='-' then n:=n+1
            else b:=b+1;
if (n=0)or(b=0) then write('YES')
                else
if n mod b=0 then write('YES')
             else write('NO');
end.

var
 s:string;
 ans1,ans2,i:longint;
begin
 readln(s);
 for i:=1 to length(s) do
  begin
   if s[i]='o' then inc(ans1);
   if s[i]='-' then inc(ans2);
  end;
 if ans1=0 then writeln('YES')
 else if ans2 mod ans1=0 then writeln('YES')
 else writeln('NO');
end.

Program LinksAndPearls;
uses math;
var s:string; i:longint; t1,t2:byte;
begin   //assign(input,'980A.inp'); reset(input);
        //assign(output,'980A.out'); rewrite(output);
        readln(s);
        t1:=0; t2:=0;
        for i:=1 to length(s) do
        if s[i]='o' then t1:=t1+1
        else t2:=t2+1;
        if (t1=0) or (t2=0) then writeln('YES')
        else if t2 mod t1=0 then writeln('YES')
        else writeln('NO');
        //close(input); close(output);
end.

Var x : Char;
    k,kk : LongInt;
    begin
    while not EoLn do
     begin
     Read(x);
      if x = '-' then inc(k);
      if x = 'o' then inc(kk);
     end;
    if (kk>0)  and (k mod kk = 0) then writeln('YES')
                      else begin
                           if kk=0 then writeln('YES')
                                   else writeln('NO');
                           end;
    end.

const fi='';
      fo='';
var s:widestring;
    f:text;
    i,j,n,m:longint;
procedure nhap;
begin
        assign(f,fi);
        reset(f);
        readln(f,s);
        close(f);
end;
procedure xuli;
begin
        assign(f,fo);
        rewrite(f);
        n:=0;m:=0;
        for i:=1 to length(s) do
                if s[i]='-' then inc(n) else inc(m);
        if (n=0)or(m=0) then writeln(f,'YES') else
        if (n mod m=0) then writeln(f,'YES') else
        writeln(f,'NO');
        close(f);
end;
begin
        nhap;
        xuli;
end.

const
  sfi='';
  maxn=10000;

var
  n,c1,c2,i:longint;
  s:ansistring;
  a:array[0..maxn] of int64;
  fi:text;

procedure popen;
  begin
    assign(fi,sfi); reset(fi);
  end;

procedure pclose;
  begin
    close(fi);
  end;

begin
popen;
  readln(fi,s);
  for i:=1 to length(s) do
    if s[i]='-' then inc(c1)
    else inc(c2);
  if c2=0 then write('YES')
  else
  if c1 mod (c2)=0 then write('YES')
  else write('NO');
pclose;
end.

var s,s1:string; o:longint;
begin
readln(s);
  s1:=s;
  while pos('o',s1)>0 do
    begin
    inc(o);
    delete(s1,pos('o',s1),1);
    end;
if o=0 then writeln('YES')
else
if(length(s)-o)mod o=0 then writeln('YES')
else writeln('NO');
end.

var
 st:ansistring;
 i,a,b:longint;
begin
  readln(st);
  for i:=1 to length(st) do
    if st[i]='-' then inc(b)
      else inc(a);
  if (a=0)or(b mod a=0) then writeln('YES')
    else writeln('NO');
end.

var
  s:ansistring;
  i,a,b:longint;
begin
  readln(s);
  for i:=1 to length(s) do
    if s[i]='-' then inc(a) else inc(b);
  if (b=0) or (a mod b=0) then write('YES') else write('NO');
end.

var s:string;
i,x,y:longint;
begin
//assign(input,'lianjiez.in');reset(input);
//assign(output,'lianjiez.out');rewrite(output);
readln(s);
for i:=1 to length(s) do
  if s[i]='o' then inc(x)
  else inc(y);
if x<2 then writeln('YES')
else if y mod x=0 then writeln('YES')
else writeln('NO');
close(input);close(output);
end.

var s:string;i,x,y:longint;
begin
//assign(input,'lianjiez.in');reset(input);
//assign(output,'lianjiez.out');rewrite(output);
readln(s);
for i:=1 to length(s) do
  if s[i]='o' then x:=x+1 else y:=y+1;
if(x<=1)or(y mod x=0)then writeln('YES') else writeln('NO');
close(input);close(output);
end.

var s:ansistring;
x1,x2,i:longint;
begin
//assign(input,'lianjiez.in');reset(input);
//assign(output,'lianjiez.out');rewrite(output);
readln(s);
for i:=1 to length(s) do
   if s[i]='-' then x1:=x1+1
else x2:=x2+1;
if(x2<=1)then writeln('YES')
else if x1 mod x2=0 then writeln('YES')
else writeln('NO');
close(input);close(output);
end.

var  s:string;x,y,i:longint;
begin
//assign(input,'lianjiez.in');reset(input);
//assign(output,'lianjiez.out');rewrite(output);
readln(s);
for i:=1 to length(s) do
  if s[i]='o' then
    inc(x)
  else inc(y);
if x=0 then writeln('YES')
else if y mod x=0 then writeln('YES')
else writeln('NO');
close(input);close(output);
end.

var
X,I:LONGINT;
S:ANSISTRING;
begin
//  assign(input,'lianjiez.in');reset(input);
 // assign(output,'lianjiez.out');rewrite(output);
  readln(s);
  for i:=1 to length(s) do
    begin
      if s[i]='o' then x:=x+1;
    end;
  if x=0 then writeln('YES')
  ELSE IF ((LENGTH(S)-X) MOD X=0) THEN WRITELN('YES') ELSE WRITELN('NO');
  close(input);
  close(output);
end.

const
    fi='';
    fo='';
var a,b: longint;

procedure input;
var f:text;
        c: char;

begin
    a:=0;
    b:=0;
    assign(f,fi);
    reset(f);
    while(not(eoln(f))) do
    begin
        read(f,c);
        if(c='-') then inc(a) else inc(b);
    end;
    close(f);
end;
procedure output;
var f:text;
begin
    assign(f,fo);
    rewrite(f);
    if ((a=0)or(b=0)) then write(f,'yes')
    else if (a mod b = 0) then write(f,'yes')
    else write(f,'no');
    close(f);
end;
begin
    input;
    output;
end.

var
  s:ansistring;
  i,j,n,m,k,a,b:longint;
  begin
  read(s);
  for i:=1 to length(s) do
    begin
      if s[i]='o' then inc(a);
      if s[i]='-' then inc(b);
      end;
      if a=0 then write('YES') else
      if b mod a=0 then write('YES') else write('NO');
      end.

var
 i,j,x,y:longint;
 s:string;
begin
 readln(s);
 for i:=1 to length(s) do
  begin
   if s[i]='o' then inc(x);
   if s[i]='-' then inc(y);
  end;
 if x=0 then write('YES')
        else
          if y mod x=0 then write('YES')
                       else write('NO');
end.

program A;
  var c: char;
  var l, o: byte;

begin
  l:=0;
  o:=0;
  while not eoln do
    begin
      read(c);
      if c='-' then inc(l)
      else if c='o' then inc(o);
    end;
  if o=0 then write('YES')
  else if (l mod o)=0 then write('YES')
  else write('NO');

end.

program slb;
var i,j,k,m,n:longint;s:ansistring;
begin
  readln(s);
  m:=0;n:=0;
  for i:=1 to length(s) do
    begin
      if s[i]='o' then inc(m)
      else inc(n);
    end;
  if m=0 then
    begin
      writeln('YES');
      exit;
    end;
  if n mod m=0 then writeln('YES')
  else writeln('NO');
end.

Var
        s: string;
        vt,l,p: integer;

Begin
        readln(s);
        vt:=pos('o',s);
        l:=length(s);
        while vt<>0 do
        begin
                inc(p);
                delete(s,vt,1);
                vt:=pos('o',s);
        end;
        l:=l-p;
        if p=0 then
        begin
                writeln('yes');
                exit;
        end;
        if l mod p=0 then writeln('yes') else writeln('no');
End.

var
  n,i,j,k,m : longint;
  s: string;
begin
      readln(s);

      for i := 1 to Length(s) do
      begin
           if s[i] = 'o' then
              inc(n);
           if s[i] = '-' then
              inc(m);
      end;
      if n = 0 then
        writeln('YES')
      else
      begin
      if (m mod n) = 0 then
        writeln('YES')
      else
        writeln('NO');
      end;

end.

var
s:string;
i,min,bus:longint;
begin
readln(s);
for i:=1 to length(s) do begin
    if s[i]='-' then inc(min);
    if s[i]='o' then inc(bus);
end;
if (bus = 0 ) or (min=0) then writeln('YES')
else begin
     if min mod bus= 0 then writeln('YES')
     else
     writeln('NO');
end;
end.

var
 s:string;
 a,b,i:longint;
begin
 readln(s);
 for i:=1 to length(s) do
  begin
   if s[i]='-' then a:=a+1
               else b:=b+1;
  end;
 if(b=0)or(a mod b=0)then writeln('YES')
                     else writeln('NO');
end.

var
	n, m, r, x, y, z: longint;
	s, s1: string;

begin

	readln(s);
	for var i := 1 to s.length do
	begin
		if (s[i] = '-') then
			r += 1
		else
			x += 1;
	end;

	if (x = 0) or (y = 0) then
		writeln('YES')
	else if (r mod x = 0) or (r = x) or (x = 1) then
		writeln('YES')
	else
		writeln('NO');

end.

var
	n, m, r, x, y, z: longint;
	s, s1: string;

begin

	readln(s);
	for var i := 1 to s.length do
	begin
		if (s[i] = '-') then
			r += 1
		else
			x += 1;
	end;

	if (r = x * 2) or (x = 0) or (r = 0) or (r = x) or (x = 1) then
		writeln('YES')
	else
		writeln('NO');

end.

var
	n, m, r, x, y, z: longint;
	s, s1: string;

begin

	readln(s);
	for var i := 1 to s.length do
	begin
		if (s[i] = '-') then
			r += 1
		else
			x += 1;
	end;

	if (r = x * 2) or (x = 0) or (r = 0) or (r = x) then
		writeln('YES')
	else
		writeln('NO');

end.

var s:string;
n,k,i:integer;
begin
readln(s);
for i:=1 to length(s) do
if s[i]='o' then n+=1 else k+=1;
if n=0 then writeln('NO') else
if (k mod n = 0) then writeln('YES') else writeln('NO');
end.

program boosenka;
var s:string; n,count:integer;
begin
read(s);
for count:=1 to length(s) do
if copy(s,count,1)='o' then n:=n+1;
if n<>0 then
begin
if length(s)mod n=0 then writeln('YES')
else writeln('NO');
end;
end.

var
  s:string;
  i,a,b:integer;
begin
  readln(s);
  for i:=1 to length(s) do
    if s[i]='-' then inc(a) else inc(b);
  if (a=0) or (b mod a=0) then write('YES') else write('NO');
end.

Program z1;
var s:string;
    i,n,b:integer;
begin
read(S);
for i:=1 to length(s) do
if S[i]='-' then n:=n+1
            else b:=b+1;
if (n=0)or(b=0) then write('YES')
                else
if (b mod n=0)or(n mod b=0) then write('YES')
                            else write('NO');
end.

Var x : Char;
    k,kk : LongInt;
    begin
    while not EoLn do
     begin
     Read(x);
      if x = '-' then inc(k);
      if x = 'o' then inc(kk);
     end;
    if (kk>0)  and (k mod kk = 0) then writeln('YES')
                      else  writeln('NO')
    end.

var
  s:ansistring;
  i,j,n,m,k,a,b:longint;
  begin
  read(s);
  for i:=1 to length(s) do
    begin
      if s[i]='-' then inc(a);
      if s[i]='o' then inc(b);
      end;
      if a=0 then write('YES') else
      if b mod a=0 then write('YES') else write('NO');
      end.

var s:string;
  i,s1,s2:longint;
begin
  readln(s);
   for i:=1 to length(s) do if s[i]='-' then s1:=s1+1 else s2:=s2+1;
    if (s1-1) mod s2=0 then write('YES')
     else  write('NO');
end.