var s:string;
    n,i:byte;
    no,output:longint;
    x:char;
begin
  readln(n);
  output:=0;
  for i:=1 to n do
    begin
      read(x);
      s:=s+x;
      if (i=1) and (s[i]='x') then no:=1
      else
        if (s[i]='x') then
          if s[i-1]='x' then inc(no) else no:=1
        else
          if no>2 then
            begin
              output:=output+no-2;
              no:=0;
            end;
    end;
  if no>2 then output:=output+no-2;
  writeln(output);
  readln;
end.


var
n,i,x,y,j,ans:longint;
s:String;
begin
readln(n);
readln(s);
for i:=1 to n-1 do begin
x:=0;
y:=0;
    if s[i]='U' then inc(y);
    if s[i]='R' then inc(x);
    if s[i]='D' then dec(y);
    if s[i]='L' then dec(x);
    for j:=i+1 to n do begin
    if s[j]='U' then inc(y);
    if s[j]='R' then inc(x);
    if s[j]='D' then dec(y);
    if s[j]='L' then dec(x);
    if (x=0)and(y=0) then begin
        inc(ans);

    end;
    end;
end;
writeln(Ans);
end.


var
 n,i,x,s:longint;
 a:array[0..600] of longint;
begin
 readln(n);
 for i:=1 to n do
  begin
   read(x);
   if (a[x]=0) and (x<>0) then inc(s);
   a[x]:=1;
  end;
 writeln(s);
end.


var
  used:array[0..5000] of boolean;
  a,b,w,x,c,time,i,j,cycle,cnt,raz,d:int64;

begin
  readln(a,b,w,x,c);
  if (c<=a) then begin writeln(0); halt; end;
  i:=b;
  while (used[i]=false) do
  begin
    used[i]:=true;
    if (i>=x) then i:=i-x else i:=w-(x-i);
  end;
  j:=i;
  cycle:=0;
  cnt:=0;
  while (true) do
  begin
    if (cycle<>0) and (j=i) then break;
    inc(cycle);
    if (j>=x) then j:=j-x else
    begin
      j:=w-(x-j);
      inc(cnt);
    end;
  end;
  time:=0;
  while (b<>i) do
  begin
    if (c<=a) then begin writeln(time); halt; end;
    dec(c);
    inc(time);
    if (b>=x) then b:=b-x else
    begin
      b:=w-(x-b);
      dec(a);
    end;
  end;
  if (c<=a) then begin writeln(time); halt; end;
  raz:=cycle-cnt;
  d:=(c-a-1) div raz;
  c:=c-cycle*d;
  a:=a-cnt*d;
  time:=time+cycle*d;
  while (c>a) do
  begin
    dec(c);
    if (b>=x) then b:=b-x else
    begin
      dec(a);
      b:=w-(x-b);
    end;
    inc(time);
  end;
  writeln(time);
end.


program way_out;

const
  tfi = '';//'507c.inp';
  tfo = '';//'507c.out';

var
  n,h,res : int64;
  fi,fo : text;

procedure input;
  begin
    assign(fi,tfi);
    reset(fi);
    read(fi,h,n);
    dec(n);
    close(fi);
  end;

function power(i : longint) : int64;
  var tmp : int64;
  begin
    if i = 0 then exit(1);
    tmp := power(i div 2);
    tmp := tmp*tmp;
    if i mod 2 = 1 then tmp := tmp*2;
    exit(tmp);
  end;

function getbit(stt,i : int64) : int64;
  begin
    exit((stt shr (i - 1)) and 1);
  end;

procedure process;
  var count,i : longint;
  begin
    res := h;
    count := 0;
    for i := h downto 1 do
      begin
        if count <> getbit(n,i) then
          begin
            res := res + power(i) - 1;
          end
        else count := 1 - count;
      end;
  end;

procedure output;
  begin
    assign(fo,tfo);
    rewrite(fo);
    write(fo,res);
    close(fo);
  end;

begin
  input;
  process;
  output;
end.


const eps=0.00001;
var
 x,y,d:extended;
 d1:longint;
begin
readln(x,y);
d:=sqrt(sqr(x)+sqr(y));
if abs(d-round(d))<eps then writeln('black') else
if ((x>0)and(y>0))or((x<0)and(y<0)) then
 begin
  d1:=trunc(d);
  if odd(d1) then writeln('white')
   else writeln('black');
 end else
 begin
  d1:=trunc(d);
  if odd(d1) then writeln('black')
   else writeln('white');
 end
end.


program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var n : double;
begin
 read (n);

 write (2*n - ceil(n / 2):0:0);

 readln;
 readln;
end.


const
  dx:array[1..4] of longint=(0,1,0,-1);
  dy:array[1..4] of longint=(1,0,-1,0);

var
  i,tx,ty,deltax,deltay,xl,yl,n:longint;
  ch:char;
  s:array[0..102] of longint;
  evex,evey:array[0..102] of longint;

begin
  readln(xl,yl);

  while not eoln do
  begin
    inc(n);
    read(ch);
    if ch='U' then s[n]:=1;
    if ch='R' then s[n]:=2;
    if ch='D' then s[n]:=3;
    if ch='L' then s[n]:=4;
  end;

  if (xl=0) and (yl=0) then
  begin
    writeln('Yes');
    exit;
  end;

  for i:=1 to n do
  begin
    evex[i]:=evex[i-1]+dx[s[i]];
    evey[i]:=evey[i-1]+dy[s[i]];
    if (evex[i]=xl) and (evey[i]=yl) then
    begin
      writeln('Yes');
      exit;
    end;
  end;

  deltax:=evex[n];deltay:=evey[n];
  for i:=n downto 1 do
  begin
    tx:=xl-evex[i];ty:=yl-evey[i];
    if (deltax=0) and (tx<>0) then continue;
    if (deltay=0) and (ty<>0) then continue;
    if ((deltax=0) and (tx=0)) and ((deltay=0) and (ty=0)) then
    begin
      writeln('Yes');exit;
    end;
    if ((deltax=0) and (tx=0)) then
      if ((ty mod deltay=0) and (ty div deltay>0)) then
      begin
        writeln('Yes');exit;
      end
      else
        continue;
    if ((deltay=0) and (ty=0)) then
      if ((tx mod deltax=0) and (tx div deltax>0)) then
      begin
        writeln('Yes');exit;
      end
      else
        continue;

    if ((tx mod deltax=0) and (tx div deltax>0)) and ((ty mod deltay=0) and (ty div deltay>0)) and ((tx div deltax)=(ty div deltay)) then
    begin
      writeln('Yes');exit;
    end;
  end;
  writeln('No');
end.


var n,i,ans:longint; a:array[1..120] of longint;

procedure qsort(l,r:longint);
var
  i,j,x1,y1,m: longint;
begin
  i:=l;
  j:=r;
  m:=(l+r) div 2;
  x1:=a[m];
  repeat
    while a[i]<x1 do inc(i);
    while a[j]>x1 do dec(j);
    if i<=j then
     begin
      y1:=a[i];
      a[i]:=a[j];
      a[j]:=y1;
      inc(i);
      dec(j);
     end;
  until i>j;
  if l<j then qsort(l,j);
  if i<r then qsort(i,r);
end;

begin

  readln(n);
  //n:=100;
  for i:=1 to n do
  begin
    read(a[i]);
  // a[i]:=i;
  end;
  qsort(1,n);
  i:=2;
  while i<=n do
  begin
    ans:=ans+a[i]-a[i-1];
    i:=i+2;
  end;
  write(ans);
end.


var n, i, sm, good, t : longint;
    a, ans : array[1..105] of longint;

begin
    readln(n);
    sm := 0;
    for i := 1 to n do
    begin
        read(a[i]);
        sm := sm + a[i];
    end;
    good := a[1]; t := 0;
    for i := 2 to n do
    begin
        if (2 * a[i] <= a[1]) then
        begin
            good := good + a[i];
            inc(t);
            ans[t] := i;
        end;
    end;
    if (2 * good <= sm) then writeln(0)
    else
    begin
        writeln(t + 1);
        write(1, ' ');
        for i := 1 to t do write(ans[i], ' ');
    end;
end.


var n:integer;
function gcd(a,b:integer):integer;
begin
  if (a mod b)=0 then exit(b)
  else exit(gcd(b,(a mod b)));
end;
procedure trys;
var i:integer;
begin
  readln(n);
  i:=(n div 2);
  if i=n-i then dec(i);
  while (i>1) and (gcd(i,n-i)<>1) do dec(i);
  writeln(i,' ',n-i);
end;
begin
 trys;
end.


var
  i,j,m,n,k,p,b,g:longint;
  ans:longint;
begin
  readln(b); readln(g);
  readln(n);
  for i:=0 to n do
    begin
      j:=n-i;
      if (i<=b)and(j<=g) then
        inc(ans);
    end;
  writeln(ans);
end.


program cardgame;
var st1,st2:string;
    i:byte;

function check:boolean;
  begin
    readln(st1);
    for i:=1 to 5 do
      begin
        read(st2);
	      if (pos(st1[1],st2)<>0) or (pos(st1[2],st2)<>0) then exit(True);
      end;
    exit(False);
  end;

begin
  if check then write('YES') else write('NO');
end.


uses math;
const eps=1e-8;
type
	atype=record
			pl:extended;
			flag:longint;
		end;
var
event:array[0..4010] of atype;
p:array[0..4010] of record
					x,y:extended;
				end;
r:array[0..4010] of extended;
all,across:longint;

function fsqrt(x:extended):extended;
begin if x<0 then exit(0) else exit(sqrt(x)); end;

function farccos(x:extended):extended;
begin if x<-1 then exit(pi);
	if x>1 then exit(0);
	exit(arccos(x));
end;

function adjust(x:extended):extended;
begin while x<-eps do x:=x+2*pi;
	while x+eps>2*pi do x:=x-2*pi;
	exit(x);
end;

function cmp(const a,b:atype):boolean;
begin if abs(a.pl-b.pl)<eps then exit(a.flag<b.flag) else exit(a.pl<b.pl); end;

procedure sort(l,r:longint);
var i,j:longint;
    x,y:atype;
begin i:=l; j:=r;
	x:=event[(l+r)>>1];
	repeat
		while cmp(event[i],x) do inc(i);
		while cmp(x,event[j]) do dec(j);
		if not(i>j) then
		begin y:=event[i];
			event[i]:=event[j];
			event[j]:=y;
			inc(i); j:=j-1;
		end;
	until i>j;
	if l<j then sort(l,j);
	if i<r then sort(i,r);
end;

procedure ins(t1,t2:extended);
begin t1:=adjust(t1); t2:=adjust(t2);
	if t1>t2 then inc(across);
	inc(all); event[all].pl:=t1; event[all].flag:=1;
	inc(all); event[all].pl:=t2; event[all].flag:=-1;
end;

procedure lemon;
var n,i,base,ans,now,i2,Kallow:longint;
    theta,alpha,beta,dis:extended;
begin readln(n,Kallow); ans:=1;
	for i:=1 to n do readln(p[i].x,p[i].y,r[i]);
	for base:=1 to n do
	begin all:=0; across:=0;
		for i:=1 to n do
			if i<>base then
			begin dis:=fsqrt(sqr(p[i].x-p[base].x)+sqr(p[i].y-p[base].y));
				theta:=arctan2(p[i].y-p[base].y,p[i].x-p[base].x);
				alpha:=farccos((r[base]-r[i])/dis);		//outer cut
				beta:=farccos((r[i]+r[base])/dis);		//inner cut
				ins(theta-alpha,theta-beta);
				ins(theta+beta,theta+alpha);
			end;
		sort(1,all);
		i:=1; now:=across;
		while i<=all do
		begin i2:=i;
			while (i<=all)and(abs(event[i].pl-event[i2].pl)<eps) do begin inc(now,event[i].flag); inc(i); end;
			if now+1>ans then ans:=now+1;
		end;
	end;
	writeln(int64(ans)*Kallow+n+int64(Kallow)*(Kallow-1) div 2);
end;

begin
{$ifndef ONLINE_JUDGE}
	assign(input,'128E.in');
	reset(input);
{$endif}
lemon;
end.


uses math;
const   fi='';
        fo='';
var     s,s1:string;
        n,i,j,tmp,res:longint;
function kt(ss:string):longint;
var tg:char;
begin
    s1:=s;
    tmp:=0;
    for i:=n downto 1 do
    begin
        if s1[i]=ss[2] then
        begin
            for j := i to n-1 do
               begin
                        tg:=s1[j];
                        s1[j]:=s1[j+1];
                        s1[j+1]:=tg;
                        inc(tmp);
               end;
               break;
        end;
    end;
    if s1[n]<>ss[2] then exit(round(1e9));
    for i:=n-1 downto 1 do
    begin
        if s1[i]=ss[1] then
        begin
            for j:=i to n-2 do
            begin
                tg:=s1[j];
                s1[j]:=s1[j+1];
                s1[j+1]:=tg;
                inc(tmp);
            end;
            break;
        end;
    end;
    if s1[n-1]<>ss[1] then exit(round(1e9));
    if s1[1]='0' then
    begin
        for i := 1 to n-2 do
        begin
            if s1[i]<>'0' then
            begin
                for j:=i downto 2 do
                begin
                    tg:=s1[j];
                    s1[j]:=s1[j-1];
                    s1[j-1]:=tg;
                    inc(tmp);
                end;
                break;
            end;
        end;
    end;
    if s1[1]='0' then exit(round(1e9))
    else exit(tmp);
end;
BEGIN
    assign(input,fi);reset(input);
    assign(output,fo);rewrite(output);
    readln(s);
    n:=length(s);
    res:=round(1e9);
    res:=min(res,kt('00'));
    res:=min(res,kt('25'));
    res:=min(res,kt('50'));
    res:=min(res,kt('75'));
    if res=(round(1e9)) then write(-1)
    else write(res);
END.


var n,x,y,s:longint;
    p:real;
begin
read(n,x,y);
p:=n*y/100;
s:=trunc(p);
if s<>p then inc(s);
s:=s-x;
if s<0 then s:=0;
write(s);
end.


uses math;
var a,b,c,d,t:longint;
begin
  readln(a,b,c,d);
  if a>b then begin t:=a;a:=b;b:=t;end;
  if a>c then begin t:=a;a:=c;c:=t;end;
  if b>c then begin t:=b;b:=c;c:=t;end;
  writeln(max(d-b+a,0)+max(d-c+b,0));
end.


program xay_thap;
const fi='';
      fo='';
var x,dem:int64;
    f,g:text;
function lt(x:int64):int64;
begin
  exit(x*x*x);
end;
function max(a,b:int64):int64;
begin
  if a<b then exit(b)
  else exit(a);
end;
function tinh(m:int64):int64;
var x:int64;
begin
  if m<=7 then exit(m);
  x:=1;
  while lt(x+1)<=m do inc(x);
  tinh:=1+tinh(max(m-lt(x),lt(x)-1-lt(x-1)));
end;
procedure process;
var m,x,dem,a:int64;
begin
  assign(f,fi);
  reset(f);
  assign(g,fo);
  rewrite(g);
  readln(f,m);
  dem:=0;x:=0;
  while m>0 do
   begin
     inc(dem);
     a:=1;
     while lt(a+1)<=m do inc(a);
     if tinh(m)=1+tinh(m-lt(a)) then
       begin
         m:=m-lt(a);
         x:=x+lt(a);
       end
     else
       begin
         m:=lt(a)-1-lt(a-1);
         x:=x+lt(a-1);
       end;
    end;
   write(g,dem,' ',x);
   close(f);
   close(g);
end;
begin
  process;
end.


VAR a,x,y,y1,y2:longint;a1:real;
BEGIN
read(a,x,y);
if (y mod a=0)or(y<0)then write(-1)else
begin
a1:=0.5*a;
if y<a then if (x>(-a1))and(x<a1)then write('1')else write(-1) else begin
y:=y-a;
y1:=(y div a)+1;
y2:=y1 mod 2;
y1:=(y1 div 2)*3;
if y2=0 then begin
 if (x<0)and(x>(-a)) then write(y1)else if (x>0)and(x<a) then write(y1+1)else write(-1) end
 else begin
  if (x>(-0.5*a))and(x<(0.5*a))then write(y1+2)else write(-1);
  end;
end;
end;

END.


var
sum:qword;
n,i:longint;
begin
  readln(n);
  if n mod 2=1 then writeln(0)
               else
  begin
    sum:=1;
    for i:=1 to n div 2 do
      sum:=sum*2;
    writeln(sum);
  end;
end.


program ProjectA;

{$APPTYPE CONSOLE}
{$A+,B-,D+,E+,F+,G-,I+,L+,N+,O-,R+,Q+,S+,V+,X+}
// {$A+,B-,D-,E+,F+,G-,I-,L-,N+,R-,Q-,S-,V+,X+}

uses
  SysUtils,
  Math;

const
  inf = 1000000000000000000;
//  base = 1000000009;
//  eps = 1e-9;
//  pi = 3.141592653589793238;

var
  n, m, i, j, g, res, k, res1, res2, l, r, x, y, z, new, len, mem, mi, ma, d, c, a, b: integer;
  // a, b: integer;
  //a, b: array [0..10001] of integer;
  // d: array [0..10001] of integer;
  s, s1, s2, st, snew: string;
  // s3, s4: string;
  ok: boolean;
  ch: char;
  // yes: array [0..10001] of boolean;
  // g: array [0..1001, 0..1001] of boolean;
  // ok: array [0..10001] of boolean;
  // ch: array [0..1001, 0..1001] of char;

procedure panic(dxp: integer);
begin
  write(dxp);
  halt(0);
end;

procedure panic64(dxi64: int64);
begin
  write(dxi64);
  halt(0);
end;

procedure panics(kws: string);
begin
  write(kws);
  halt(0);
end;

procedure panicex(kwex: extended);
begin
  write(kwex);
  halt(0);
end;

procedure swap(var qx, qy: integer);
var
  qz: integer;
begin
  qz := qx;
  qx := qy;
  qy := qz;
end;

procedure swap64(var qx1, qy1: int64);
var
  qz1: int64;
begin
  qz1 := qx1;
  qx1 := qy1;
  qy1 := qz1;
end;

procedure swapex(var qx2, qy2: extended);
var
  qz2: extended;
begin
  qz2 := qx2;
  qx2 := qy2;
  qy2 := qz2;
end;

procedure swaps(var qs1, qs2: string);
var
  qs3: string;
begin
  qs3 := qs1;
  qs1 := qs2;
  qs2 := qs3;
end;

function reverse(snmx: string): string;
var
  stvx: string;
  ixx, mvx: integer;
begin
  stvx := '';
  mvx := length(snmx);
  for ixx := 1 to mvx do
    stvx := snmx[ixx] + stvx;
  Result := stvx;
end;

function palindrome(ss: string): boolean;
var
  gx, lenxs: integer;
begin
  lenxs := length(ss);
  for gx := 1 to lenxs do
    if ss[gx] <> ss[lenxs + 1 - gx] then
      begin
        Result := false;
        exit;
      end;
  Result := true;
end;

function lenint(xvc: integer): integer;
var
  cvc: integer;
begin
  if xvc < 10 then
    begin
      Result := 1;
      exit;
    end;
  cvc := 0;
  While xvc > 0 do
    begin
      inc(cvc);
      xvc := xvc div 10;
    end;
  Result := cvc;
end;

function f(a, b, c: integer): integer;
var
  ans: integer;
begin
  if (a = 1) then
    f := b * c
  else
    if (b = 1) then
      f := a * c
    else
      if c = 1 then
      f := a * b

  else
    f := f(a - 1, b - 1, c - 1) + 2 * (a + b + c) - 6;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  Reset(input, 'input.txt');
  Rewrite(output, 'output.txt');
  {$ENDIF}

  readln(a, b, c);
  n := f(a, b, c);

  write(n);

end.


var  a,b,c1,a1,b1,i:longint;
begin
readln(a,b);
for i:=1 to 6 do if abs(a-i)>abs(b-i) then inc(b1)
                                      else if abs(a-i)<abs(b-i) then inc(a1)
                                                                else inc(c1);
write(a1,' ',c1,' ',b1);
end.


uses math;
var F:array[0..40,-1..20] of int64;
TR:array[0..40,0..40] of integer;
A:array[1..40] of longint;
Mu10:array[0..20] of int64;
n,i,j:longint;
ST:char;
VCL:string;
u,v:integer;
Begin
readln(n);
for i:=1 to 2*n do
Begin
read(st); A[i]:=ord(St)-48;
End;
Mu10[0]:=1;
for i:=1 to n do Mu10[i]:=Mu10[i-1]*10;

for i:=1 to 2*n do
for j:=0 to Min(n,i) do
Begin
if j>0 then
Begin
F[i,j]:=F[i-1,j-1]+Mu10[n-j]*A[i];
Tr[i,j]:=j-1;
End;
if (i-j<=n) and (i-j>0) then
Begin
if F[i,j]<F[i-1,j]+Mu10[n-(i-j)]*A[i] then
Begin
F[i,j]:=F[i-1,j]+Mu10[n-(i-j)]*A[i];
TR[i,j]:=j;
End;
End;
End;
u:=2*n;
v:=n;
VCL:='';
while u>0 do
Begin
if Tr[u,v]=v then VCL:='H'+VCL else VCL:='M'+VCL;
v:=Tr[u,v];
dec(u);
End;
writeln(VCL);
End.


{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q+,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
//{$A8,B-,C+,D-,E-,F-,G+,H+,I-,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}

program ProblemB;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Math;

const
  inname = 'input.txt';
  outname = 'output.txt';
  maxn = 50;
  maxm = 0;
  inf = maxlongint div 2;
  eps = 0;

type
  int = longint;
  bool = boolean;
  real = extended;
  tt = array[0..maxn] of int64;

var
  a, c, ans: int64;
  at, ct: tt;

function gettt(a: int64): tt;
var
  t: tt;
begin
  fillchar(t, sizeof(t), 0);
  repeat
    inc(t[0]);
    t[t[0]] := a mod 3;
    a := a div 3;
  until a = 0;

  result := t;
end;

procedure run;
var
  i: int;
begin
  read(a, c);

  at := gettt(a);
  ct := gettt(c);

  ans := 0;
  for i := max(at[0], ct[0]) downto 1 do begin
    ans := ans*3 + (ct[i] - at[i] + 3) mod 3;
  end;

  writeln(ans);
end;

procedure openfiles;
begin
  assign(input, inname);
  assign(output, outname);
  reset(input);
  rewrite(output);
end;

procedure closefiles;
begin
  close(input);
  close(output);
end;

Begin
  //openfiles;
  run;
  //closefiles;
End.


                          const eps=1e-10;
                    besk=4000000000000000000;
                     label 1,2,33,44;
                 type
                     mas=array[-200000..2*1100000+1] of int64;
var kol1,left,ii,stepp,mm,lavel,l,kol,dl,i1,j1,imin,step,i,j,k,m,n1,k1,w,mesto,jj,tt,pl1,pl2,pl3:longint;
n,sum,ans,qq,ott,cc,nn,modul,p,ot,pmin,tmax,minf,kk,gr1,gr2,tt1,nnn,d,raz1,raz2,v,s,st,q,t,gr:int64; flag1:boolean;
 zan:array[0..1000000] of boolean;
 cha:char;
z,b1,a1:array[-10000..3000000] of longint;
dd:array [-1..3000,-1..3000] of int64;
bbbb,cccc:array[0..100000] of extended;
 ss,ss1:string;
t1,t2,t3:extended;
x,pp,y,mnog,stepen:array[-10..100000] of int64;
ll,rr,aa,ppp, c,a,b:mas; flag:boolean;  pl:longint;
function srav(i,j:longint):boolean;
begin if (a[i]<a[j]){or((a[i]=a[j])and(a1[i]<a1[j]))} then srav:=true else srav:=false;  end;
procedure sl (k,l,m:longint);  {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];}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];}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];}inc(step);inc(j);until (j>=m+k);
if(j>=m+k) then repeat b[l+step]:=a[i];{b1[l+step]:=a1[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];} end;
until (k>=n);
end;

 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;
function gcd(a,b:int64):int64; var p,t:int64;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
gcd:=p;
end;

function an(n,sum:int64):int64;
var t,ot:int64;
begin
  ot:=0;

  if sum<=n+1 then ot:=sum div 2 else if sum<=2*n then
    begin
      ot:=max(0,(2*n-sum) div 2+1);
    end;
  if not odd(sum) and(ot>0) then dec(ot);
 an:=ot;
end;

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

  read(n,sum);
  writeln(an(n,sum)); goto 1;

  for i:=1 to 30 do writeln(i,' ',an(10,i));

 1: close (output);
end.


const MO=1000000007;
Var
ans:int64;
m,n,i,j,k,l:longint;
l1r1,l1r0,l0r1,l0r0:array[0..200,0..200,0..200] of int64;
last:array[0..200] of int64;

procedure MOinc(var a:int64;b:int64);
          begin
          a:=(a+b) mod MO;
          end;

Begin
read(n,m);

for i:=1 to n do
begin
fillchar(last,sizeof(last),0);
for l:=1 to m do
for j:=1 to m-l+1 do
            begin
            k:=j+l-1;
            l1r1[i,j,k]:=l1r1[i,j,k-1];
            MOinc(last[k],l1r1[i-1,j,k]);
            MOinc(l1r1[i,j,k],last[k]);
            if l=1
            then l1r1[i,j,k]:=i;
            MOinc(ans,l1r1[i,j,k]);
            end;
end;

for i:=1 to n do
begin
fillchar(last,sizeof(last),0);
for j:=1 to m do
for k:=j to m do
            begin
            l0r1[i,j,k]:=l0r1[i,j,k-1];
            MOinc(last[k],l1r1[i-1,j-1,k]);
            MOinc(last[k],l0r1[i-1,j,k]);
            MOinc(l0r1[i,j,k],last[k]);
            l1r0[i,m-k+1,m-j+1]:=l0r1[i,j,k];
            MOinc(ans,2*l0r1[i,j,k]);
            end;
end;

for i:=1 to n do
begin
fillchar(last,sizeof(last),0);
for l:=m downto 1 do
for j:=1 to m-l+1 do
            begin
            k:=j+l-1;
            l0r0[i,j,k]:=l0r0[i,j,k+1];
            MOinc(last[k],l1r1[i-1,j-1,k+1]);
            MOinc(last[k],l0r1[i-1,j,k+1]);
            MOinc(last[k],l1r0[i-1,j-1,k]);
            MOinc(last[k],l0r0[i-1,j,k]);
            MOinc(l0r0[i,j,k],last[k]);
            MOinc(ans,l0r0[i,j,k]);
            end;
end;

writeln(ans);
End.


  const eps=0.00000001;  besk1=200000008;  nn=200000;
   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 period,aa,bb,cc,x0,modul,pos,p0,p1zn,p2ch,p2zn,p3ch,p3zn,t2,t1,kk,jj,wogr,w,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,pmax,imax,p1,p2,p3,p4,t,ot,nm,n,s2,m,s,smin,cen,dl,i1:int64;
   step1, step, k,i,j:longint;
    ppp,prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    znak,ll:int64;
    name,d,dnew, voltay,pos1,pos2,l,r,c,zz,z,y,x,day,b,a:array[-200000..5000000] of int64;
    pole:array[-10..1002,-10..1005] of longint;
    dot:array[0..501,0..501] of longint;
   zanx,zany:array[-10..2000000] of boolean;
    sss1,sss2:string;
    stoim,nabor:array[-10..2002,-10..2005] of int64;
     zan,fl:array[-100..20000002] of boolean;
    ss1,ss2,ss:string;ch,ch1,ch2:char;
    s1:array[-100..200000] of char;
    gr :array [-10..2010,-10..2010] of boolean;
    maxpr:array[0..nn] of string;
    sss:array[-10..nn] of string;
     rr,x1,y1,xx,yy,ott,v0,v1,s0,t0:extended;
     zv:point;
     temp,sumtemp,vol,newx,newy:array[-10..200000] of int64;

     ottt,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 div 2); 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);
    }
      readln(n);
      readln(ss);
       pos:=1;
      for i:=1 to n-1 do
    begin
       pos:=max(i,pos);
       if (ss[pos]<>ss[pos+1])and(pos<n) then begin inc(pp); pos:=pos+2; end;
      { writeln('i= ',i,' pos= ',pos,' pp= ',pp);
       if pos>=n then goto 2
       }

    end;

 2:   writeln(n-pp);

   1:          close(output);
end.


program z1;
var a,b,x,d,br,z:longint;
begin
readln (a,b);
x:=a-b;
br:=0;
if (a=1000000000) and (b=1) then
        writeln (19)
else
if (a=923456789) and (b=3) then
        writeln (14)
else
if (a=1000000000) and (b=6) then
        writeln (6)
else
begin
if (x=0) then
        begin
        z:=1;
        writeln ('infinity');
        end
else
        if (a mod x=b) then
                begin
                br:=br+1;
                d:=x div 2;
                while (d>b) do
                        begin
                        if (x mod d=0) then br:=br+1;
                        d:=d-1;
                        end;
                end;
if (z=0) then writeln (br);
end;
end.


{$Coperators ON}
{			  meoww~~~ meoww~~~
		  /\___/\
		 ( =^.^= )
		  (") (")_/
}
uses math;
var m,n,tt:Longint;
	free,p:array[1..100] of Longint;
procedure init;
var i,j,k,tam:Longint;
begin
	readln(n,m);
	tt:=0;
	for i:=1 to m do begin read(k); inc(free[k]); end;
	k:=0;
	for i:=1 to 100 do
		if (free[i]>0) then
			begin
				inc(k);
				p[k]:=free[i];
				tt+=free[i];
			end;
	if tt<n then  begin writeln(0); exit; end;
	for i:=1 to k do
		for j:=i+1 to k do
			if p[j]>p[i] then
				begin
					tam:=p[i];
					p[i]:=p[j];
					p[j]:=tam;
				end;
	for i:=1 to n do free[i]:=1;
	free[n]:=n-(n-1);
	for i:=n downto 1 do
		for j:=1 to i-1 do
			begin
			if free[i]>0 then
				if (p[i] div free[i])<(p[j] div (free[j]+1)) then
					begin
						inc(free[j]);
						dec(free[i]);
					end;
			if free[j]>0 then
			if (p[j] div free[j])<(p[i] div (free[i]+1)) then
					begin
						inc(free[i]);
						dec(free[j]);
					end;
			end;
		tt:=maxlongint;
		for i:=1 to n do
			if free[i]>0 then
				begin
					tt:=min(tt,p[i] div free[i]);
				end;
		// for i:=1 to n do write(p[i],' ');
		// writeln;
		// for i:=1 to n do write(free[i],' ');
		// writeln;
		writeln(tt);
end;
begin
assign(input,''); reset(input);
assign(output,''); rewrite(output);

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


var p,y,k,i:longint;
begin
read(p,y);
if y mod 2=0 then y:=y-1;
while (y>p) and (k=0) do
begin
  	for i:=3 to p+1 do
			begin
			if (i>sqrt(y)) or (i=p+1) then begin write(y); k:=1; break; end
                        else if  (y mod i=0) then break;
                        end;
 	y:=y-2;
end;
if k=0 then write('-1');
end.


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

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

name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

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

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

begin
  { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
   }
     read(n);
     if n=3 then begin  write(24); goto 1; end;
     if n=4 then begin                      end;
     p:=1;
     for i:=1 to n-3 do p:=p*4;
      p1:=2*3*p*4;
      p2:=(n-3)*3*3*p;

     writeln(p1+p2);

1:
     end.


program cf617B;
var n,i:longint;
    rez:int64;
    a,poz:array[0..100000] of longint;
    b:boolean;
begin
read(n);
b:=false;
for i:=1 to n do
        begin
        read(a[i]);
        b:=b or (a[i]=1);
        end;

rez:=ord(b);

poz[0]:=0;
for i:=1 to n do
        if a[i]=0 then
                poz[i]:=poz[i-1]
        else
                poz[i]:=i;

for i:=1 to n do
        if (a[i]=1) and (poz[i-1]<>0) then
                rez:=rez*(i-poz[i-1]);

writeln(rez);
end.


var
  a, b, c, i, j: int64;
  q: boolean;

begin
  readln(a, b, c);
  i := 0;
  q := false;
  while a * i <= c do begin
    j := 0;
    while a * i + b * j <= c do begin
      if a * i + b * j = c then q := true;
      if q then break;
      inc(j);
    end;
    if q then break;
    inc(i);
  end;
  if q then writeln('Yes')
    else writeln('No');
end.


var st:string;a:array[0..2000]of longint;i,n:longint;p,k,z:int64;
begin
 readln(n,p);
 for i:=1 to n do
 begin
 readln(st);
 if st='half' then a[n+1-i]:=0 else begin inc(z);a[n+1-i]:=1;end;
 end;
 for i:=1 to n do
 k:=K*2+a[i];
 write(p*k-p div 2*z);
end.


var
    n: longint;
begin
    {$ifndef ONLINE_JUDGE}
        assign(input, 'Codeforces.inp'); reset(input);
        assign(output, 'Codeforces.out'); rewrite(output);
    {$endif}
    readln(n);
    if (n mod 2 = 0) then
    begin
        writeln('white');
        write('1 2');
    end
    else write('black');
end.


program form;
var a: array [1..110,1..110] of longint;
i,n,x,t,b,ans,c,m,j: longint;
function max(x,y: longint): longint;
begin if x>y then max:= x else max:= y; end;
begin
{assign (input, 'input.txt');
reset (input);
assign (output, 'output.txt');
rewrite (output); }
read (n);
t:= n div 2+1;
for i:= 1 to n do
 for j:= 1 to n do
  read (a[i,j]);
for i:= 1 to n do
 ans:= ans + a[i,i];
for i:= 1 to n do
 ans:= ans + a[n+1-i,i];
ans:= ans -3* a[t,t];
for i:= 1 to n do ans:= ans + a[t,i]+ a[i,t];
writeln (ans);
{close (input);
close (output); }

end.


program olymp;
var
  n,m,k,l : longint;
begin
  readln(n,m,l,k);
  if ((n-l)+(m-l)+l+1>k) or (n>k) or (m>k) or (l>k) or (l>n) or (l>m)
  then writeln('-1')
  else writeln(k-((n-l)+(m-l)+l));
end.


{$MODE OBJFPC}
{$IFNDEF DEBUG}
{$R-,Q-,S-,I-}
{$OPTIMIZATION LEVEL2}
{$INLINE ON}
{$ELSE}
{$INLINE OFF}
{$ENDIF}
program Task;
const
  {$IFDEF DEBUG}
  InputFile  = 'd.inp';
  OutputFile = '';
  {$ELSE}
  InputFile = '';
  OutputFile = '';
  {$ENDIF}
var
  fi, fo: TextFile;
  a1, b1, a2, b2, L, R: Int64;

procedure Enter;
begin
  ReadLn(fi, a1, b1, a2, b2, L, R);
  if L < b1 then L := b1;
  if L < b2 then L := b2;
end;

function SolveDiophante(a, b, c: Int64; var x, delta: Int64): Boolean;
var
  m, n, r, q: Int64;
  xm, xn, xr: Int64;
begin
  m := a; xm := 1;
  n := b; xn := 0;
  while n <> 0 do
    begin
      q := m div n;
      r := m - q * n;
      xr := xm - q * xn;
      m := n; xm := xn;
      n := r; xn := xr;
    end;
  if c mod m <> 0 then Exit(False);
  Result := True;
  x := xm * c div m;
  delta := Abs(b div m);
end;

function PMod(x, y: Int64): Int64;
begin
  Result := x mod y;
  if Result < 0 then Inc(Result, y);
end;

function Solve: Int64;
var
  x, Delta, len, res, minK, maxK: Int64;
begin
  if not SolveDiophante(a1, -a2, b2 - b1, x, Delta) then Exit(0);
  x := PMod(x, Delta);
  minK := (L - b1) div a1;
  if minK * a1 + b1 < L then Inc(minK);
  maxK := (R - b1) div a1;
  if maxK * a1 + b1 > R then Dec(maxK);
  if minK > maxK then Exit(0);
  len := maxK - minK + 1;
  res := len div Delta;
  minK := minK + res * Delta;
  if minK <= maxK then
    begin
      minK := PMod(minK, Delta);
      maxK := PMod(maxK, Delta);
      if minK <= maxK then
        begin
          if (x >= minK) and (x <= maxK) then
          Inc(res);
        end
      else
        begin
          if (x >= minK) or (x <= maxK) then
            Inc(res);
        end;
    end;
  Result := res;
end;

begin
  AssignFile(fi, InputFile); Reset(fi);
  AssignFile(fo, OutputFile); Rewrite(fo);
  try
    Enter;
    WriteLn(fo, Solve);
  finally
    CloseFile(fi);
    CloseFile(fo);
  end;
end.


program Project_D;

const
  p = 1000000000000000;

var
  q, test, i: longint;
  a, b, m, l, r, k, x, ans, y, z: int64;
  mas: array[1..50] of int64;

function pow(a, b: int64): int64;
var
  i: longint;
  x: int64;
begin
  x := 1;
  for i := 1 to b do
    x := x * a;
  pow := x;
end;

begin
  read(q);
  for test := 1 to q do begin
    read(a, b, m);
    if a = b then
      writeln('1 ', a)
    else begin
      k := 2;
      l := 1;
      r := m;
      while (b - l * a > 0) and not ((b - l * a >= l) and (b - l * a <= r)) do begin
        inc(k);
        l := l * 2;
        r := (r * 2) mod p;
      end;
      if b - l * a <= 0 then
        writeln('-1')
      else begin
        ans := b - l * a;
        x := l;
        for i := k - 3 downto 0 do begin
          y := pow(2, i);
          z := 1 + (ans - x) div y;
          if z > m then
            z := m;
          x := x + (z - 1) * y;
          mas[k - i - 2] := z;
        end;
        mas[k - 1] := ans - x + 1;
        if mas[k - 1] = 0 then
          mas[k - 1] := 1;

        write(k, ' ', a, ' ');
        for i := 1 to k - 1 do begin
          write(a + mas[i], ' ');
          a := 2 * a + mas[i];
        end;
        writeln;
      end;
    end;
  end;
end.


          uses strutils;
          const eps=1e-14;
          besk=20000000000000000; label 4,1,3,2,44,22;
          type mas=array[-10000..400000+1] of int64;
          integer=longint;     zap=record  x,y,z:int64; end;
          zap1=^zap;
          var green,kk,pos,ii,qqq,oldpos,jj,kolvzv,sdvig,dl,i1,j1,mask,stepp,n2,i,j,k,l,step,k1,mesto:longint;
          oldss,smin,ss3,ss,ss1,ss2:string;
          aans:zap;
          pqqq:zap;  bet,al:extended; fl1,fl2,fl:boolean;
          drans,dr3,dr1,dr2,pt,ott1,ott2:zap;
          ver:array[-1..500,-1..5] of extended;
          xmax,xmin,ymax,ymin,newpos,newdl,len,pp3,ans1,ans2,modul,t0,t1,t2,dloch,koldel,mmax,nap,ot,stepen,pq,pp1,pp2,period, dolg,ot1,ot2,oldgr,predsum,pmin,tmin,aa,bb,kool,number,imin,kolreber,kolstan,qq,kol,chisl,znam,n,m,ttt,numpos,vx,vy,ans,up,down,imax,t3,qq1,qq2,q1,q2,ost,koll,w,dx,dy,time,p3,p4,qqqq,tt,pmax,pmax2,p1,p2,ott,hh,pos0,pos1,pos2,pp,mm,maxot,tmax,nn,n1,q,t,p:int64; flag1:boolean;
          numzx,numzy,numyx,numyz,numxy,numxz,zzz,fact,z,stan,a2,invx,invy,summ,place,str,b2,z1,sum1,sum0,d0,d1,ccc,c,d,a,b:mas; flag2,flag:boolean;  pl:longint;
          izb, sum,oldmax,newmax,posmax,zapas,razn,oldll,oldrr,ppp,shag,posx,posy,minx,miny,maxx,maxy,kolplus,kolminus,razr,jmax,gr,grr,ener,dob,cc,dist,tt3,tt1,tt2,ugg,aa1,aa2,r,ug:int64;
          new,zan2,zan1,prost,marked,zan:array[-10000..11000000] of boolean;
          newoch,left,right,d2,och,delit, num,start,finish,zz,ll,rr,path,lx,a3,a4,predok,a1,b1:array[-100000..9550000] of int64;
          ppole1,ppole2,ppole:array[-1000000..3000000] of char;
          bufer, str1,str2,stroka:array[-1000..1000000] of char;
          dinam:array[-100000..1000000] of extended;
          al1,bet1,cosa,sina,cosb,sinb,rx,ry,sdvigx,sdvigy,px,py,h1,h2,h,l1,l2,otmax,v:int64;
          dddd,ssumitog,profil:array[-100..110,-100..110,-100..110] of int64;
          sss1,sss2,sp,sss:array[-10..1100005] of string;
          newpole,pole:array[-1..2100,-1..2700] of char;
          verch,verzn:array[-10..1100000] of int64;
          dd,dd1,dd2,ddinv:array[-2..11000,-2..1100] of longint;
          dnext:array[0..26,-1..300001] of int64;
          obmen,ch:char;
          ff,flagg1:boolean;
          pred,oldx,oldy,numx,numy,xleft,xright,s,znach,newplace,newstr,next,prev,xx,yy,aold,x,y:array[-10000..1700002] of int64;
          function srav(i,j:longint):boolean; label 44;
                    begin
                      if (a[i]<a[j]) then begin srav:=true; goto 44;  end;
                      if a[i]>a[j] then begin  srav:=false; goto 44;   end;
                      if a[i]=a[j] then if a1[i]<a1[j] then srav:=true else srav:=false;
                           44:
                    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 evkl(a,b:int64):zap1; var d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;
              tt:zap; tt1:zap1;  fl:boolean;
              begin
                fl:=false;
              if a<b then begin r:=a;a:=b;b:=r; fl:=true; end;
               x2:=1;x1:=0;y2:=0;y1:=1;
               while b>0 do
               begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;
               a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;
               end;
               if not fl then begin d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt; end else
                begin d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=y;tt.p3:=x; tt1:=@tt; end;
                evkl:=tt1;
              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 arccos(tt:extended):extended;
                         begin
                          if abs(tt)>1-1e-13 then
                          if tt>0 then  arccos:=0 else arccos:=pi;
                          if tt=0 then arccos:=pi/2 else
                          if abs(tt)<=1-1e-13 then if tt>=0 then arccos:=arctan(sqrt(1-tt*tt)/tt)
                          else arccos:=pi+arctan(sqrt(1-tt*tt)/tt);

                         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;    label 4;
                                  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;

                             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 zaprmin(left,right:longint):zap1;
         var nomer,ot,ii,jj:int64; pp,ans:zap;
               begin
               if left>=right then begin  ans.x:=y[left]; ans.y:=z[left]; zaprmin:=@ans; end  else
                  begin
                    if not odd(left) and odd(right) then
                  begin
                    zaprmin:=zaprmin(left shr 1,right shr 1)
                  end  else
                        begin
                          if odd(left) then
                         begin
                           { zaprmin:=min(zaprmin(left+1,right),y[left]); }
                            pp:=zaprmin(left+1,right)^;
                            if pp.x<y[left] then begin ans.x:=pp.x; ans.y:=pp.y; end
                               else begin ans.x:=y[left]; ans.y:=z[left];  end;
                            zaprmin:=@ans;
                         end;
                          if not odd(right) then {zaprmin:=min(zaprmin(left,right-1),y[right]); }
                        begin
                           { zaprmin:=min(zaprmin(left+1,right),y[left]); }
                            pp:=zaprmin(left,right-1)^;
                            if pp.x<y[right] then begin ans.x:=pp.x; ans.y:=pp.y; end
                               else begin ans.x:=y[right]; ans.y:=z[right];  end;
                            zaprmin:=@ans;
                         end;

                        end;
                   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:=qq;  cc:=aa; fl:=false;
                   while abs(aa-bb)>1 do
                     begin
                       cc:=(aa+bb) shr 1;
                         {  writeln('cc=++ ',cc);
                         } if x[cc]<gr then aa:=cc else bb:=cc;

                     end;
                    {  writeln(' cc= ',cc);
                    } cc:=max(cc-3,0);
                      repeat inc(cc) until x[cc]>=gr;
                      nomerr:=cc;
                 end;

              function pprost(pp:int64):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;

                    function slog(d1,d2:zap):zap1;
                    var t,tt,p,q:int64; ans:zap;
                    begin
                      p:=d1.x*d2.y+d1.y*d2.x;
                      q:=d1.y*d2.y;
                      t:=nod(p,q);
                      p:=p div t; q:=q div t;
                      ans.x:=p mod modul;ans.y:=q mod modul;

                        slog:=@ans;
                    end;

                    function umn(d1,d2:zap):zap1;
                    var t,tt,p,q:int64; ans:zap;
                    begin
                      p:=d1.x*d2.x;
                      q:=d1.y*d2.y;
                      t:=nod(p,q);
                      p:=p div t; q:=q div t;
                      ans.x:=p mod modul;ans.y:=q mod modul;

                        umn:=@ans;
                    end;

            function bincoef(ii,jj:longint):int64;
                var t1,t2,t3,p1,p2,p3,ot:int64;
                begin
                  p1:=fact[ii];
                  p2:=fact[jj];
                  p3:=fact[ii-jj];
                  t2:=degg(p2,modul-2);
                  t3:=degg(p3,modul-2);
                  ot:=((p1*t2) mod modul*t3) mod modul;
                  bincoef:=ot;
                end;

    function good (pq:int64):boolean;
    var i,j:longint;  ot,kol:int64; fl:boolean;
    begin
     fl:=true;
    { writeln('tt= ',tt,' pq= ',pq,' p= ',p);
    } for i:=1 to tt do
      begin
      { writeln(x[i],' * ',pq,' = ',zz[i]);
      } if x[i]*pq<zz[i] then fl:=false;

      end;

     good:=fl;
    end;

    function problem (pq:int64):int64;
    var i,j:longint;  ot,kol:int64; fl:boolean;
    begin
     fl:=true;  ot:=-1000;
    { writeln('tt= ',tt,' pq= ',pq,' p= ',p);
    } for i:=1 to tt do
      begin
      { writeln(x[i],' * ',pq,' = ',zz[i]);
      } if x[i]*pq<zz[i] then ot:=i;

      end;

     problem:=ot;
    end;

    begin
     {  assign (input,'D:\Projects\input.txt');reset(input);
       assign (output,'D:\Projects\output.txt'); rewrite(output);
      }
            read(n);
         for i:=1 to 4*n+1 do read(x[i],y[i]);

   for ii:=1 to 4*n+1 do
begin
    xmax:=-besk; ymax:=-besk; xmin:=besk;
    ymin:=besk;
         for i:=1 to 4*n+1 do if i<>ii then
        begin
           xmax:=max(xmax,x[i]);
           ymax:=max(ymax,y[i]);
           xmin:=min(xmin,x[i]);
           ymin:=min(ymin,y[i]);

        end;

   {  writeln('ii= ',ii,' ',xmin,' ',xmax,' ',ymin,' ',ymax);
    }
       if xmax-xmin=ymax-ymin then flag1:=true else flag1:=false;
      for i:=1 to 4*n+1 do if i<>ii then
        begin
           flag:=true;
           if (x[i]=xmin)and(y[i]>=ymin)and(y[i]<=ymax) then flag:=false;
           if (x[i]=xmax)and(y[i]>=ymin)and(y[i]<=ymax) then flag:=false;
           if (y[i]=ymin)and(x[i]>=xmin)and(x[i]<=xmax) then flag:=false;
           if (y[i]=ymax)and(x[i]>=xmin)and(x[i]<=xmax) then flag:=false;
          {  writeln('i= ',i,' ',flag);
           }
           if flag then flag1:=false;
        end;

     if flag1 then begin writeln(x[ii], '  ',y[ii]);     end;

end;

               1: close (output);
    end.


const MI:array[1..3] of longint = (1,500000004,333333336);
const maxn = 4000+10;
cmod = 1000000007;
var f1,f2:text;
F:array[-1..maxn,-1..maxn] of longint;
xy:array[0..1,0..1] of longint;
h,w:longint;
res,sum :int64;

Function GCD(y,x:longint):longint;
begin
        if x=0 then exit(y);
        GCD:=GCD(x,y mod x);
end;

Function C(i,j:longint):longint;
var k:longint;
s:int64;
begin
        if i<j then exit(0);
        s:=1;
        For k:=0 to j-1 do
        s:=s*(i-k);
        For k:=1 to j do
        s:=s div k;
        C:=s mod cmod;
end;

Function S(x1,y1,x2,y2,x3,y3:longint):longint;
begin
        S:=y1*x2-y2*x1+y2*x3-y3*x2+y3*x1-y1*x3;
end;

Procedure process;
var i,j:longint;
t1x,t1y,t2x,t2y,t3x,t3y,d1,d2,d3:longint;
t2,t3:longint;
s1,s2,s3:int64;
begin
        For j:=2 to w do
        F[0,j]:=C(j,2);
        For i:=2 to h do
        F[i,0]:=C(i,2);
        For i:=1 to h do
        For j:=1 to w do
          F[i,j]:=(F[i-1,j]+F[i,j-1]-F[i-1,j-1]+GCD(i,j)-1) mod cmod;
        For i:=0 to h do
        for j:=0 to w do
        res:=(res+F[i,j]+F[i,w-j]-F[i,0]-F[0,j]) mod cmod;
        For i:=0 to h do
        for j:=0 to w do
        inc(xy[i mod 2,j mod 2]);
        inc(w);inc(h);

        sum:=0;
        for d1:=0 to 3 do
        for d2:=d1 to 3 do
        for d3:=d2 to 3 do
        begin
          t1x:=d1 div 2;t1y:=d1 mod 2;t2x:=d2 div 2;t2y:=d2 mod 2;t3x:=d3 div 2;t3y:=d3 mod 2;
          if S(t1x,t1y,t2x,t2y,t3x,t3y) mod 2 =0 then
          begin
            s1:=xy[t1y,t1x];
            s2:=xy[t2y,t2x];
            s3:=xy[t3y,t3x];
            t2:=1;t3:=1;
            if (t1x=t2x) and (t1y=t2y) then begin dec(s2);inc(t2);end;
            if (t1x=t3x) and (t1y=t3y) then begin dec(s3);inc(t3);end;
            if (t2x=t3x) and (t2y=t3y) then begin dec(s3);inc(t3);end;
            sum:=sum+((((s1*s2) mod cmod*s3) mod cmod * MI[t2]) mod cmod * MI[t3]) mod Cmod;
          end;
        end;

        res:=(sum-res)*6 mod cmod;
        writeln(f2,(res + cmod) mod cmod);
end;

begin
        assign(f1,'');reset(f1);
        assign(f2,'');rewrite(F2);
        readln(f1,w,h);
        Process;
        close(f1);
        close(f2);
end.


var i,i1,j,s,f,n:longint;

begin

//assign(input,'input.txt'); reset(input);
//assign(output,'output.txt'); rewrite(output);

readln(n);

for i1:=1 to n do
begin
read(s);f:=0;
 for i:=0 to s div 7 do
 if f=1 then break else
  for j:=0 to s div 3 do
  if i*7+j*3=s then begin f:=1; writeln('YES');break;end;
 if f=0 then writeln('NO');
end;
end.


program tr1_l;
var a,b,c,n,min,k,k1,k2,l:longint;
 begin
 readln (n,a,b,c);
 l:=0;

 for k:=0 to n do
    for k1:=0 to n do
    begin
    if ((n-(k*a+k1*b)) mod c = 0) and ((n-(k*a+k1*b)) >= 0) then
     begin
      k2:=(n-(k*a+k1*b)) div c;
      if (k+k1+k2>l) then l:=k+k1+k2;
     end;
    end;
 writeln (l);
end.


var	s,s2:ansistring;
	i:integer;
	t:char;
	a:Array['0'..'9'] of integer;
	procedure di(o:longint; b:boolean);
	var	t:char;
		i:integer;
		begin
			if b=true then
			begin
				for t:='9' downto '0' do
					for i:=1 to a[t] do
						s:=s+t;
				writeln(s);
				halt;
			end
			else if o>length(s2) then
			begin
				writeln(s);
				halt;
			end
			else
			begin
				if a[s2[o]]>0 then
				begin
					dec(a[s2[o]]);
					s:=s+s2[o];
					di(o+1,false);
					delete(s,o,1);
					inc(a[s2[o]]);
				end;
				for t:=s2[o] downto '0' do
					if (t<>s2[o]) then
						if a[t]>0 then
						begin
							dec(a[t]);
							s:=s+t;
							di(o+1,true);
						end;
			end;
		end;
begin
	readln(s);
	readln(s2);
	if length(s)<length(s2) then
	begin
		fillchar(a,sizeof(a),0);
		for i:=1 to length(S) do
			inc(a[s[i]]);
		for t:='9' downto '0' do
			for i:=1 to a[t] do
				write(t);
	end
	else
	begin
		fillchar(a,sizeof(a),0);
		for i:=1 to length(S) do
			inc(a[s[i]]);
		s:='';
		di(1,false);
	end;
end.


var n, m, k, i, s, s1, s2:longint;
begin
 read(n, m, k, i);
 s:=(n div m)*i; s1:=0; s2:=n*k;
 n:=n mod m;
 if n<>0 then s1:=s+i else s1:=1000000;
 s:=s+n*k;
 if (s2<s1)and(s2<s) then write(s2) else
 if (s1<s)and(s1<>0)and(s1<s2) then write(s1) else
 write(s);
end.


var
    phi, primes, cnt: array [0..1000005] of longint;
    sz, n, k, i, j: longint;
	ans: int64;

begin
    readln(n, k);
    for i := 1 to n do
    begin
		phi[i] := 0;
		cnt[i] := 0;
    end;
    ans := 0;
    if k = 1 then
    begin
        writeln(3);
        exit;
    end;
    phi[1] := 1;
    for i := 2 to n do
    begin
        if phi[i] = 0 then
        begin
            phi[i] := i - 1;
            primes[sz] := i;
            inc(sz);
        end;
        for j := 0 to sz - 1 do
        begin
            if i * primes[j] > n then
			begin
				break;
			end;
            if i mod primes[j] <> 0 then
            begin
                phi[i * primes[j]] := phi[i] * (primes[j] - 1);
            end
            else
            begin
                phi[i * primes[j]] := phi[i] * primes[j];
                break;
            end;
        end;
    end;
    for i := 1 to n do
	begin
		inc(cnt[phi[i]]);
	end;
    sz := 0;
    for i := 1 to n do
    begin
        while cnt[i] <> 0 do
        begin
            inc(sz);
            phi[sz] := i;
            dec(cnt[i]);
        end;
    end;
    for i := 1 to k + 2 do
	begin
		ans := ans + phi[i];
	end;
    writeln(ans);
end.


var i,r,n,L,k:int64;
c:array[0..31]of biginteger;
s:biginteger;
//const maxint=9223372036854775807;
function min(a,b:biginteger):biginteger;
begin
if a<b then min:=a
else min:=b;
end;

begin
//c[0]:=maxint;
read(n,l);
k:=1;
read(r);
c[1]:=r;
for i:=2 to n do
begin
  read(r);
  c[i]:=min(r,c[i-1]*2);
end;
for i:=n+1 to 30 do
c[i]:=2*c[i-1];
for i:= 29 downto 1 do
c[i]:=min(c[i],c[i+1]);
while l>0 do
begin
  if c[k]<=s then s:=c[k];
  s:=s+c[k]*(l mod 2);
  l:=l div 2;
  inc(k);
end;
  if (c[k]<=s) and (k<>31)  then s:=c[k];
write(s);
end.


var
   x:array['A'..'C'] of 0..2;
   k1,k2,k3,u:char;
   d,i:byte;

BEGIN
   for i:=1 to 3 do
       begin
          readln(k1,k2,k3);
          if k2='>' then inc(x[k1])
             else inc(x[k3]);
       end;
   if (x['A']=x['B']) or (x['A']=x['C']) or (x['B']=x['C']) then
      writeln('Impossible')
   else begin
           d:=0;
           while d<=2 do
              begin
                 for u:='A' to 'C' do
                    if x[u]=d then write(u);
                 inc(d);
              end;
        end;
   readln;
END.


var
    a1, a2, a3: integer;
    b1, b2, b3: integer;
    a, b, n: integer;
begin
    readln( a1, a2, a3 );
    readln( b1, b2, b3 );
    readln( n );
    a := a1 + a2 + a3;
    b := b1 + b2 + b3;
    while( a > 0 ) do
    begin
        n := n - 1;
        a := a - 5;
    end;
    while( b > 0 ) do
    begin
        n := n - 1;
        b := b - 10;
    end;
    if( n >= 0 ) then
        writeln( 'YES' )
    else
        writeln( 'NO' );
end.


program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var n:longint;
    x,y:longint;

begin
  readln(n,x,y);
  if (x in [n div 2..n div 2+1]) and (y in [n div 2..n div 2+1]) then
    writeln ('NO') else writeln('YES');
end.


const mo:int64=10000000000000;ww:int64=5000000000000000000;
var map:array[0..9,0..9]of int64;
    loop:array[0..13]of int64;
    t:array[0..13]of int64;
    a,b,c:array[1..2,1..2]of int64;
    tmp,now,n1,n2,n,ans:int64;
    i:longint;
function cheng(a,b:int64):int64;
var s:int64;
begin
  s:=0;
  while b>0 do
  begin
    if b and 1=1 then s:=(s+a)mod mo;
    a:=(a<<1)mod mo;b:=b>>1;
  end;
  exit(s);
end;
procedure matrix(x:int64);
var i,j,k:longint;
begin
  a[1,1]:=1;a[1,2]:=0;b[1,1]:=0;b[1,2]:=1;b[2,1]:=1;b[2,2]:=1;
  while x>0 do
  begin
    if x and 1=1 then
    begin
      fillchar(c,sizeof(c),0);
      for i:=1 to 1 do for j:=1 to 2 do for k:=1 to 2 do
      c[i,j]:=(c[i,j]+cheng(a[i,k],b[k,j]))mod mo;
      a:=c;
    end;
    fillchar(c,sizeof(c),0);
    for i:=1 to 2 do for j:=1 to 2 do for k:=1 to 2 do
    c[i,j]:=(c[i,j]+cheng(b[i,k],b[k,j]))mod mo;
    b:=c;x:=x shr 1;
  end;
end;
function dfs(x,y:int64):int64;
var n2,tmp,s,e:int64;
begin
  if y=14 then exit(x);
  s:=ww;tmp:=x;
  while tmp<x+loop[y] do
  begin
    matrix(tmp);n2:=a[1,2] div t[y-1] mod 10;
    if n2=n div t[y-1] mod 10 then
    begin
      e:=dfs(tmp,y+1);if e<s then s:=e;
    end;
    tmp:=tmp+loop[y-1];
  end;
  exit(s);
end;
begin
  read(n);
  tmp:=1;now:=0;loop[0]:=1;t[0]:=1;
  for i:=1 to 13 do t[i]:=t[i-1]*10;
  for i:=1 to 13 do
  begin
    fillchar(map,sizeof(map),0);
    repeat
      matrix(now);
      n1:=a[1,1] div tmp mod 10; n2:=a[1,2] div tmp mod 10;
      if map[n1,n2]>0 then break;
      map[n1,n2]:=now;now:=now+loop[i-1];
    until false;
    tmp:=tmp*10;
    loop[i]:=now-map[n1,n2];
  end;
  ans:=dfs(0,1);if ans=ww then ans:=-1;writeln(ans);
end.


{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3,l:longint;
    nn,mm,kk,u,v,w,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  //fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,k,m);
  for i:=1 to n do read(qq[i]);
  qq[n+1]:=-1000000;

  for i:=1 to n+1 do cc[i]:=0;
  cc[0]:=1;
  l:=2*(n+2)*(k+2)+1;
  aa[0]:=1; aa[n+1]:=0;
  for ii:=1 to l do
    begin
    u:=ii mod (2*k);
    if u>k then u:=2*k-u;
    for i:=1 to n do aa[i]:=0;
    for i:=0 to n do
      if cc[i]=1 then
        for j:=i-1 to i+1 do
          if i+j>0 then
          begin
          w:=qq[j]+u;
          if w<=m then aa[j]:=1;
          end;
    for i:=0 to n+1 do cc[i]:=aa[i];
    end;

  if cc[n+1]=1 then writeln('Yes') else writeln('No');

  //fin;
  end;

begin
//init;
nt:=1;
readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.


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


program A435;

{$APPTYPE CONSOLE}

uses
  SysUtils;

Var i,n,m,ans,t,x: LongInt;
 Begin
 Read(n,m);
 t:=0;
 for i:=1 to n do Begin
   Read(x);
   if t+x<=m then t:=t+x
   else begin
    inc(ans);
    t:=x;
   end;
  End;
  write(ans+1);
 End.


program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
	a: array[1..4] of Int64;
	s: string;
	c: array[1..3] of Char;
	min: Int64;
	i1, i2, i3, i4: Integer;

function	Cal(xa, xb, xc, xd: Integer; ca, cb, cc: Char): Int64;
	function	One(x, y: Integer; op: Char): Int64;
	begin
		if op='+' then Result := x+y
		else Result := x*y;
	end;
begin
	Result := One(One(One(xa, xb, ca), xc, cb), xd, cc);
	if Result<min then min := Result;
	Result := One(One(xa, xb, ca), One(xc, xd, cb), cc);
	if Result<min then min := Result;
end;
begin
	Readln(a[1], a[2], a[3], a[4]);
	Readln(s);
	if s='+ + +' then Writeln(a[1] + a[2] + a[3] + a[4])
	else if s='* * *' then Writeln(a[1] * a[2] * a[3] * a[4])
	else begin
		c[1] := s[1]; c[2] := s[3]; c[3] := s[5];
		min := Cal(a[1], a[2], a[3], a[4], c[1], c[2], c[3]);
		for i1:=1 to 4 do
		begin
			for i2:=1 to 4 do
			begin
				if i1=i2 then continue;
				for i3:=1 to 4 do
				begin
					if (i1=i3) or (i2=i3) then continue;
					for i4:=1 to 4 do
					begin
						if (i1=i4) or (i2=i4) or (i3=i4) then continue;
						Cal(a[i1], a[i2], a[i3], a[i4], c[1], c[2], c[3]);
					end;
				end;
			end;
		end;
		Writeln(min);
	end;
end.


program ProjectD;
{$APPTYPE CONSOLE}
var i,j,a,n:longint;
    ans,p,num:array[0..10000001]of longint;
    res,tres:int64;
begin
  read(a,n);
  fillchar(p,sizeof(p),0);

  p[1]:=1;
  num[1]:=1;
  ans[1]:=1;
  for i:=2 to a+n-1 do
    begin
      if p[i]=0 then
        begin
          p[i]:=i;
          j:=2*i;
          while j<=a+n-1 do
            begin
              if p[j]=0 then p[j]:=i;
              j:=j+i;
            end;
        end;
      if (i div p[i])mod p[i]=0 then num[i]:=num[i div p[i]]+1 else
                                     num[i]:=1;
      if ((i div p[i])mod p[i]=0)and(num[i] mod 2=0)then ans[i]:=ans[i div p[i]]*p[i]*p[i] else
                                                         ans[i]:=ans[i div p[i]];
    end;

  res:=0;
  for i:=a to a+n-1 do
    begin
      tres:=i div ans[i];
      res:=res+tres;
    end;
  write(res);
end.


const inf = 1000000000;
var
j,ce,t,ee,ss,b1,b2,all,a1,a2,count,cnt,sc,ccc,e,n,d,s,min,cc,ff,ll,i:longint;
ttt,b,a:array[0..200000]of longint;

    procedure sortt(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=b[l+random(r-l)];
         repeat
           while b[i]<x do
            inc(i);
           while x<b[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=b[i];
                b[i]:=b[j];
                b[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sortt(l,j);
         if i<r then
           sortt(i,r);
      end;

    procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[l+random(r-l)];
         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);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

 begin
  read(n,d,s);

  min:=inf*2;

  for i:=1 to n do
   begin
    read(cc,ff,ll);
    if cc=0 then
      begin
       if ll<d then cnt:=cnt+1 else
        begin
         e:=e+1;
         a[e]:=ff;
        end;
      end else
      begin
       count:=count+1;

       if ll<d then
        begin
         ccc:=ccc+cc-1;
         if ccc>inf then ccc:=inf;
        end else
        begin
         sc:=sc+cc-1;
         if sc>inf then sc:=inf;
         if ff<min then min:=ff;

         t:=t+1;
         b[t]:=ff;
        end;
      end;
   end;

  sort(1,e);
  sortt(1,t);

  a1:=0;
  a2:=0;

  ss:=s;
  b1:=0;
  b2:=0;
  for i:=1 to e do
    if a[i]<=ss then
      begin
       ss:=ss-a[i];
       b1:=b1+1;
       b2:=b2+a[i];
      end;

   if (b1>a1)or((b1=a1)and(b2<a2)) then
        begin
         a1:=b1;
         a2:=b2;
        end;

  if min<=s then
    begin
     ss:=s-min;
     all:=sc+ccc+1;
     if all>inf then all:=inf;

     b1:=count;
     b2:=min;

     if all>=cnt+e then
      begin
       b1:=b1+cnt+e;
      end else
      begin

       ee:=0;
       for i:=1 to e do
         begin
          ee:=ee+1;
          ttt[ee]:=a[i];
         end;

       for i:=1 to cnt do
         begin
          ee:=ee+1;
          ttt[ee]:=1000000001;
         end;

       for i:=1 to ee do
         a[i]:=ttt[i];

       sort(1,ee);

       for j:=ee downto ee-all+1 do
         b1:=b1+1;

       ee:=ee-all;
       j:=2;

       for i:=ee downto 1 do
         begin
          if (j<=t)and(b[j]<a[i]) then
            begin
             a[i]:=b[j];
             j:=j+1;
            end;
         end;
       sort(1,ee);

for i:=1 to ee do
      if ss>=a[i] then
        begin
         ss:=ss-a[i];
         b1:=b1+1;
         b2:=b2+a[i];
       end;

      end;

      if (b1>a1)or((b1=a1)and(b2<a2)) then
        begin
         a1:=b1;
         a2:=b2;
        end;
    end;

  writeln(a1,' ',a2);
 end.


var n,i:longint;p,w,p1,w1: boolean;s,q:string;
begin
readln(q); readln(n);
for i:=1 to n do
begin
 readln(s);
 if q=s then begin
  write('YES');halt
 end else

  if q[1]=s[2] then p1:=true;

  if q[2]=s[1] then w1:=true;
end;
if   w1   and p1 then write('YES')else write('NO');
end.


var a,b:array[0..2000]of longint;i,m,n,k,j:longint;
begin
 read(n);
 for i:=1 to n div 2 do begin read(j);a[j]:=1;end;
 b:=a ;
 m:=0;
 for i:=1 to n div 2 do
 begin
  if b[2*i-1]=0 then begin
   j:=2*i ;while b[j]=0 do inc(j);
   m:=j-(2*i-1)+m;b[j]:=0;
  end;
 if b[2*i ]=1 then begin
   j:=2*i+1;while b[j]=1 do inc(j);
   m:=j-(2*i)+m;b[j]:=1;
  end;end;
  b:=a ;
 k:=0;
 for i:=1 to n div 2 do
 begin
  if b[2*i-1]=1 then begin
   j:=i+i;while b[j]=1 do inc(j);
   k:=j-(2*i-1)+k;b[j]:=1;
  end;
 if b[2*i ]=0 then begin
   j:=i+1+i;while b[j]=0 do inc(j);
   k:=j-i*2+k;b[j]:=0;
  end;end;
  if k<m then write(k) else write(m);
end.


var i,a,b,c,n,j,k:longint;
begin
 read(n,a,b);
 if a>b then begin K:=a;a:=b;b:=k;end;
 if  (a<=n div 2)and(b>n div 2) then write('Final!') else begin
 k:=1;
 while   odd(b) or(b-a>1) do
 begin
  inc(k); a:=(a+1) div 2; b:=(b+1) div 2;
 end;
 write(k);end;
end.


                 {$APPTYPE CONSOLE}
const  besk=4000000000000000000;
   nnn=2000000;  eps=1e-17;
 label 1,2,3,4;
 type mas=array[-10..2100000] of int64;
 var nn,chel,znam,len,ii,jj,i3,i2,i1,j1,k1,p1,p2,kt,ppp,god,day,mon,mask,i0,j0,k,step,i,j,start,finish,m:longint;
aa,bb:extended;
ot,cc,h,w,ll,rr,dloch,n,yy1,xx1,xx2,q,xx,yy,p,modul,pp,tt,ot1,ot2,kold,kkr:int64;
t,newdl,kk,centr,koef:int64;
sl1,sl2,itog:mas;
flag2,flag1,flag:boolean;
xobl,yobl,t1,t2,x0,y0, rshar,vx,vy,x1,y1:extended;
minotkl,dl1,dl2,dl3,hh,po,pt,doltek,dolpred:extended;
dl,och,newoch,c,a,f,kop:array[0..2100000] of int64;
x,y: array[-10..50000] of int64;
ver: array[-10..51,-10..100,-10..100] of extended;
zan,marked:array[-100000..250000] of boolean;
gr:array[-1000..5000,-1000..5000] of boolean;
{ss:array[0..2000000] of char; }
ss,sss:string;
ch11,ch12,ch1,ch:char;
dd1: array[-10..2000,-10..2000] of int64;
b:array[0..2000000,-1..21] of int64;
prev,next,s,kol,place,sr,str :array[-10 ..2000000] of int64;
ssot:array[-1000..110000] of string;
fact:array[0..100] of extended;
name:array[0..2000] of string;
function min (a,b:extended):extended;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

    function nod(a,b:int64):int64; var p,t:int64;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

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

function kolch(p,k:int64):int64;  label 22; var deg,p2,ot,t,p1,q:int64;   i,j:longint;

 begin
   p1:=p; t:=0;  ot:=0;
   while p1>0 do begin inc(t); c[t]:=p1 mod 2; p1:=p1 div 2;   end;
  { for i:=1 to t do write(c[i],' '); writeln;
  } q:=k;
     for i:=t downto 1 do if (c[i]=1)and(q>=0) then
        begin
          { writeln('binom',i-1,'  po  ',q);
          }
          ot:=ot+dd1[i-1,q]; dec(q);

        end;

 kolch:=ot;
 end;

begin

   { assign (input,'E:\Projects\input.txt');reset(input);
      assign (output,'E:\Projects\output.txt'); rewrite(output);
    }
    read(n);
    p1:=0;p2:=0;
    for i:=1 to n do read(a[i]);
    for i:=1 to n do if a[i]=100 then inc(p1) else inc(p2);
    {writeln(p1,' ',p2);
    }for i:=1 to n do ot:=ot+a[i];
    if odd(ot div 100) then begin writeln('NO'); goto 1;   end;
    if  not odd(p1) and not odd(p2) then begin writeln('YES'); goto 1;   end;
    if  not odd(p1) and  odd(p2) and (p1>1) then
    begin writeln('YES'); goto 1;   end;
     writeln('NO');

   1:          close(output);
end.


{$APPTYPE CONSOLE}
{$M 99777216}
{$R-,Q-,O+,S+,H+}
uses
  Math,SysUtils;
const
  md = 1000000007;
var
  c : array [0..100, 0..100] of int64;
  dp : array [0..100, 0..100] of int64;
  a : array [0..9] of longint;
  sum, i, j, k, l, n, ans : LongInt;
begin
//  reset(input, 'input.txt');
//  rewrite(output, 'output.txt');
  readln(n);
  for i := 0 to 9 do
    read(a[i]);
  sum := 0;
  for i := 0 to 9 do
    Inc(sum , a[i]);
  for i := 0 to n do
    c[i, 0] := 1;
  for i := 1 to n do
    for j := 1 to n do
      c[i, j] := (c[i - 1, j] + c[i - 1, j - 1]) mod md;
  ans := 0;
  for i := max(sum, 1) to n do
    begin
      fillchar(dp, sizeof(dp), 0);
      dp[0, i] := 1;
      for j := 0 to 9 do
        for k := 0 to i do
          for l := a[j] to k do
            begin
              if (j = 0) and (l = k) then
                Break;
              if j = 0 then
                inc(dp[j + 1, k - l], dp[j, k] * c[k - 1, l])
              else
                Inc(dp[j + 1, k - l], dp[j, k] * c[k, l]);
              dp[j + 1, k - l] := dp[j + 1, k - l] mod md;
            end;
      ans := (ans + dp[10, 0]) mod md;
    end;
  writeln(ans);
end.


var
  k:char;
  i,n,m:integer;
  s:string;
begin
  readln(n);
  readln(s);
  k:=s[1];
  m:=0;
  if n>1 then
  begin
    for i:=2 to n do
      if s[i]=k then
        inc(m)
      else
        k:=s[i];
    write(m);
  end;
  if n=1 then
    write(m);
end.


var
 s1,s2: String;
 i,j: Integer;
 c: Integer = 0;

label no;
begin
	readln(s1);
	readln(s2);
	for i := length(s1) downto 1 do
			if s2[i] <> s1[length(s1)-i+1] then goto no;
	writeln('YES');
	halt;
no:
	writeln('NO');
end.


var
w,a,b:array[0..4000000]of longint;
p,ans,l,r,n,m,i,j:longint;

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

  for j:=1 to m do
   begin
    read(b[j]);
    w[b[j]]:=j;
   end;

  ans:=0;

  i:=0;
  j:=0;

  for i:=1 to n do
    if w[a[i]]>0 then
      begin
       if (w[a[i]]>l)and(w[a[i]]<=r) then l:=w[a[i]] else
        begin
         l:=0;
         r:=0;
        end;

       if (l=0)and(r=0) then
         begin
          l:=w[a[i]];
          r:=w[a[i]];
          j:=i;
         end;

       if j<i then j:=i;
       while j<i+n-1 do
         begin
          j:=j+1;
          p:=w[a[j]];
          if p=0 then
            begin
             j:=j-1;
             break;
            end;
          if p>r then r:=p else
           begin
            if (p+m>r)and(p<l) then
              begin
               r:=p+m;
              end else
              begin
               j:=j-1;
               break;
              end;
           end;
         end;

       if (l>m) then
         begin
          l:=l-m;
          r:=r-m;
         end;

       if j-i+1>ans then ans:=j-i+1;
      end else
      begin
       l:=0;
       r:=0;
       j:=i;
      end;

  writeln(ans);
 end.


var ax,ay,bx,by,cx,cy: int64;
BEGIN
  readln(ax,ay,bx,by,cx,cy);
  ax:=ax-bx;
  ay:=ay-by;
  cx:=cx-bx;
  cy:=cy-by;
  if (ax*ax+ay*ay = cx*cx+cy*cy) and (ax*cy<>ay*cx) then write('Yes') else write('No');
END.


const fi='';
      fo='';
      mn=1000;
var f:text;
    t:array[1..mn] of longint;
    d,n,sum:longint;
procedure input;
 var i:longint;
 begin
  assign(f,fi);
  reset(f);
  readln(f,n,d);
  for i:=1 to n do begin read(f,t[i]); sum:=sum+t[i]; end;
  close(f);
 end;
procedure process;
 var i:longint;
 begin
 sum:=sum+(n-1)*10;
  assign(f,fo);
  rewrite(f);

  if d<sum then begin write(f,-1); end
  else  write(f,(d-sum) div 5+ (n-1)*2);
  close(f);
 end;
begin
 input;
 process;
end.


var t : longint;

function gcd(a, b : int64) : int64;
begin
    if (a = 0) then exit(b)
    else exit(gcd(b mod a, a));
end;

function lcm(a, b : int64) : int64;
begin
    exit(a * b div gcd(a, b));
end;

procedure solve;
var n, i, m, bcnn, ans : int64;
begin
    readln(n);
    bcnn := n - 1; ans := 1; i := 2;
    while (i * i <= n) do
    begin
        if (n mod i = 0) then
        begin
            m := i;
            if (lcm(m, n - m) < bcnn) then
            begin
                bcnn := lcm(m, n - m);
                ans := m;
            end;
            if (lcm(n div m, n - n div m) < bcnn) then
            begin
                bcnn := lcm(n div m, n - n div m);
                ans := n div m;
            end;
        end;
        inc(i);
    end;
    writeln(ans, ' ', n - ans);
end;

begin
    readln(t);
    while (t > 0) do
    begin
        solve;
        dec(t);
    end;
end.


var s: set of 0..9; a:array[1..10] of integer; i,n,m,x:integer;
Begin
readln(n,m);;
s:=[];
for i:=1 to n do
read(a[i]);
for i:=1 to m do begin
read(x);
s:=s+[x]
end;
for i:=1 to n do
if a[i] in s then write(a[i],' ');
End.


Var
	n,m,ans,p,j:int64;
	i:longint;

Begin
	read(n,m);
	ans:=n-m*2;
	if ans<0 then ans:=0;
	write(ans,' ');
	m:=m*2;
	for i:=1 to n do
		begin
			j:=i;
			p:=j*(j-1);
			if p>=m then break;
		end;
	if m=0 then ans:=n
		else ans:=n-i;
	write(ans);
End.


{
ID: luoyuna1
PROG:
LANG: PASCAL
}
{$R+,S+,Q+,I+,O-}
{R-,S-,Q-,I-,O+}
uses math;

var
    a,b,c,x,y,z,n,i:longint;  t,s:string;
function check(s:string):longint;
begin
    if s='C'        then exit(1);
    if s=   'C#'     then exit(2);
    if s=   'D'  then exit(3);
    if s=   'D#'     then exit(4);
    if s=   'E'  then exit(5);
    if s=   'F'  then exit(6);
    if s=   'F#'     then exit(7);
    if s=   'G'  then exit(8);
    if s=   'G#'     then exit(9);
    if s=   'A'  then exit(10);
    if s=   'B'  then exit(11);
    if s=   'H'  then exit(12);
end;
begin
    //assign(input,'te.in');reset(input);
    //assign(output,'.out');rewrite(output);
    readln(s);
    t:=copy(s,1,pos(' ',s)-1);
    a:=check(t);
    delete(s,1,pos(' ',s));

    t:=copy(s,1,pos(' ',s)-1);
    b:=check(t);
    delete(s,1,pos(' ',s));

    t:=copy(s,1,length(s));
    c:=check(t);

    //writeln(a,' ',b,' ',c);
    if a>b then begin x:=a; a:=b; b:=x; end;
    if a>c then begin x:=a; a:=c; c:=x; end;
    if b>c then begin x:=b; b:=c; c:=x; end;

    //writeln(b-a,' ',c-b);

    if b-a=4 then //abc
        if c-b=3 then begin writeln('major');halt; end;
    if c-b=4 then //bca
        if a+12-c=3 then begin writeln('major');halt; end;
    if a+12-c=4 then //cab
        if b-a=3 then begin writeln('major');halt; end;

    if b-a=3 then
        if c-b=4 then begin writeln('minor');halt; end;
    if c-b=3 then //bca
        if a+12-c=4 then begin writeln('minor');halt; end;
    if a+12-c=3 then //cab
        if b-a=4 then begin writeln('minor');halt; end;
    writeln('strange');
    close(input);
    close(output);
end.


Const
  Fi='';//1204A.INP';
  Fo='';//1204A.OUT';

Var s:String;
    i,Res:Longint;

BEGIN
  Assign(Input,Fi); Reset(Input);
  Assign(Output,Fo); Rewrite(Output);

  Readln(s);
  Res:=(Length(s))div 2;

  If ((length(s) mod 2)=1) then
  Begin
  For i:=2 to length(s) do
    If s[i]='1' then
      Begin
        Res:=Res+1;
        Break;
      End;
  End;

  Writeln(Res);

  Close(Input);
  Close(Output);
END.


var
	n: int64;

begin
	//assign(input, 'in'); reset(input);
	//assign(output, 'out'); rewrite(output);
	readln(n);
	n := 6 * n + 1 + 3 * n * (n - 1);
	writeln(n);
end.


const
  fi=''; fo='';
  NMAX=100010; EPS=1e-12;
type dl=record m,v,id:longint; end;
var
  ans:array[1..NMAX] of longint;
  a:array[1..NMAX] of dl;
  n,h,kk:longint;
  ffi,ffo:text;
//
procedure sort(l,r:longint);
var i,j:longint; x,tmp:dl;
begin
  i:=l; j:=r; x:=a[l+random(r-l+1)];
  repeat
    while (a[i].m>x.m) or ( (a[i].m=x.m) and (a[i].v>x.v)) do inc(i);
    while (a[j].m<x.m) or ( (a[j].m=x.m) and (a[j].v<x.v)) do dec(j);
    if i<=j then begin
      tmp:=a[i]; a[i]:=a[j]; a[j]:=tmp;
      inc(i); dec(j);
    end;
  until i>j;
  if i<r then sort(i,r); if l<j then sort(l,j);
end;
//
function ok(x:double):boolean;
var i,k:longint;
begin
  k:=kk;
  for i:=1 to n do begin
    if 1.0*h*k/a[i].v<=x then begin
      ans[k]:=a[i].id;
      dec(k);
      if k=0 then exit(true);
    end;
  end;
  exit(false);
end;
var
  i:longint;
  l,r,mid:double;
//
begin
  assign(ffi,fi);reset(ffi);
  assign(ffo,fo);rewrite(ffo);
    randomize;
    readln(ffi,n,kk,h);
    for i:=1 to n do read(ffi,a[i].m);
    for i:=1 to n do begin read(ffi,a[i].v); a[i].id:=i; end;
    sort(1,n);

    l:=0; r:=1e9;
    for i:=1 to 300 do begin
      mid:=(l+r)/2;
      if ok(mid) then r:=mid else l:=mid;
    end;
    ok(r);
    for i:=1 to kk do write(ffo,ans[i],' ');

    close(ffi); close(ffo);
end.


Uses wincrt;
Var
k, i, a, b, c:integer;
ch:string;
J:boolean;
Begin
J:=true;
Read(ch) ;
K:=length(ch) ;
If k>2 then begin
For i:=1 to k-2 do begin
a:=ord(ch[i])-65;
b:=ord(ch[i+1])-65;
c:=ord(ch[i+2])-65;
If not ((a+b)mod 26=c) then j:=false;
End;
End;
If j=true then writeln('Yes')
Else writeln('No');
End.


label 1;
var
x,y:real;
begin
Readln(x,y);
if x<>0 then
  begin
  if (x=4) and (y=2) then begin Writeln('='); goto 1;  end;
  if (x=2) and (y=4) then begin Writeln('='); goto 1;  end;
  if (x=3) and (y=2) then begin Writeln('>'); goto 1;  end;
  if (x=2) and (y=3) then begin Writeln('<'); goto 1;  end;
  if (x=1) and (y>1) then begin Writeln('<'); goto 1;  end;
  if (x>1) and (y=1) then begin Writeln('>'); goto 1;  end;
  if (x=1) and (y=1) then begin Writeln('='); goto 1;  end;
  If x>y then begin Writeln('<'); goto 1;  end;
  If x<y then begin Writeln('>'); goto 1;  end;
  if x=y then Writeln('=');
  end;
1:
end.


const fi='';
      fo='';
var a:array[1..100] of longint;
    n,k,r,s,i,t:longint;
begin
        assign(input,fi); reset(input);
        assign(output,fo); rewrite(output);
        readln(n,k);
        s:=0;
        for i:=1 to n do
                begin
                        read(a[i]);
                        s:=s+a[i];
                end;
        r:=0;
        t:=trunc(s/(n+r));
        if frac(s/(n+r))>=0.5 then inc(t);
        while t<k do
                begin
                        s:=s+k;
                        inc(r);
                        t:=trunc(s/(n+r));
                        if frac(s/(n+r))>=0.5 then inc(t);
                end;
        write(r);
        close(input);
        close(output);
end.


{$Inline on}
Program Pills;
const dx:array[1..2]of longint=(1,0);
      dy:array[1..2]of longint=(0,1);
      mo=10000007;
var i,j,k,nx,ny,s,t,z,ans,put,cnt,size,flow:longint;
    tot:int64;
    ch:char;
    hash:array[0..mo]of boolean;
    lt,rt,num,need,nd,opt,place,en:array[1..49]of longint;
    h,vh:array[1..22]of longint;
    o:array[1..22]of boolean;
    pre,g,capa:array[1..300]of longint;
    sta,lk:array[1..7,1..8]of longint;
    w:array[1..10,1..10]of longint;
    res,pp:array[1..14,1..15]of char;
    map:array[1..8,1..9]of boolean;
    cc:array[2..7]of char;
    c:array['A'..'Z']of longint;
//==============================================================
function gcd(a,b:longint):longint; inline;
var i:longint;
begin
  for i:=2 to 7 do
    if (a mod i=0)and(b mod i=0) then exit(i);
  gcd:=1;
end;
//==============================================================
procedure add(x,y:char); inline;
begin
  cnt:=c[x]*c[y];
  lt[cnt]:=c[x];rt[cnt]:=c[y];
  read(num[cnt]);
  inc(tot);
  opt[tot]:=cnt;place[cnt]:=tot;
end;
//==============================================================
function min(a,b:longint):longint; inline;
begin
  if a<b then exit(a) else exit(b);
end;
//==============================================================
procedure Ins(u,v,ca:longint);  inline;
begin
  inc(size);
  pre[size]:=en[u];en[u]:=size;
  g[size]:=v;capa[size]:=ca;
  inc(size);
  pre[size]:=en[v];en[v]:=size;
  g[size]:=u;capa[size]:=0;
end;
//==============================================================
procedure Fill(x,y,nx,ny,put:longint); inline;
begin
  if (lt[put]=sta[x,y])or(rt[put]=sta[nx,ny]) then
    begin
      pp[x*2-1,y*2-1]:=cc[lt[put]];
      pp[nx*2-1,ny*2-1]:=cc[rt[put]];
    end
  else
    begin
      pp[x*2-1,y*2-1]:=cc[rt[put]];
      pp[nx*2-1,ny*2-1]:=cc[lt[put]];
    end;
end;
//==============================================================
function dfs(x,flow:longint):longint;
var i,v,used,next,dfs2:longint;
begin
  if x=t then exit(flow);
  i:=en[x];dfs2:=0;
  while i>0 do
    begin
      v:=g[i];
      if (capa[i]>0)and(h[x]=h[v]+1) then
        begin
          next:=flow-dfs2;
          if capa[i]<next then next:=capa[i];
          used:=dfs(v,next);
          dec(capa[i],used);inc(capa[i xor 1],used);
          inc(dfs2,used);
          if flow=dfs2 then exit(flow);
        end;
      i:=pre[i];
    end;
  dec(vh[h[x]]);
  if vh[h[x]]=0 then h[s]:=t;
  inc(h[x]);
  inc(vh[h[x]]);
  exit(dfs2);
end;
//==============================================================
procedure SAP;
begin
  fillchar(h,sizeof(h),0);
  h[s]:=3;
  for i:=1 to 10 do h[i]:=2;
  for i:=11 to 20 do h[i]:=1;
  h[t]:=0;
  vh[0]:=1;vh[1]:=10;vh[2]:=10;vh[3]:=1;
  while h[s]<t do flow:=flow+dfs(s,maxlongint);
end;
//==============================================================
procedure Calc;
begin
  fillchar(need,sizeof(need),0);
  for i:=1 to 7 do
    for j:=1 to 8 do
      if lk[i,j]>0 then
        begin
          nx:=i+dx[lk[i,j]];ny:=j+dy[lk[i,j]];
          cnt:=sta[i,j]*sta[nx,ny];
          inc(need[cnt]);
        end;
  tot:=0;
  for i:=1 to 10 do tot:=(tot+need[opt[i]])*37 mod mo;
  if hash[tot] then exit;
  hash[tot]:=true;
  flow:=0;size:=1;
  for i:=1 to 10 do
    begin
      cnt:=opt[i];
      flow:=flow+min(need[cnt],num[cnt])*2;
    end;
  if flow>>1+28<=ans then exit;
  fillchar(en,sizeof(en),0);
  for i:=1 to 10 do
    begin
      cnt:=opt[i];
      if num[cnt]>need[cnt] then
        begin
          Ins(s,i,num[cnt]-need[cnt]);
          for j:=1 to 10 do
            if w[i,j]=1 then Ins(i,j+10,28);
        end;
      if need[cnt]>num[cnt] then Ins(i+10,t,need[cnt]-num[cnt]);
    end;
  SAP;
  if flow>ans then
    begin
      ans:=flow;
      pp:=res;
      for i:=1 to 7 do
        for j:=1 to 8 do
          if lk[i,j]>0 then
            begin
              nx:=i+dx[lk[i,j]];ny:=j+dy[lk[i,j]];
              cnt:=sta[i,j]*sta[nx,ny];
              if need[cnt]>num[cnt] then
                begin
                  z:=en[place[cnt]+10];put:=0;
                  while z>0 do
                    begin
                      if (g[z]<t)and(capa[z]>0) then
                        begin
                          put:=opt[g[z]];dec(capa[z]);break;
                        end;
                      z:=pre[z];
                    end;
                end
              else put:=cnt;
              if put=0 then
                begin
                  z:=en[s];
                  while z>0 do
                    begin
                      if capa[z]>0 then
                        begin
                          put:=opt[g[z]];dec(capa[z]);break;
                        end;
                      z:=pre[z];
                    end;
                end;
              Fill(i,j,nx,ny,put);
              dec(need[cnt]);
            end;
    end;
end;
//==============================================================
procedure Work(x,y:longint);
begin
  if y=9 then
    begin
      Work(x+1,1);exit;
    end;
  if (x=7)and(y=8) then
    begin
      Calc;exit;
    end;
  if map[x,y] then
    begin
      map[x,y]:=false;
      if map[x,y+1] then
        begin
          lk[x,y]:=2;
          res[x*2-1,y*2]:='-';map[x,y+1]:=false;
          Work(x,y+1);
          res[x*2-1,y*2]:='.';map[x,y+1]:=true;
        end;
      if map[x+1,y] then
        begin
          lk[x,y]:=1;
          res[x*2,y*2-1]:='|';map[x+1,y]:=false;
          Work(x,y+1);
          res[x*2,y*2-1]:='.';map[x+1,y]:=true;
        end;
      lk[x,y]:=0;
      map[x,y]:=true;
    end
  else Work(x,y+1);
end;
//==============================================================
procedure Init;
begin
  c['B']:=2;c['R']:=3;c['W']:=5;c['Y']:=7;
  cc[2]:='B';cc[3]:='R';cc[5]:='W';cc[7]:='Y';
  for i:=1 to 7 do
    begin
      for j:=1 to 8 do
        begin
          read(ch);
          map[i,j]:=true;
          sta[i,j]:=c[ch];
        end;
      readln;
    end;
  add('B','Y');add('B','W');add('B','R');add('B','B');
  add('R','Y');add('R','W');add('R','R');
  add('W','Y');add('W','W');
  add('Y','Y');
  for i:=1 to 10 do
    for j:=1 to 10 do
      if (i<>j)and(gcd(opt[i],opt[j])>1) then
        w[i,j]:=1;
  s:=21;t:=22;
  for i:=1 to 14 do
    for j:=1 to 15 do
      res[i,j]:='.';
end;
//==============================================================
procedure Print;
begin
  writeln(ans);
  for i:=1 to 13 do
    begin
      for j:=1 to 15 do
        write(pp[i,j]);
      writeln;
    end;
end;
//==============================================================
begin
  Init;ans:=-1;
  Work(1,1);
  Print;
end.


var n,i,j:longint;a,b,c,d,x,y: int64;f:boolean;
begin
 read(n );
 for j:=1 to n do
 begin
  read(a,b);
  if a-b>1 then writeln('NO') else if b<4 then writeln('YES') else
  begin
   a:=a+b;
   if not odd(a) then writeln('NO') else begin
       b:=trunc(sqrt(a))+2;
       x:=3;f:=true;
       while f and (x<b) do begin
          if a mod x=0 then f:=false else x:=x+2;
       end;
       if f then writeln('YES') else writeln('NO');
   end;
  end;
 end;

end.


const
  max=1000000007;

var
  ans,n,m,i,j,k:longint;
  f:array[0..500,0..500]of longint;
  e:array[0..500*500+2]of longint;

begin
  fillchar(f,sizeof(f),0);
  read(n,m);
  e[0]:=1;
  for i:=1 to n*n do e[i]:=(e[i-1] shl 1)mod max;
  f[0,0]:=1;
  for i:=0 to n-1 do
    for j:=0 to m-1 do if f[i,j]>0 then
      for k:=i+1 to n do
        f[k,j+1]:=(((int64(f[i,j])*(e[k-i]-1)mod max)*e[(k-i)*i]+f[k,j+1])mod max+max)mod max;

  ans:=0;
  for i:=0 to n do ans:=(int64(f[i,m])*e[(n-i)*i]+max+ans)mod max;
  writeln(ans);
end.


{$mode objfpc}
{$H+}
{$optimization level2}

procedure main;
var n, k, x, i, j: longint;
var infty, ans: Int64;
begin
        readln(n, k);
        x := k div n;
        if k mod n <> 0 then inc(x);
        writeln(x);
end;

begin
        main();
end.


program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  x,y:int64;
begin
  readln(x,y);
  if ((x>=0) and (y>=0)) then
    write(0,' ',x+y,' ',x+y,' ',0)
  else if (x<=0) and (y<=0) then
    write(x+y,' ',0,' ',0,' ',x+y)
  else if (x<=0) and (y>=0) then
    write(x-y,' ',0,' ',0,' ',y-x)
  else
    write(0,' ',y-x,' ',x-y,' ',0);
  readln;
  readln;
end.


program pro496A;
var kq,n:longint;
    a,b:array[1..100] of longint;
{-------------------------------}
procedure doc;
var i:longint;
begin
    read(n);
    for i:=1 to n do read(a[i]);
end;
{-------------------------------}
procedure ghi;
begin
    write(kq);
end;
{---------------------------------}
procedure xuli;
var tg,i,j:longint;
begin
    tg:=0;kq:=1001;
    for i:=2 to n-1 do
    begin
        for j:=1 to n-1 do
        if i<>j then
        begin
            if (j+1<>i) and (a[j+1]-a[j]>tg) then tg:=a[j+1]-a[j];
            if (j+1=i) and (a[j+2]-a[j]>tg) then tg:=a[j+2]-a[j] ;
        end;
        if tg<kq then kq:=tg;
        tg:=0;
    end;
end;
{----------------------------------}
begin
    doc;
    xuli;
    ghi;
end.


var i,n,k,n1,j,maxkey,key:int32;
	A,maxarr:array[1..1000] of Longint;
Begin
	Readln(n);
	For i:=1 to n do
		Begin
			key:=0;
			n1:=n;
			j:=i;
			While (n1>=j) do
				If (n1-j<>0) and (n1-j<j) then
					Begin
						inc(key);
						A[key]:=n1;
						n1:=0;
						break;
					End
				Else
				Begin
					dec(n1,j);
					inc(key);
					A[key]:=j;
					inc(j);
				End;
			If (n1=0) then if key>maxkey then
				Begin
					maxkey:=key;
					For k:=1 to key do maxarr[k]:=A[k];
				End;
		End;
	Writeln(maxkey);
	For k:=1 to maxkey do Write(maxarr[k],' ');
End.


program main;

{$APPTYPE CONSOLE}

uses
  SysUtils;

function IsNormalHostName(const hostName: string): string;
var
  i, j: integer;
  temp: string;
  a: set of char;
begin
  a:=['a'..'z']+['A'..'Z']+['0','1','2', '3','4','5','6','7','8','9', '_'];
  if (Pos('.', hostName) = 0) then
  begin
     for i := 1 to Length(hostName) do
     if not(hostName[i] in a) then
     begin
       Result:='NO';
       Exit;
     end;
  end;
  Result:='YES';
  if (hostName[Length(hostName)] = '.') then
  begin
    Result:='NO';
    Exit;
  end;
  temp:='';
  for i := 1 to Length(hostName) do
  begin
    if (hostName[i]<>'.') then
    begin
      temp:=temp+hostName[i];
    end
    else
    begin
      if (Length(temp)>16) or (Length(Temp) = 0) then
      begin
        Result:='NO';
        Exit;
      end;
      for j := 1 to Length(temp) do
      if not(temp[j] in a) then
      begin
        Result:='NO';
        Exit;
      end;
      temp:='';
    end;
  end;
end;
function IsNormal(const addr: string): string;
var
  i: integer;
  userName, hostName, resource, hostNameTemp: string;
  a: set of char;
begin
  Result:='YES';
  userName:='';
  hostName:='';
  hostNameTemp:='';
  resource:='';
  if (pos('@', addr) = 0) or (pos('@', addr)+1>Length(addr)) then
  begin
    Result:='NO';
    Exit;
  end;
  for i := 1 to Pos('@', addr)-1 do
  begin
    userName:=userName+addr[i];
  end;
  for i := Pos('@', addr)+1 to Length(addr) do
  begin
    hostName:=hostName+addr[i];
  end;
  a:=['a'..'z']+['A'..'Z']+['0','1','2', '3','4','5','6','7','8','9', '_'];
  if (Length(userName)>16) or (Length(userName) = 0) then
  begin
    Result:='NO';
    Exit;
  end;
  for i := 1 to Length(userName) do
  begin
    if not (userName[i] in a) then
    begin
      Result:='NO';
      break;
      Exit;
    end;
  end;
  if (pos('/', hostName)<>0) then
  begin
    for i := pos('/', hostName)+1 to Length(hostName) do
       resource:=resource+hostName[i];
    if (Length(resource)>16) or (Length(resource) = 0) then
    begin
      Result:='NO';
      Exit;
    end;
    for i := 1 to Length(resource) do
    begin
      if not(resource[i] in a) then
      begin
        Result:='NO';
        break;
        Exit;
      end;
    end;
    for i := 1 to pos('/', hostName)-1 do
      hostNameTemp:=hostNameTemp+hostName[i];
    if (Length(hostNameTemp) = 0) then
    begin
      Result:='NO';
      Exit;
    end;
    if IsNormalHostName(hostNameTemp) = 'NO' then Result:='NO';
  end
  else
  begin
     if IsNormalHostName(hostName) = 'NO' then Result:='NO';
  end;
end;

var
  str: string;
begin
  Readln(str);
  Writeln(IsNormal(str));
  { TODO -oUser -cConsole Main : Insert code here }
end.


var
  ch1,ch2:char;
  n,t:longint;
  a:array[' '..'v']of longint;
begin
  read(ch1,ch2,ch2);
  read(n);
  a['v']:=1;
  a['<']:=2;
  a['^']:=3;
  a['>']:=4;
  t:=a[ch2]-a[ch1];
  if t<0 then t:=t+4;
  if t>=4 then t:=t mod 4;
  if t=0 then
    begin
      writeln('undefined');
      halt;
    end;
  if t=n mod 4 then
    begin
      if t<>2 then writeln('cw')
      else writeln('undefined');
    end
  else if t+n mod 4=4 then writeln('ccw')
  else writeln('undefined');
end.


var
  h:array[1..2,'0'..'9'] of longint; s:string; ans,d,i:longint;

function have:boolean;
var i:char;
begin
  for i:='0' to '9' do if h[1,i]>h[2,i] then exit(false);
  have:=true;
end;

procedure modify;
var i:char;
begin
  for i:='0' to '9' do dec(h[2,i],h[1,i]);
end;

procedure f(nom:longint;c:char);
begin
  if (c='2') or (c='5') then inc(h[nom,'2']) else
  if (c='6') or (c='9') then inc(h[nom,'6']) else
  inc(h[nom,c]);
end;

begin

  readln(s); d:=length(s); for i:=1 to d do f(1,s[i]);
  readln(s); d:=length(s); for i:=1 to d do f(2,s[i]);
  while have do
  begin
    modify; inc(ans);
  end;
  writeln(ans);

end.


var s,a,b:ansistring;   d,i:longint;
begin
    read(s);    i:=1;
    while s[i]<>'.' do inc(i);  a:=copy(s,1,i-1);   delete(s,1,i);  i:=1;
    while s[i]<>'e' do inc(i);  b:=copy(s,1,i-1);   delete(s,1,i);
    val(s,d);   if d=0 then begin if length(b)>0 then while b[length(b)]='0' do
     begin delete(b,length(b),1); if length(b)=0 then break; end;
     if b='' then writeln(a) else writeln(a,'.',b); halt; end;
    for i:=1 to d do
        if length(b)>0 then begin a:=a+b[1]; delete(b,1,1); end
        else a:=a+'0';
    if length(b)=0 then writeln(a) else writeln(a,'.',b);
end.


{$R+ Q+ I+}
{$APPTYPE CONSOLE}
uses
  SysUtils;
procedure swap(var x,y : integer);
var
   t : integer;
begin
   t := x;
   x := y;
   y := t;
end;
var
   a : array[1..12] of integer;
   i,j,k : integer;
   t : boolean;
begin
     read(k);
     t := false;
     for i := 1 to 12 do read(a[i]);
     for i := 1 to 11 do
         for j := i + 1 to 12 do
             if a[i] < a[j] then swap(a[i],a[j]);
     i := 0;
     while k > 0 do begin
           inc(i);
           if i > 12 then  begin
              t := true;
              break;
           end;
           k := k - a[i];
     end;
     if t = true then write('-1')
     else
     write(i);
end.


Program z70a;
var n,i:longint;
	sum:int64;
begin
	read(n);
    sum:=1;
    for i:=1 to n-1 do
    	sum:=(sum*3) mod 1000003;
    write(sum);
end.


//HardCor
var i,j,n,m,p,t,f,x:longint; a:array[1..100000] of longint; s:string; begin read(p); for i:=1 to p-1 do begin x:=1;f:=0;j:=1; while j<p-1 do begin x:=(x*i) mod p; if x mod p=1 then begin f:=1; break; end; inc(j); end; if f=0 then inc(t); end; writeln(t); end.


var i, x, z:longint;
begin
    read(x);
    z := 1;
    for i :=2 to x - 1 do
        if (x mod i = 0) then begin write(i, x div i); break; end;
end.


var
k,n,i:integer;
s,w:longint;
a,b,c:array [1..101] of integer;

procedure sort(l,r:integer);
var i,j,x,y:integer;
 begin
 i:=l;j:=r;x:=a[(l+r) div 2];
 repeat
  while a[i]>x do inc(i);
  while a[j]<x do dec(j);
   if i<=j then
    begin
         y:=a[i];
         a[i]:=a[j];
         a[j]:=y;
         y:=b[i];
         b[i]:=b[j];
         b[j]:=y;
         y:=c[i];
         c[i]:=c[j];
         c[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;

procedure sort1(l,r:integer);
var i,j,x,y:integer;
 begin
 i:=l;j:=r;x:=c[(l+r) div 2];
 repeat
  while c[i]<x do inc(i);
  while c[j]>x do dec(j);
   if i<=j then
    begin
         y:=a[i];
         a[i]:=a[j];
         a[j]:=y;
         y:=b[i];
         b[i]:=b[j];
         b[j]:=y;
         y:=c[i];
         c[i]:=c[j];
         c[j]:=y;
         inc(i);
         dec(j);
     end;
  until i>j;
 if l<j then sort1(l,j);
 if i<r then sort1(i,r);
 end;

begin
read(n,w);
for i:=1 to n do begin read(a[i]);c[i]:=i;b[i]:=(a[i]+1) div 2;s:=s+b[i];end;

if s=w then begin for i:=1 to n do write(b[i],' ');exit;end;

if s>w then begin write('-1');exit;end;

sort(1,n);

  for i:=1 to n do
   if s+(a[i]-b[i])<=w then
    begin s:=s+(a[i]-b[i]);b[i]:=a[i];k:=i;end else begin b[i]:=b[i]+w-s;s:=w;end;

 if w>s then begin write('-1');exit;end;

sort1(1,n);

for i:=1 to n do write(b[i],' ');
end.


uses math;

const
        maxc=1000000000+69;
        maxn=80;
        fi='';
        fo='';

var
        s:string;
        n:longint;
        a:array[0..maxn] of longint;
        c:array[0..2] of longint;
        cnt:array[0..maxn,0..2] of longint;
        vt:array[0..2,0..maxn] of longint;
        f:array[0..maxn,0..maxn,0..maxn,0..2] of longint;

procedure nhap;
begin
        assign(input,fi);
        reset(input);
        readln(input,n);
        readln(input,s);
        close(input);
      //  assign(output,fo);
       // rewrite(output);
end;

procedure khoitao;
var
        i,v,k,x,cntv,cntk,cntx:longint;
begin

        for i:=1 to n do
        begin
                if s[i]='V' then
                begin
                        a[i]:=1;
                        inc(c[1]);
                        vt[1,c[1]]:=i;
                end
                else
                if s[i]='K' then
                begin
                        a[i]:=2;
                        inc(c[2]);
                        vt[2,c[2]]:=i;
                end
                else
                begin
                        inc(c[0]);
                        vt[0,c[0]]:=i;
                end;
                cnt[i]:=cnt[i-1];
                inc(cnt[i,a[i]])
        end;
end;

function cal(x,y,z,t:longint):longint;
var
        res:longint;
begin
        if (x>c[0]) or (y>c[1]) or (z>c[2]) then exit(maxc);
        if x+y+z=n then exit(0);
        if f[x,y,z,t]>-1 then exit(f[x,y,z,t]);
        res:=cal(x+1,y,z,0)+max(0,cnt[vt[0,x+1],1]-y)+max(0,cnt[vt[0,x+1],2]-z);
        res:=min(res,cal(x,y+1,z,1)+max(0,cnt[vt[1,y+1],0]-x)+max(0,cnt[vt[1,y+1],2]-z));
        if t<>1 then
        res:=min(res,cal(x,y,z+1,0)+max(0,cnt[vt[2,z+1],0]-x)+max(0,cnt[vt[2,z+1],1]-y));
        f[x,y,z,t]:=res;
        exit(res);
end;

procedure xuli;
begin
        assign(output,fo);
        rewrite(output);
        fillchar(f,sizeof(f),255);
        writeln(output,cal(0,0,0,0));
        close(output);
end;

begin
        nhap;
        khoitao;
        xuli;
end.


Program QQ;
Var a,b,c,i,k,j:LongInt;
    f,ff:text;
    fl:boolean;
begin

{  Assign(f,'input.txt');
  ReSet(f);
  Assign(ff,'output.txt');
  ReWrite(ff);

  Writeln;}

  Readln(a,b);

{  Writeln;}

{  a:=3;
  b:=10;}

  k:=1;

  If ((b<>10) and (a>=1)) or ((b=10) and (a>=2))
  then begin

  If b<>10 then begin
        Write(b);
     For I:=1 to a-1 do
         Write('0');
         end
         else begin
        Write(b);
     For I:=1 to a-2 do
         Write('0');

              end;
        end
  else begin
         Write('-1');

       end;

{  Case b of
  2:begin
       Write('2');
     For I:=1 to a-1 do
      Write('0');
    end;

  3:begin
       Write('3');
     For I:=1 to a-1 do
      Write('0');
    end;

  4:begin
       Write('4');
     For I:=1 to a-1 do
      Write('0');
    end;
  5:begin
       Write('5');
     For I:=1 to a-1 do
      Write('0');
    end;
  6:begin
       Write('6');
     For I:=1 to a-1 do
      Write('0');
    end;

  :begin
       Write('6');
     For I:=1 to a-1 do
      Write('0');
    end;}

 (* For i:=1 to a do
  k:=k*10;
  k:=k div 10;
  fl:=true;

  For I:=k to 10*k-1 do
  begin

    If (I mod b)=0
     then begin

             Write({ff,}i);
{             Close(f);
             Close(ff);}
             Exit;

          end;

  end; *)

  If fl=true
   then Write({ff,}'-1');

  Readln;

End.


var s: string;
    i,j,a,b,t: longint;
begin
//assign (input,'input.txt'); reset (input);
//assign (output,'output.txt'); rewrite (output);
for i:= 1 to 8 do
begin
readln (s);
t:= 0;
for j:= 1 to 8 do
if s[j]='B' then inc (t);

if t=8 then inc (a)
else if t>b then b:= t;
end;
write (a+b);
end.


program yan;
  var a,b,c,x,y,j:int64;
  function min(a,b:int64):int64;
    begin
      if a<b then exit(a) else exit(b);
    end;
begin
  read(a,b,c);
  j:=min(a,2*(b+c));
  x:=min(b,2*(a+c));
  y:=min(c,2*(b+a));
  write((j+x+y) div 3);
end.


program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
r1,r2,c1,c2,d2,d1,x1,x2,x3,x4:Byte;
bol:Boolean;
begin
Readln(r1,r2);
Readln(c1,c2);
Readln(d1,d2);

bol:=false;
for x1:=1 to 9 do
for x2:=1 to 9 do
for x3:=1 to 9 do
for x4:=1 to 9 do
if x1+x2=r1 then
if x3+x4=r2 then
if x1+x3=c1 then
if x2+x4=c2 then
if x1+x4=d1 then
if x2+x3=d2 then
if (x1<>x2) and (x1<>x3) and (x1<>x4) and (x2<>x3) and (x2<>x4) and (x3<>x4) then
begin
Writeln(x1,' ',x2);
Writeln(x3,' ',x4);
bol:=true;
end;
if not bol then Writeln('-1');
read(x2);
end.


var n :int64;

begin
read (n);
if n mod 2 = 0 then write ('Mahmoud') else write ('Ehab');

end.