program flying;
const fi='';
      fo='';
var n,m:int64;
{------------------------}
function power(a,b:int64):int64;
var t:int64;
begin
  if b=0 then exit(1);
  if b=1 then exit(a mod m);
  t:=power(a,b div 2);
  if b mod 2= 0 then exit(t*t mod m);
  exit(((t*t mod m)*a)mod m);
end;
{------------------------}
procedure nhap;
begin
  assign(input,fi);reset(input);
  assign(output,fo);rewrite(output);
  readln(n,m);
  if power(3,n)=0 then write(m-1)
  else write(power(3,n)-1);
  close(input);
  close(output);
end;
{------------------------}
begin
  nhap;
end.


program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  w, h, i, j: integer;
  res: int64;
begin
  readln(w, h);
  res := 0;
  for i := 1 to w - 1 do
    for j := 1 to h - 1 do
      res := res + int64(min(i, w - i) *  min(j, h - j));
  writeln(res);
  readln;
end.


var s,a: string;
pr, i, res: integer;
begin
readln (s);
a:= ' ';
s:=s+a;
pr:=0;
res:=0;
for i:=1 to length(s) do
begin
inc(pr);
if (s[i] = 'A') or (s[i] = 'E') or (s[i] = 'I') or (s[i] = 'O') or (s[i] = 'U') or (s[i] = 'Y') or (s[i] = ' ') then
begin
if res<pr then res:=pr;
pr:=0
end;
end;
if res=0 then res:=length(s);
writeln (res);
end.


uses math;
var n,pos,l,r,res,d1,d2,mdist:byte;
BEGIN
   readln(n,pos,l,r);
   mdist:=255;
   if l<>1 then begin
      d1:=abs(pos-l);
      mdist:=d1;
   end;
   if r<>n then begin
     d2:=abs(pos-r);
     mdist:=min(mdist,d2);
   end;
   if mdist <> 255 then inc(res,mdist+1);
   if (l<>1) and (r<>n) then inc(res,r-l+1);
   write(res);
END.


var n,k,i,du :byte;
    d:real;
    a:array[1..100] of byte;
begin
 read(n,k);
 if n mod k =0 then for i:=1 to k do write(n div k,' ');
 if n mod k<>0 then
     begin
      for i:=1 to k do
       a[i]:=n div k;
      du:= n mod k;
     for i:=k downto k-du+1 do inc(a[i]);
     for i:=1 to k do write(a[i],' ');
     end;
  readln;
 readln
end.


   const nn=1600000; nnn=1200000;eps=0.00000000001;
   besk=80000000000000;
   label 1,2,3;
    var    step, i,j:longint;
    k,pp,jj,ii,p3,p4, p1,p2,t1,t2,p,ost,q,n,ot,t,kk:int64;
     pal:array[-20..6000,-20..6000] of boolean;
     ppp:extended;
     xx:array[-10..200000,0..6] of int64;
      dd,zz,z,c,d,x,y,a,b:array[-1002..2000000] of int64;
      ddnew,ddold:array[0..200,0..4040] of integer;
     per,dda,ddb:array[-10..120,-10..120] of int64;
        ss:string;
            ch:char;
           flagg,flag,flag1:boolean;

  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 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 good(p:int64):boolean;
var t,t1,t2:int64; flag:boolean;  k,i,j:longint;
begin
   flag:=true;
   for i:=1 to n do for j:=i+1 to n do
     begin
        t:=0;
        for k:=1 to 5 do t:=t+(xx[i,k]-xx[p,k])*(xx[j,k]-xx[p,k]);

        if t>0 then flag:=false;

     end;

   good:=flag;

end;

begin
   {    assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
    }
      read(n);
      for i:=1 to n do for j:=1 to 5 do read(xx[i,j]);
      if n>=100 then begin write(0); goto 1; end;

      {for i:=1 to n do write(good(i),' ');
       }

       for i:=1 to n do if good(i) then begin inc(ot); a[ot]:=i; end;

       writeln(ot);
       for i:=1 to ot do write(a[i],' ');

   1:          close(output);
end.


program TaskA;
var
    k,i,x:int64;
begin
    read(x);
    i:=0; k:=0;
    while i+k<x do begin k:=k+i; i:=i+1; end;
    write(x-k);
end.


Program abc;
Var k,c:integer;
s:string;
a:array of integer;
Begin
Read(S);
k:=length(s);
a:=new integer[k]; c:=0;
For var x:=1 to K do
 begin
 If (s[x]>='0') and (s[x]<='9') then begin a[c]:=strtoint(s[x]); c:=c+1; end;
 end;
System.Array.Sort(a);
For var x:=0 to a.Length-1 do
 begin
 if a[x]<>0 then
  begin
  if x<>a.Length-1 then write(a[x],'+')
  Else write(a[x]);
  end;
 end;
end.


Program ILoveYou;
VAR n,nr,putere,d:int64;
Begin

Readln(n);
nr:=1;
putere:=4;
while (nr <= n) do
Begin

if (n mod nr = 0) then d:=nr;
nr:=nr*2 + putere;
putere:=putere*4;

end;

Writeln(d);

Readln;
END.


const
    maxn=2005;
    maxm=maxn*maxn;
var
    //key 0=arbitrarily,1=order,2=bidirection
    //dir 0=null,1=left,2=right
    n,tail,pp,root,i,j,times:longint;
    map:array[0..maxn,0..maxn]of char;
    key,tot,st,en,fx,size,s,tmp:array[0..maxn*3]of longint;
    rev:array[0..maxn*3]of boolean;
    que:array[0..maxn]of longint;
    adj:array[0..maxm]of longint;
    next:array[0..maxm,0..1]of longint;
        c:ansistring;
procedure ins(x,y:longint);
begin
        inc(tail); adj[tail]:=y; inc(tot[x]);
    if st[x]=0 then begin
        next[tail,0]:=0; next[tail,1]:=0; st[x]:=tail; en[x]:=tail; fx[x]:=1;
    end else begin
        next[tail,0]:=en[x]; next[tail,1]:=0; next[en[x],1]:=tail; en[x]:=tail;
    end;
end;
procedure prep;
var
    i:longint;
begin
    pp:=n+1; root:=n+1;
    for i:=1 to n do ins(root,i);
end;
procedure renew(x:longint);
var
    i:longint;
begin
    if x<=n then begin
                inc(times);
        size[x]:=1; if c[x]='1' then s[x]:=1 else s[x]:=0;
        exit;
    end;
    size[x]:=0; s[x]:=0; i:=st[x];
    while i<>0 do begin
        renew(adj[i]); size[x]:=size[x]+size[adj[i]]; s[x]:=s[x]+s[adj[i]];
        i:=next[i,fx[x]];
    end;
end;
procedure swap(var x,y:longint);
var
    t:longint;
begin
    t:=x;x:=y;y:=t;
end;
procedure reverse(x:longint);
begin
    swap(st[x],en[x]); fx[x]:=fx[x] xor 1;
end;
procedure pass(x:longint);
var
    i:longint;
begin
    if rev[x] then begin
        reverse(x);
        i:=st[x];
        while i<>0 do begin
            rev[adj[i]]:=not rev[adj[i]];
            i:=next[i,fx[x]];
        end;
        rev[x]:=false;
    end;
end;
procedure fail;
begin
    writeln('NO');
    close(input);close(output);
    halt;
end;
procedure change(x:longint);
begin
    if key[x]<>2 then fail;
    key[x]:=1; rev[x]:=not rev[x]; pass(x);
end;
function solve(x,dir:longint):longint;
var
    i,j,k,p,q,newp,cnt,total:longint;
        all,res,emp,tmp:array[0..maxn*3]of longint;
    flag:boolean;
begin
        pass(x);
    if x<=n then exit(x);
    if key[x]=0 then begin
        all[0]:=0; emp[0]:=0; res[0]:=0; tmp[0]:=0;
        i:=st[x];
        while i<>0 do begin
            if size[adj[i]]=s[adj[i]] then begin inc(all[0]); all[all[0]]:=adj[i]; end else
            if s[adj[i]]=0 then begin inc(emp[0]); emp[emp[0]]:=adj[i]; end else
            begin inc(res[0]); res[res[0]]:=adj[i]; end;
            i:=next[i,fx[x]];
        end;
        if res[0]>2 then fail;
        if not ((dir=0)or(res[0]<2)) then fail;
        if (dir=0)and(all[0]=0)and(res[0]=1) then begin
            i:=st[x];
            while i<>0 do begin
                if adj[i]=res[1] then begin
                    adj[i]:=solve(res[1],0); exit(x);
                end;
                i:=next[i,fx[x]];
            end;
        end;
        //all
        if all[0]=0 then j:=0 else
        if (all[0]=1) then j:=all[1] else begin
            inc(pp); j:=pp; key[j]:=0;
            for k:=1 to all[0] do ins(j,all[k]);
        end;
        //merge res,all
        if (dir<>1)and(res[0]>0) then begin
            inc(tmp[0]);
                        tmp[tmp[0]]:=solve(res[1],2);
        end;
        if (j>0) then begin inc(tmp[0]); tmp[tmp[0]]:=j; end;
                if (dir<>2)and((dir=0)and(res[0]>=2)or(dir<>0)and(res[0]>=1)) then begin
            inc(tmp[0]); tmp[tmp[0]]:=solve(res[res[0]],1);
        end;
        //use p
        if tmp[0]=1 then p:=tmp[1] else begin
            inc(pp); p:=pp; key[p]:=2;
            for k:=1 to tmp[0] do ins(p,tmp[k]);
        end;
        //use q
        if emp[0]=0 then q:=p else begin
            inc(pp); q:=pp;
            if dir=0 then begin
                key[q]:=0;
                for k:=1 to emp[0] do ins(q,emp[k]);
                ins(q,p);
            end else begin
                if emp[0]=1 then newp:=emp[1] else begin
                    inc(pp); newp:=pp; key[newp]:=0;
                    for k:=1 to emp[0] do ins(newp,emp[k]);
                end;
                key[q]:=1;
                if dir=1 then begin ins(q,p); ins(q,newp); end
                else begin ins(q,newp); ins(q,p); end;
            end;
        end;
                exit(q);
    end else begin
        j:=adj[st[x]]; k:=adj[en[x]];
                if ((dir=1) and not((size[j]=s[j]) or ((s[j]<>0) and (size[k]<>s[k]))))then change(x);
                if ((dir=2) and not((size[k]=s[k]) or ((s[k]<>0) and (size[j]<>s[j]))))then change(x);
                i:=st[x]; j:=-1; flag:=false; cnt:=0; total:=0; k:=0;
        while i<>0 do begin
            if size[adj[i]]=s[adj[i]] then k:=2 else
                        if s[adj[i]]=0 then k:=0 else k:=1;
            if j<>-1 then begin
                if (k>j)and(dir=1) then fail;
                if (k<j)and(dir=2) then fail;
                if (k=0)and(j>0) then flag:=true;
                if (flag)and(k>0)and(j=0) then fail;
            end;
            j:=k;
            if k=1 then inc(cnt);
            if k>0 then inc(total);
            i:=next[i,fx[x]];
                end;
        if (dir=0)and(cnt>2)or(dir<>0)and(cnt>1) then fail;
        cnt:=0; i:=st[x];
        while i<>0 do begin
            j:=s[adj[i]];
            if (j>0)and(j<size[adj[i]]) then begin
                if dir=1 then adj[i]:=solve(adj[i],1) else
                if dir=2 then adj[i]:=solve(adj[i],2) else
                if total=1 then adj[i]:=solve(adj[i],0) else begin
                    if cnt=0 then adj[i]:=solve(adj[i],2) else adj[i]:=solve(adj[i],1);
                end;
            end;
            if j>0 then inc(cnt);
            i:=next[i,fx[x]];
        end;
        exit(x);
    end;
end;
procedure dfs(x:longint);
var
    i:longint;
begin
    pass(x);
    if x<=n then begin inc(que[0]); que[que[0]]:=x; end;
    i:=st[x];
    while i<>0 do begin
        dfs(adj[i]);
        i:=next[i,fx[x]];
    end;
end;
begin
        readln(n);
        fillchar(st,sizeof(st),0); fillchar(en,sizeof(en),0);
        fillchar(tot,sizeof(tot),0); fillchar(rev,sizeof(rev),false);
                prep;
        for i:=1 to n do begin
                        readln(c); times:=0;
            for j:=1 to n do map[i][j]:=c[j];
                        renew(root);
                        if s[root]=0 then continue;
            root:=solve(root,0);
        end;
        que[0]:=0; dfs(root);
                if que[0]<n then writeln('NO') else
        writeln('YES');
        for i:=1 to n do begin
            for j:=1 to n-1 do write(map[i][que[j]]);
            writeln(map[i][que[n]]);
        end;
end.


var a:integer;
begin
readln(a);
If a mod 2 = 0
 then writeln ('home')
 else writeln('contest');
end.


program z_2;
var  a,b, c: integer;
begin

readln(a,b);
if (a=1)  and(b=2) and (a<>b) then c:=3
                 else begin
                 if (a=1)and(b=3) and (a<>b) then c:=2
                 else begin
                 if (a=2)and(b=1)  and (a<>b) then c:=3
                 else begin
                 if (a=2)and(b=3) and (a<>b) then c:=1
                 else begin
                 if (a=3)and(b=1)and (a<>b) then c:=2
                 else begin
                 if (a=3)and(b=2)and (a<>b) then c:=1
                 end;
                 end;end;end;end;
                 writeln(c);
                 end.


var
    x,s,i,a,b,t:longint;
begin
    read(a,b);
    if a>b then
    begin
        t:=a; a:=b; b:=t;
    end;
    x:=abs(a+b) div 2;
    s:=0;
    for i:=a to x-1 do s:=s+i-a+1;
    for i:=b downto x+1 do s:=s+b-i+1;
    writeln(s);
end.


const
    size: longint = 8;
    md: int64 = 1000 * 1000 * 1000 + 7;

type
    vector = record
        vect: array[1..20] of int64;
    end;
    matrix = record
        matr: array[1..20, 1..20] of int64;
    end;

var
    l, r, ans: int64;
    a: matrix;
    x: vector;

function create_vector: vector;
var i: longint; v: vector;
begin
    for i := 1 to size do
    v.vect[i] := 0;
    create_vector := v;
end;

function create_matrix: matrix;
var i, j: longint; z: matrix;
begin
    for i := 1 to size do
        for j := 1 to size do
            z.matr[i, j] := 0;
    create_matrix := z;
end;

function create_eye_matrix: matrix;
var i, j: longint; e: matrix;
begin
    for i := 1 to size do
        for j := 1 to size do
            if i = j then
                e.matr[i, j] := 1
            else
                e.matr[i, j] := 0;
    create_eye_matrix := e;
end;

function matrix_matrix_product(a, b: matrix): matrix;
var i, j, k: longint; c: matrix;
begin
    c := create_matrix;
    for i := 1 to size do
        for j := 1 to size do
            for k := 1 to size do
                c.matr[i, j] := (c.matr[i, j] + a.matr[i, k] * b.matr[k, j]) mod md;
    matrix_matrix_product := c;
end;

function matrix_sum(a, b: matrix): matrix;
var i, j: longint; c: matrix;
begin
    c := create_matrix;
    for i := 1 to size do
        for j := 1 to size do
            c.matr[i, j] := (a.matr[i, j] + b.matr[i, j]) mod md;
    matrix_sum := c;
end;

function matrix_vector_product(a: matrix; x: vector): vector;
var i, j: longint; b: vector;
begin
    b := create_vector;
    for i := 1 to size do
        for j := 1 to size do
            b.vect[i] := (b.vect[i] + a.matr[i, j] * x.vect[j]) mod md;
    matrix_vector_product := b;
end;

function matrix_pow(a: matrix; p: int64): matrix;
var b: matrix;
begin
    if p = 0 then begin
        matrix_pow := create_eye_matrix;
        exit;
    end;
    if p mod 2 = 0 then begin
        b := matrix_pow(a, p div 2);
        matrix_pow := matrix_matrix_product(b, b);
    end else
        matrix_pow := matrix_matrix_product(a, matrix_pow(a, p - 1));
end;

function sum_of_vector_components(v: vector): int64;
var i: longint; s: int64;
begin
    s := 0;
    for i := 1 to size do s := (s + v.vect[i]) mod md;
    sum_of_vector_components := s;
end;

function pow(a, p: int64): int64;
var b: int64;
begin
    if p = 0 then begin
        pow := 1;
        exit;
    end;
    if p mod 2 = 0 then begin
        b := pow(a, p div 2);
        pow := (b * b) mod md;
    end else
        pow := (a * pow(a, p - 1)) mod md;
end;

function inverse(a: int64): int64;
begin
    inverse := pow(a, md - 2);
end;

function get_matrix_product(n: int64): matrix; // (E + A) * (E + A^2) * ... * (E + A^b)
var i: longint; m: matrix;
begin
    m := create_eye_matrix;
    i := 1;
    while i <= n do begin
        m := matrix_matrix_product(m, matrix_sum(create_eye_matrix, matrix_pow(a, i)));
        i := i * 2;
    end;
    get_matrix_product := m;
end;

function get_matrix_sum(n: int64): matrix; // E + A + A^2 + ... + A^n
var a1, a2, m1, m2: matrix; b: int64;
begin
    if n = 0 then begin
        get_matrix_sum := create_eye_matrix;
        exit;
    end;
    if n = 1 then begin
        get_matrix_sum := matrix_sum(create_eye_matrix, a);
        exit;
    end;
    b := 1;
    while 2 * b - 1 <= n do b := b * 2;
    b := b div 2;
    a1 := get_matrix_product(b);
    a2 := create_matrix;
    if n > 2 * b - 1 then begin
        m1 := matrix_pow(a, 2 * b);
        m2 := get_matrix_sum(n - 2 * b);
        a2 := matrix_matrix_product(m1, m2);
    end;
    get_matrix_sum := matrix_sum(a1, a2);
end;

function get_full(l, r: int64): int64;
var m, m1, m2: matrix; v: vector;
begin
    m1 := matrix_pow(a, l - 2);
    m2 := get_matrix_sum(r - l);
    m := matrix_matrix_product(m1, m2);
    v := matrix_vector_product(m, x);
    get_full := (sum_of_vector_components(v) * inverse(2)) mod md;
end;

function get_palind(l, r: int64): int64;
begin
    if l mod 2 = 0 then inc(l);
    if r mod 2 = 0 then dec(r);
    if l > r then
        get_palind := 0
    else begin
        l := (l + 1) div 2;
        r := (r + 1) div 2;
        get_palind := get_full(l, r);
    end;
end;

function get_answer(l, r: int64): int64;
var a, b: int64;
begin
    a := get_full(l, r);
    b := get_palind(l, r);
    get_answer := (a + b) mod md;
end;

procedure init_dp;
var i: longint;
begin
    x := create_vector;
    for i := 1 to size do x.vect[i] := 1;
    a := create_matrix;
    a.matr[1, 3] := 1; a.matr[1, 7] := 1;
    a.matr[2, 3] := 1; a.matr[2, 7] := 1;
    a.matr[3, 1] := 1;
    a.matr[4, 5] := 1;
    a.matr[5, 4] := 1; a.matr[5, 8] := 1;
    a.matr[6, 4] := 1; a.matr[6, 8] := 1;
    a.matr[7, 2] := 1; a.matr[7, 6] := 1;
    a.matr[8, 2] := 1; a.matr[8, 6] := 1;
end;

begin
    read(l, r);
    ans := 0;
    if (l = 1) and (r = 1) then begin
        writeln(4);
        halt;
    end;
    if (l = 1) then begin
        ans := 4;
        l := 2;
    end;
    init_dp;
    ans := (ans + get_answer(l, r)) mod md;
    writeln(ans);
end.


var
  st:ansistring;
  i,ak:longint;
begin
  readln(st);
  st:=lowercase(st);
  ak:=0;
  for i:=1 to length(st) do
   if st[i] in ['a','e','i','o','u','y'] then ak:=ak+1
                                         else write('.',st[i]);
  if ak>=maxlongint then writeln('我好强啊！I AK IOI！（此句划去')
end.


var a:array[1..5] of int64;
    n:longint;
    i:longint;
begin
    n:=0;
    for i:=1 to 5 do
    begin
        read(a[i]);
        n:=n+a[i];
    end;
    if (n mod 5=0) and (n<>0) then
        write(n div 5)
    else
        write('-1');
end.


program factory_lights;
var a,b:array [1..100] of integer;
n,m,i,j:integer ;
begin
  read(n,m);
  for i:=1 to m do
  read (a[i]);                       //input

       for i:=1 to m do
       for j:=a[i] to n do
       if  b[j]=0 then  b[j]:=a[i];  //calculations

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


var b,w: longint;
c: array[0..9,0..9] of char;
procedure Getdata;
  var i,j: longint;
  begin
    for i:=1 to 8 do
      begin
        for j:=1 to 8 do
          begin

            read(c[i][j]);
          end;
        readln;
      end;
  end;
function Min(a,b: longint): longint;
  begin
    if a<b then exit(a) else exit(b);
  end;
procedure Process;
  var i,j,z: longint;
                 kt: boolean;
  begin
  getdata;
  b:=maxlongint; w:=b;
    for i:=1 to 8 do
      for j:=1 to 8 do
        begin
          if c[i][j]='B' then
            begin
            kt:=true;
              for z:=i to 8 do if c[z][j]='W' then begin kt:=false; break; end;
             if kt=true then B:=min(b,8-i);
            end
          else
            if c[i][j]='W' then
              begin
              kt:=true;
                for z:=i downto 1 do if c[z][j]='B' then begin kt:=false; break; end;
              if kt=true then  W:=min(w,i-1);
              end;
        end;
    //  writeln(b,' ',w);
      if B<W then write('B') else write('A');
  end;
begin

process;
end.


uses math;

const need_reconstruct = false;

var ntest: longint;
var n, m, k: longint;
var min_hor: longint;
var max_hor: longint;
var rest: longint;

function check_sol: boolean;
begin
    if n mod 2 = 1 then begin
        min_hor := m div 2;
    end else begin
        min_hor := 0;
    end;

    if m mod 2 = 1 then begin
        max_hor := n * m div 2 - n div 2;
    end else begin
        max_hor := n * m div 2;
    end;
    if (k < min_hor) or (k > max_hor) then exit(false);
    rest := k - min_hor;
    if rest mod 2 = 1 then exit(false);
    exit(true);
end;

procedure do_reconstruct;
begin
    if not need_reconstruct then exit();
end;

begin
    read(ntest);
    while ntest > 0 do begin
        dec(ntest);
        read(n, m, k);

        if not check_sol then begin
            writeln('NO');
            continue;
        end;
        writeln('YES');
        do_reconstruct;
    end;
end.


program ex_1;
var i,j,k,l:longint;
    s1,s2,s3:string;
    ff:boolean;
begin
  ff:=false;
  readln(s1);
  readln(s2);
  readln(s3);
  {if s1[1]=s3[1] then
    if s1[2]=s3[2] then
      if s1[3]=s3[3] then
          ff:=true;

  if s1[1]=s1[3] then
    if s2[1]=s2[3] then
      if s3[1]=s3[3] then
          ff:=true;

  if s1[1]=s3[3] then
    if s1[2]=s3[2] then
      if s2[1]=s2[3] then
        begin
          ff:=true;
           writeln('-1');
        end;  }

  if s3[3]=s1[1] then
  if s3[1]=s1[3] then
    if s1[2]=s3[2] then
      if s2[1]=s2[3] then
          ff:=true;

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

end.


var
	n,i:longint;
	ans,sum:int64;
begin
	readln(n);
	ans:=1;sum:=1;
	for i:=2 to n do ans:=ans*i mod 1000000007;
	for i:=1 to n-1 do sum:=sum*2 mod 1000000007;
	ans:=((ans-sum)mod 1000000007+1000000007)mod 1000000007;
	writeln(ans);
end.


{$APPTYPE CONSOLE}

var
 s: string;
 i: integer;

function qwe(x: char): boolean;
begin
 result:=(x<='z')and(x>='a')
end;

begin
 readln(s);
 for i:=2 to length(s) do
 begin
  if qwe(s[i]) then
  begin
   writeln(s);
   readln;
   halt(0);
  end;
 end;
 if qwe(s[1]) then
 write(chr(ord(s[1]) + ord('A') - ord('a'))) else
 write(chr(ord(s[1]) + ord('a') - ord('A')));
 for i:=2 to length(s) do
 write(chr(ord(s[i]) + ord('a') - ord('A')));
 readln;
end.


var
 i,j,n,m,k,t,x:longint;
 c:char;
 s:ansistring;

function check(s:ansistring):boolean;
var
 i,n:longint;
begin
 n:=length(s);
 for i:=1 to n shr 1 do if s[i]<>s[n-i+1] then exit(false);
 exit(true);
end;

begin
 readln(s);
 n:=length(s);
 for c:='a' to 'z' do if check(c+s)then begin writeln(c,s);halt;end;
 for i:=1 to n-1 do for c:='a' to 'z' do if check(copy(s,1,i)+c+copy(s,i+1,n-i))then
 begin writeln(copy(s,1,i)+c+copy(s,i+1,n-i));halt;end;
 for c:='a' to 'z' do if check(s+c)then begin writeln(s,c);halt;end;
 writeln('NA');
end.


var a,b:array[0..10000] of longint;
    i,j,t,n,m:longint;
begin
//assign(input,'a.inp');reset(input);
//assign(output,'a.out');rewritE(output);
readln(n,m);
for i:=1 to n do
   begin
       read(a[i]);
   end;
for i:=1 to m do
    read(b[i]);
for i:=1 to m do
    for j:=i+1 to m do
        if b[i]<b[j] then
            begin
               t:=b[i];
               b[i]:=b[j];
               b[j]:=t;
            end;
j:=1;
for i:=1 to n do
    begin
        if a[i]=0 then
            begin
                a[i]:=b[j];
                inc(j);
            end;
    end;
    a[n+1]:=maxlongint;
for i:=2 to n+1 do
        if a[i]<a[i-1] then
                         begin
                            writeln('YES');
                            halt;
                         end;
writeln('NO');
end.


var s:string;
    res,ans,n,i:longint;
    a:array[1..6]of longint;
 begin
  //assign(input,'input.txt');reset(input);
  //assign(output,'output.txt');rewrite(output);
  readln(s);
  n:=length(s);
  for i:=1 to n do
   if(s[i]='R')then inc(a[1]) else
   if(s[i]='O')then inc(a[2]) else
   if(s[i]='Y')then inc(a[3]) else
   if(s[i]='G')then inc(a[4]) else
   if(s[i]='B')then inc(a[5]) else
   if(s[i]='V')then inc(a[6]);
  for i:=1 to 6 do
   if(a[i]>0)then
    begin
     inc(res);
     if(a[i]>ans)then ans:=a[i];
    end;
  if(res=1)and(ans=6)then writeln(1)
  else
  if(res=2)and(ans=5)then writeln(1)
  else
  if(res=2)then writeln(2)
  else
  if(res=3)and(ans=2)then writeln(6)
  else
  if(res=3)and(ans=3)then writeln(3)
  else
  if(res=3)then writeln(2)
  else
  if(res=4)and(ans=3)then writeln(5)
  else
  if(res=4)then writeln(8)
  else
  if(res=5)then writeln(15)
           else writeln(30);
  close(input);close(output);
 end.


                           const eps=0.0000000001;  besk1=200000008;  nnn=4600000;
              modul=1000000007{998244353} ;
   besk=4000000000000000000;
   label 22,1,2,3,4;
    type    real=extended;   double=extended;
    mas=array [-300000..nnn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[-10000..nnn] of longint;mass1=^mass;
    var ans,ans1,ans2,dl,posleft,posright,n,xxx,yyy,dx,dy,m,w,h,zz,jjj,l,r,aa,bb,cc,sum,mnog,nn,t3,t4,t5,t6,posmax,tmax,kold,kk,j2,ttt,ppp,kol,sq,pmin,pmax,limit,posi,posj,diam,oldt,ot1,time,pos,ll,rr,posx,posy,gr,dloch,newdl,oldn,oldm,ost,ot,p1,p2,p3,p4,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,p0,t2,t1,jj,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,t,nm,smin,cen:int64;
   k,i2,i3,step2,k1,k2,pp0,mask,i1,j1,step1, step, i,j:longint;
   ysum,yold,x1,x0,d,xx,yy,b,a,zsum,y,x,z:array[-200000..5350002] of int64;
    prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    iii,oldpos,finot,vv,znak:int64;
    aold:mas;
    v,ccc,dist,alpha,phi:extended;
    zzz,ddnew,koef,polex,ddsum,dd:array[-1..2400,-1..2200] of int64;
    ppos,mma,ma:array[-1000..2000005,-1..15] of int64;
    xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;
    del:array[-1..100001,-1..20] of longint;
    z0,num,y1,z1,z2,kolnul,fact,next,prev,str,s,name,dnew, voltay,c,day:mas;
    zzzz:array[0..125000000] of byte;
    aaa,bbb,x2:extended;
    delit:array[0..100000,0..20] of longint;
    pole:array[-10..2002,-10..2005] of char;
    ddd,ppole,ddl,ddr,dd3,dd4:array[-10..200,-10..220] of int64;
    ddnnew:array[-1..12,-1..12,0..200,0..3] of int64;
   newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;
    ssold,sss1,sss2:string;
    def,stepen,koled,och,newoch,place,newnabor,stoim,nabor:array[-10..200005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
    ss1,ss2,ss:string;ch,ch1,ch2:char;
    pr,hesh,numright,dr: array [-10..206000,-1..16] of int64;
    s3,s2,s1:array[-100..500000] of string;

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

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

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

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

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

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

   summ:=@ott;
 end;

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

   prod:=@ott;
 end;

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

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

end;

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

   prost:=fl;
 end;

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

     end;

end;

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

end;

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

         end;

     end;

end;

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

         end;

     end;

end;

 function ff(gr:int64):boolean;

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

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

begin
  {  assign (input,'D:\Projects\input.txt');reset(input);
      assign (output,'D:\Projects\output.txt'); rewrite(output);
   }
    read(n,m);
   t:=n div m; ost:=n mod m;
   p:=0;
    for i:=1 to m do for j:=1 to m do begin inc(p); x[p]:=i*i+j*j; end;
    ans:=0;
    for i:=1 to p do if x[i] mod m =0 then inc(ans);
    ot:=ans*t*t;
    p:=0;
    for i:=1 to m do for j:=1 to ost do begin inc(p); x[p]:=i*i+j*j; end;
    ans1:=0;
    for i:=1 to p do if x[i] mod m =0 then inc(ans1);
    ot:=ot+ans1*t*2;

    p:=0;
    for i:=1 to ost do for j:=1 to ost do begin inc(p); x[p]:=i*i+j*j; end;
    ans2:=0;
    for i:=1 to p do if x[i] mod m =0 then inc(ans2);
    ot:=ot+ans2;
    writeln(ot);

     goto 1;

        gr:=63;
      for i:=1 to gr do for j:=1 to gr do begin inc(p); zzz[i,j]:=i*i+j*j; x[p]:=i*i+j*j;  end;

       for i:=5 to 5 do
         begin
            t:=0;
            for j:=1 to gr do for k:=1 to gr do  if zzz[j,k] mod i=0 then
            begin inc(t); {writeln(j,' ',k);}   end;
            writeln(i,'  == ',t);

         end;

1:             close(output);
end.


Var
    n, i: Int64;
    S: String;

Begin
    Readln(n);
    Readln(S);
    While (i*(i+1)) div 2 + 1 <= n do Begin
        Write(S[(i*(i+1)) div 2 + 1]);
        i += 1
    End;
End.


var
n, a: int64;
begin
read(n, a);
if a mod 2 = 1
then
begin
writeln(a div 2 + 1);
exit;
end;
writeln((n - a + 1) div 2 + 1);
end.


program WS7_1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

label
  10;
  var a,b,c,d:string;
  var f,k,i:Integer;
begin
  Readln(k);
  Readln(a);
  Readln(b);
  Readln(c);
  Readln(d);
  f:=0;
  k:=k*2;
  for i:=1 to 4 do begin
  if a[i]='1' then f:=f+1;
  if b[i]='1' then f:=f+1;
  if c[i]='1' then f:=f+1;
  if d[i]='1' then f:=f+1;
  if k<f then begin Writeln('NO'); goto 10; end;
  end;
  f:=0;
   for i:=1 to 4 do begin
  if a[i]='2' then f:=f+1;
  if b[i]='2' then f:=f+1;
  if c[i]='2' then f:=f+1;
  if d[i]='2' then f:=f+1;
  if k<f then begin Writeln('NO'); goto 10; end;
  end;
    f:=0;
   for i:=1 to 4 do begin
  if a[i]='3' then f:=f+1;
  if b[i]='3' then f:=f+1;
  if c[i]='3' then f:=f+1;
  if d[i]='3' then f:=f+1;
  if k<f then begin Writeln('NO'); goto 10; end;
  end;
    f:=0;
   for i:=1 to 4 do begin
  if a[i]='4' then f:=f+1;
  if b[i]='4' then f:=f+1;
  if c[i]='4' then f:=f+1;
  if d[i]='4' then f:=f+1;
  if k<f then begin Writeln('NO'); goto 10; end;
  end;
    f:=0;
   for i:=1 to 4 do begin
  if a[i]='5' then f:=f+1;
  if b[i]='5' then f:=f+1;
  if c[i]='5' then f:=f+1;
  if d[i]='5' then f:=f+1;
  if k<f then begin Writeln('NO'); goto 10; end;
  end;
    f:=0;
   for i:=1 to 4 do begin
  if a[i]='6' then f:=f+1;
  if b[i]='6' then f:=f+1;
  if c[i]='6' then f:=f+1;
  if d[i]='6' then f:=f+1;
  if k<f then begin Writeln('NO'); goto 10; end;
  end;
    f:=0;
   for i:=1 to 4 do begin
  if a[i]='7' then f:=f+1;
  if b[i]='7' then f:=f+1;
  if c[i]='7' then f:=f+1;
  if d[i]='7' then f:=f+1;
  if k<f then begin Writeln('NO'); goto 10; end;
  end;
    f:=0;
   for i:=1 to 4 do begin
  if a[i]='8' then f:=f+1;
  if b[i]='8' then f:=f+1;
  if c[i]='8' then f:=f+1;
  if d[i]='8' then f:=f+1;
  if k<f then begin Writeln('NO'); goto 10; end;
  end;
    f:=0;
   for i:=1 to 4 do begin
  if a[i]='9' then f:=f+1;
  if b[i]='9' then f:=f+1;
  if c[i]='9' then f:=f+1;
  if d[i]='9' then f:=f+1;
  if k<f then begin Writeln('NO'); goto 10; end;
  end;
  f:=0;
  10:
   if k>=f then Writeln('YES');
   readln;
  end.


var
  n:string;
  p:boolean;
  i:longint;
begin
  readln(n);
  if length(n)<5 then begin writeln('Too weak');exit;end;
  p:=false;
  for i:=1 to length(n) do if n[i] in ['0'..'9'] then p:=true;
  if not(p) then begin writeln('Too weak');exit;end;
  p:=false;
  for i:=1 to length(n) do if n[i] in ['a'..'z'] then p:=true;
  if not(p) then begin writeln('Too weak');exit;end;
  p:=false;
  for i:=1 to length(n) do if n[i] in ['A'..'Z'] then p:=true;
  if not(p) then begin writeln('Too weak');exit;end;
  writeln('Correct');
end.


var
  a:array[0..1025] of longint;
  n,i,j,k,t,l,tot,p:longint;
  total,answer,pl,pr,vl,vr,s1,s2:int64;

function union(x1,y1,x2,y2:int64):int64;
  var
    t,r:int64;
  begin
    if x1>x2 then t:=x1 else t:=x2;
    if y1<y2 then r:=y1 else r:=y2;
    if r>=t then union:=r-t+1 else union:=0;
  end;

begin
  t:=1;
  for i:=1 to 9 do
    begin
      t:=t*2;
      for j:=1 to t do
        begin
          l:=j-1;p:=1;
          inc(tot);
          a[tot]:=0;
          for k:=1 to i do
            begin
              if l mod 2=1 then a[tot]:=a[tot]+7*p else a[tot]:=a[tot]+4*p;
              p:=p*10;
              l:=l div 2;
            end;
        end;
    end;
  readln(pl,pr,vl,vr,k);
  total:=(pr-pl+1)*(vr-vl+1);
  answer:=0;
  a[0]:=0;a[tot+1]:=1000000001;
  for i:=1 to tot-k+1 do
    begin
      if (a[i]>=pl) and (a[i+k-1]<=vr) then
        begin
          s1:=union(pl,pr,a[i-1]+1,a[i]);
          s2:=union(vl,vr,a[i+k-1],a[i+k]-1);
          answer:=answer+s1*s2;
        end;
      if (a[i]>=vl) and (a[i+k-1]<=pr) then
        begin
          s1:=union(vl,vr,a[i-1]+1,a[i]);
          s2:=union(pl,pr,a[i+k-1],a[i+k]-1);
          answer:=answer+s1*s2;
        end;
      if (k=1) and (a[i]>=pl) and (a[i]<=pr) and (a[i]>=vl) and (a[i]<=vr) then answer:=answer-1;
    end;
  writeln(answer/total:0:12);
end.


var
  n:longint;
begin
  readln(n);
  writeln((n-1) div 2);
end.


var
 p,i,r,j:longint;
 a,b,m,vx,vy,t,vz,l:extended;
begin
 readln(a,b,m);
 readln(vx,vy,vz);
 t:=-m/vy;
 if vx>=0 then
 begin
  l:=vx*t;
  if a/2>=l then l:=a/2+l else
  begin
   l:=l-a/2;
   p:=trunc(l/a);
   l:=l-p*a;
   if not(odd(p)) then l:=a-l;
  end;
 end else
 begin
  l:=-vx*t;
  if l<=a/2 then l:=a/2-l else
  begin
   l:=l-a/2;
   p:=trunc(l/a);
   l:=l-p*a;
   if odd(p) then l:=a-l;
  end;
 end;
 write(l:0:9,' ');
 l:=vz*t;
 p:=trunc(l/b);
 l:=l-p*b;
 if odd(p) then l:=b-l;
 writeln(l:0:9);

end.


Var a:Array[1 .. 1000000] of Longint;
    n,count,rem,i,b,j,srem:Longint;
    OK:Boolean;
Begin
    Readln(n);
    Readln(a[1]); a[2]:=0-a[1]; count:=2; rem:=2; OK:=False;
    For i:=2 to n do begin
        Readln(b);
        For j:=1 to rem do begin
            srem:=a[j];
            a[j]:=a[j]+b;
            Inc(count);
            a[count]:=srem-b;
        End;
        rem:=count;
    End;
    For i:=1 to count do
        If a[i] mod 360 = 0 then begin
            OK:=true;
            Break;
        End;
    If OK then writeln('YES') else writeln('NO');
End.


program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, math;

type
  point = record
    x, y: integer;
  end;

var
  a, b, c: point;

begin
  readln(a.x, a.y);
  readln(b.x, b.y);
  readln(c.x, c.y);
  writeln(3);
  writeln(a.x + b.x - a.x + c.x - a.x, ' ', a.y + c.y - a.y + b.y - a.y);
  writeln(b.x + a.x - b.x + c.x - b.x, ' ', b.y + c.y - b.y + a.y - b.y);
  writeln(c.x + a.x - c.x + b.x - c.x, ' ', c.y + a.y - c.y + b.y - c.y);
  readln;
  readln
end.


var  f:array[-4..53,-4..53,-4..53,0..53]of boolean;
    a:array[0..53]of string;
function pd(i,j:longint):boolean;
begin
    if(i<1)or(j<1) then exit(false);
    if (a[i,1]=a[j,1])or(a[i,2]=a[j,2]) then exit(true) else exit(false);
end;
procedure rec(x,y,z,step:longint);
begin
    if f[x,y,z,step]=false then exit;
    f[x,y,z,step]:=false;
    if step=1 then begin writeln('YES');halt;end;
    if pd(x,y) then rec(x,z,step-3,step-1);
    if pd(x,step-3) then rec(y,z,x,step-1);
end;
procedure init;
var  n,i:longint;
     s:string;
begin
    readln(n);
    readln(s);
    for i:=1 to n do a[i]:=s[i*3-2]+s[i*3-1];
    fillchar(f,sizeof(f),true);
    rec(n,n-1,n-2,n);
    writeln('NO');
end;
begin
    init;
end.


Const md=1000000009;
Var n,k,m:int64;
zz,l,r,v,rez:int64;
i:longint;
function pow(n,k:int64):int64;
Var x:int64;
begin
  if k=0
  then pow:=1
  else begin
        x:=pow(n,k div 2);
        x:=(x*x) mod md;
        if k mod 2=1
        then x:=(x*n) mod md;
        pow:=x;
       end;
end;
function kol(n:int64):int64;
Var z:int64;
begin
  if n<k
  then begin kol:=n; exit; end;
  z:=n div k;
  z:=(2*pow(2,z-1)*2-2) mod md;
  z:=z*k+n mod k;
  kol:=z mod md;
end;
begin
 // Assign(input,'input.txt'); reset(input);
 // Assign(output,'output.txt'); rewrite(output);
  read(n,m,k);
  if m=0
  then begin writeln(0); halt(0); end;
  if m<=n div 2+n mod 2
  then begin
         writeln(m);
         halt(0);
       end;
  l:=0; r:=n+1;
  for i:=1 to 40 do
  begin
    zz:=(l+r) div 2;
    if (zz-1)*k+k-1>n
    then begin
          r:=zz;
          continue;
         end
    else begin
          v:=n-zz*k;
          if v<0
          then v:=0;
          if v+zz*(k-1)>=m
          then l:=zz
          else r:=zz;
         end;
  end;
  zz:=l;
  if zz*(k-1)>m
  then begin
         writeln(m);
         halt(0);
       end
  else begin
        m:=m-zz*(k-1);
        rez:=(kol(m)+zz*(k-1)) mod md;
        writeln(rez);
       end;
end.


var     x1,x2,y1,y2     :int64;
        d,r     :int64;
begin
        readln(x1,y1);
        readln(x2,y2);
        r:=abs(x1-x2);
        d:=abs(y1-y2);
        if d>r then writeln(d)
        else writeln(r);
readln;
end.


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

   label 22,1,2,3,4,33;
    type    real=extended;   double=extended;
    mas=array [-300000..nnn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3,p4 :int64;end; zap1=^zap;
    mass=array[-10000..nnn] of longint;mass1=^mass;
    matr=array[-10..200,-10..200] of int64;
    matr1=^matr;
    var izb,kol,oldpp,t,pos1,pos2,r,razm,kollad,leftx,rightx,lefty,righty,num,dirx,diry,oldii,obr,koludal,maxdl,mindl,tmin,aaa,bbb,ccc,kolst,kollek,aa,bb,t1,t2,kolx,koly,ans,ans1,ans2,dl,posleft,posright,n,xxx,yyy,dx,dy,m,w,h,jjj,l,cc,mnog,nn,t3,t4,t5,t6,posmax,tmax,kold,kk,j2,ttt,ppp,pmin,pmax,limit,posi,posj,diam,oldt,ot1,time,pos,ll,posx,posy,dloch,newdl,oldn,oldm,ost,ot,p1,p2,p3,p4,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,p0,jj,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,nm,smin,cen:int64;
   istart,jstart,ifinish,jfinish,k,i2,i3,step2,k1,k2,pp0,mask,i1,j1,step1, step, i,j:longint;
   zagr,xx,yy,kolizm,test,zz,predok,hesh,yold,x1,x0,d,b,a,zsum,y,x,z:array[-200000..1535002] of int64;
    otmat,amat,bmat,cmat:matr;
    zan1,zan2:array[-1000..200000,-2..26] of boolean;
    marked1,marked2:array[-2000..2000000] of boolean;
   gr1,gr2,gr:array[-1..2000,-1..2000] of boolean;
    dd,ddr:array[-1..1502,-1..1502] of int64;
    prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    iii,oldpos,finot,vv,znak:int64;
    aold:mas;  anss:zap;
    sss,ss,ss1,ss2:string;
    newstr,str:array[-1000..200000] of string;
    lll,rrr,v,dist,alpha,phi:extended;
    masmatr:array[-1..101,-1..101,-1..101] of int64;
    zzz,ddnew,koef,polex,ddsum,ddl:array[-1..4,-1..1300000] of int64;
    str1,str2,dpos,sum,ppos,mma,ma:array[-1000..200005,-1..30] of int64;
    xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;
    del:array[-1..100001,-1..20] of longint;
    z0,y1,z1,z2,kolnul,fact,next,prev,s,name,dnew, voltay,c,day:mas;
    zzzz:array[0..125000000] of byte;
    aaaa,bbbb,x2:extended;
    delit:array[0..100000,0..20] of longint;
    pole:array[-10..2002,-10..2005] of char;
    ddd,matrr,ppole,dd3,dd4:array[-10..2000,-10..2200] of int64;
    ddnnew:array[-1..12,-1..12,0..200,0..3] of int64;
   newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;
    ssold,sss1,sss2:string;
    def,stepen,koled,och,newoch,place,newnabor,stoim,nabor:array[-10..500005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
     dost:array[-1..210,-1..210,0..3,0..3] of int64;
    sss12:string;ch,ch1,ch2:char;
    pr,heshh,numright,dr: array [-10..206,-1..16] of int64;
    s3,s2,s1:array[-100..500000] of string;

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

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

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

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

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

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

   summ:=@ott;
 end;

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

   prod:=@ott;
 end;

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

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

end;

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

   prost:=fl;
 end;

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

     end;

end;

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

end;

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

         end;

     end;

end;

 function ff(gr:int64):boolean;

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

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

begin
   { assign (input,'D:\Projects\input.txt');reset(input);
      assign (output,'D:\Projects\output.txt'); rewrite(output);
    }
      read(n);
      ot:=0;
      for i:=2 to n-1 do begin ii:=i; ot:=ot+(ii+1)*ii; end;

     writeln(ot);

1:             close(output);
end.


var
 a1,b,h,w,n,i,j : longint;
 a : array[1..100001] of int64;
 f,ff : array[0..100001] of int64;
 function min(a,b : longint):longint; begin if a>b then min:=b else min:=a;end;
 procedure sort(l,r : longint);
 var
  i,j,x,t : longint;
  begin
   if l>=r then exit;
   x:=a[l+random(r-l)];
   i:=l-1;j:=r+1;
   while i<j do
    begin
     repeat i:=i+1 until a[i]<=x;
     repeat j:=j-1 until a[j]>=x;
     if i<j then
      begin
       t:=a[i];a[i]:=a[j];a[j]:=t;
      end;
    end;
   sort(l,j);
   sort(j+1,r);
  end;

begin
 readln(h,w,a1,b,n);randomize;
 if ((a1>=h) and (b>=w)) or ((a1>=w) and (b>=h)) then begin writeln(0); halt; end;

 for i:=1 to n do read(a[i]);
 sort(1,n);
 fillchar(f,sizeof(f),0);
 ff[a1]:=b;
 for i:=1 to min(36,n) do
  begin
    f:=ff;
    for j:=1 to 100000 do
     if ff[j]<>0 then begin
      if ff[j]*a[i]<=100001 then
        begin
         f[j]:=ff[j]*a[i];
         if ((j>=h) and (ff[j]*a[i]>=w)) or ((j>=w) and (ff[j]*a[i]>=h)) then begin writeln(i); halt; end;
        end else
        begin
         f[j]:=100001;
         if (j>=h) or (j>=w) then begin writeln(i); halt; end;
        end;
      if int64(j)*a[i]<=100001 then
        begin
         f[j*a[i]]:=ff[j];
         if ((j*a[i]>=h) and (ff[j]>=w)) or ((j*a[i]>=w) and (ff[j]>=h)) then begin writeln(i); halt; end;
        end else
          begin
           f[100001]:=ff[j];
           if (ff[j]>=w) or (ff[j]>=h) then begin writeln(i); halt; end;
          end;
     end;
    ff:=f;
  end;
 writeln(-1);
end.


Var v,i,n,k,kol,a,b:longint;
zz,m,pred,z:array [1..1000000] of longint;
used:array [1..1000000] of boolean;
f:boolean;
procedure add(i,j:longint);
begin
  inc(kol);
  m[kol]:=j;
  pred[kol]:=z[i];
  z[i]:=kol;
end;
function proverka(i1,j1:longint):boolean;
Var i:longint;
f:boolean;
begin
  f:=false;
  i:=z[i1];
  while i<>0 do
  begin
    if m[i]=j1
    then f:=true;
    i:=pred[i];
  end;
  proverka:=f;
end;
begin
 // Assign(input,'input.txt'); reset(input);
 // Assign(output,'output.txt'); rewrite(output);
  read(n,k);
  randomize;
  if k<n
  then begin
        if n=2
        then begin writeln(-1); halt(0); end;
        if (n=3)and(k=2)
        then begin writeln(-1); halt(0); end;
        for i:=1 to k do
        begin
          read(a,b);
          add(a,b);
          add(b,a);
        end;
        v:=k;
        kol:=0;
        while 1=1 do
        begin
          f:=true;
          inc(kol);
          if kol>5000
          then begin writeln(-1); halt(0); end;
          fillchar(used,sizeof(used),false);
          for i:=1 to n do
          begin
            while 1=1 do
            begin
             k:=random(n)+1;
             if not used[k]
             then begin
                   used[k]:=true;
                   break;
                  end;
            end;
            zz[i]:=k;
          end;
          for i:=1 to v do
          if proverka(zz[i],zz[i+1])
          then f:=false;
          if f
          then begin
                for i:=1 to v do
                writeln(zz[i],' ',zz[i+1]);
                halt(0);
               end;
        end;
       end
  else begin
        if n<5
        then begin writeln(-1); halt(0); end;
        for i:=1 to k do
        begin
          read(a,b);
          add(a,b);
          add(b,a);
        end;
        v:=k;
        kol:=0;
        while 1=1 do
        begin
          f:=true;
          inc(kol);
          if kol>5000
          then begin writeln(-1); halt(0); end;
          fillchar(used,sizeof(used),false);
          for i:=1 to n do
          begin
            while 1=1 do
            begin
             k:=random(n)+1;
             if not used[k]
             then begin
                   used[k]:=true;
                   break;
                  end;
            end;
            zz[i]:=k;
          end;
          for i:=1 to v-1 do
          if proverka(zz[i],zz[i+1])
          then f:=false;
          if proverka(zz[n],zz[1])
          then f:=false;
          if f
          then begin
                for i:=1 to v-1 do
                writeln(zz[i],' ',zz[i+1]);
                writeln(zz[n],' ',zz[1]);
                halt(0);
               end;
        end;
       end;
end.


var i,j,x,z,y,k,res,dem:longint;
    s:string;
function min(a,b:longint):longint;
    begin
        if a>b then exit(b) else exit(a);
    end;

begin
read(s);
res:=6;
for i:=0 to 9 do
    for j:=0 to 9 do
        for k:=0 to 9 do
            for x:=0 to 9 do
                for y:=0 to 9 do
                    for z:=0 to 9 do
                        begin
                            dem:=0;
                            if i+j+k=x+y+z then
                                begin
                                    if i<>ord(s[1])-48 then inc(dem);
                                    if j<>ord(s[2])-48 then inc(dem);
                                    if k<>ord(s[3])-48 then inc(dem);
                                    if x<>ord(s[4])-48 then inc(dem);
                                    if y<>ord(s[5])-48 then inc(dem);
                                    if z<>ord(s[6])-48 then inc(dem);
                                    res:=min(res,dem);
                                end;
                        end;
writeln(res);
end.


var
  s1,s2 : string;
  i : longint;
begin
  readln(s1);
  readln(s2);
  for i:=1 to length(s2) do
    if s1[i]<>s2[i] then write('1')
  else
    write('0');
end.


var g:array[1..500,1..500] of byte;
    n,m,u,v,i,j:longint;
    k:boolean;
    s:array[1..500] of byte;
begin
  readln(n,m);
  for i:=1 to m do
    begin
      readln(u,v);
      g[u,v]:=1;
      g[v,u]:=1;
    end;
  for i:=1 to n do
    begin
      k:=true;
      for j:=1 to n do
        begin
          if i=j then continue;
          if g[i,j]=0
            then
              begin
                k:=false;
                break;
              end;
        end;
      if k then
        s[i]:=1;
    end;
  for i:=1 to n do
    if s[i]=0
      then
        for j:=1 to n do
          begin
            if i=j then continue;
            if g[i,j]=0
              then
                s[j]:=2;
          end;
  for i:=1 to n do
    if s[i]=2
      then
        for j:=1 to n do
          begin
            if i=j then continue;
            if ((g[i,j]=0)and(s[j]=2))or((g[i,j]=1)and(s[j]=0))
              then
                begin
                  writeln('NO');
                  exit;
                end;
          end;
  writeln('YES');
  for i:=1 to n do
    begin
      case s[i] of
        0:write('a');
        1:write('b');
        2:write('c');
      end;
    end;
end.


var z,n,k,j,i,m,s:longint;x,y:array[0..2000]of longint;
begin
 read(n,m,x[1]);
 s:=0;k:=0;
 if odd(x[1]) then inc(s) else dec(s);
 for i:=2 to n do
 begin
  read(x[i]);
  if s=0 then begin
   z:=abs(x[i]-x[i-1]);
   j:=k;inc(k);while y[j]>z do begin y[j+1]:=y[j];dec(j);end;
   y[j+1]:=z;
  end;
  if odd(x[i]) then inc(s) else dec(s);
 end;
 for i:=1 to k do
 y[i]:=y[i]+y[i-1];
 y[k+1]:=m+m;
 i:=0;while y[i+1]<=m do inc(i);
 write(i);
end.


  USES
                math;

  CONST
                fi      =       '';//106C.inp';
                fo      =       '';//106C.out';
                mmax    =       1010;

  VAR
                ff      :       array [0.. mmax, 0.. 100] of longint;
                a,b,c,d :       array [0.. mmax] of longint;
                n, m    :       longint;
                c0, d0  :       longint;
                res     :       longint;
                f, g    :       text;

  procedure     openf;
     begin
        assign(f, fi);   reset(f);
        assign(g, fo);   rewrite(g);
     end;

  procedure     closef;
     begin
        close(f);   close(g);
     end;

  procedure     readf;
     var
        i: longint;
     begin
        readln(f, n, m, c0, d0);
        for i:= 1 to m do
           readln(f, a[i], b[i], c[i], d[i]);
     end;

  procedure     process;
     var
        i, j, k, t: longint;
     begin
        for i:= 1 to n do
           begin
              for j:= 0 to i div c0 do
                  ff[i, 0]:= max(ff[i, 0], ff[i- j* c0, 0]+ d0* j);

              for j:= 1 to m do
                 begin
                    for k:= 0 to i div c0 do
                       ff[i, j]:= max(ff[i, j], ff[i- k* c0, j- 1]+ d[0]* j);

                    for t:= 0 to a[j] div b[j] do
                       if i>= t* c[j] then
                          ff[i, j]:= max(ff[i, j], ff[i- t* c[j], j- 1]+ d[j]* t);
                 end;
           end;
        write(ff[n, m]);
     end;

     BEGIN
           openf;
           readf;
           process;
           closef;
     END.


program B;
const
	Kx : array[1..4] of longint = (0,-1,0,1);
	Ky : array[1..4] of longint = (-1,0,1,0);
var
	N,M: Integer;
	DN,DM:array[1..20] of longint;
	Dir:array[0..22,0..22,1..4] of boolean;
	Check:array[0..22,0..22] of boolean;

procedure Find(X,Y:longint);
var
	i: Integer;
begin
	if (X<1) or (X>N) then exit;
	if (Y<1) or (Y>M) then exit;
	Check[X,Y]:=true;
	for i:=1 to 4 do
		if (Dir[X,Y,i]) and (not Check[X+Kx[i],Y+Ky[i]]) then
			Find(X+Kx[i],Y+Ky[i]);
end;

procedure Main();
var
	i,j,k,t: Integer;
	Ch: char;
begin
	readln(N,M);
	for i:=1 to N do
		begin
			read(Ch);
			if Ch='<' then
				begin
					DN[i]:=-1;
				end
			else
				begin
					DN[i]:=1;
				end;
		end;
	readln;
	for i:=1 to M do
		begin
			read(Ch);
			if ch='^' then
				begin
					DM[i]:=-1;
				end
			else
				begin
					DM[i]:=1;
				end;
		end;
	for i:=1 to N do
		for j:=1 to M do
			begin
				if DN[i]=-1 then Dir[i,j,1]:=true else Dir[i,j,3]:=true;
				if DM[j]=-1 then Dir[i,j,2]:=true else Dir[i,j,4]:=true;
			end;
	for i:=1 to N do
		for j:=1 to M do
			begin
				fillchar(Check,sizeof(Check),False);
				Find(i,j);
				for k:=1 to N do
					for t:=1 to M do
						if not Check[k,t] then
							begin
								writeln('NO');
								exit;
							end;
			end;
	writeln('YES');
end;

begin
	Main();
end.


Program ILoveYou;
VAR n,i,x:int64;
Begin

//I know there are faster ways to calculate the factorial, but since n <= 20, it shouldn't be a problem

Readln(n);
x:=1;
for i:=((n div 2) + 1) to n do
Begin
x:=x*i;
end;

for i:=2 to (n div 2) do
Begin
x:=x div i;
end;
for i:=2 to (n div 2) - 1 do
Begin
x:=x*(i*i);
end;
x:=x div 2;

Writeln(x);

Readln;
END.


const fi='';
    fo='';
var f:text;
    a,b:0..100;
procedure process;
begin
    assign(f,fi);reset(F);
    read(F,a,b);
    close(F);
    assign(f,fo);rewrite(F);
    if (abs(a-b)>1) or ( (a=0) and (b=0)) then write(f,'NO') else write(f,'YES');
    close(F);
end;

begin
    process;
end.


var
ok:boolean;
ch:char;
eee,g,ii,n,m,k,i,j:longint;
x1,y1,step:longword;
ee,nm,s,e:array[0..151,0..6]of longword;

label nextt;

 begin
  readln(n,m,k);
  for i:=0 to 6 do
   begin
    ee[0,i]:=(1 shl 31)-1+(1 shl 31);
    ee[n+1,i]:=ee[0,i];
   end;

  for i:=1 to n do
    begin
     ee[i,0]:=ee[i,0]+1;
     ee[i,(m+1) shr 5]:=ee[i,(m+1) shr 5] or (1 shl ((m+1) and 31));
     for j:=1 to m do
       begin
        read(ch);
        if ch='#' then
         begin
          ee[i,j shr 5]:=ee[i,j shr 5] or (1 shl (j and 31));
         end else
         begin
          s[i,j shr 5]:=s[i,j shr 5] or (1 shl (j and 31));
          e[i,j shr 5]:=e[i,j shr 5] or (1 shl (j and 31));
         end;
        if ch='E' then
          begin
           x1:=i;
           y1:=j;
          end;
       end;
     readln;
    end;

  g:=m shr 5;

     for i:=1 to n do
       for j:=0 to g do
         if s[i,j]>0 then
           begin
            if i <> x1 then goto nextt;
            if j <> (y1 shr 5) then goto nextt;
            if s[i,j] <> (1 shl (y1 and 31)) then goto nextt;
            eee:=eee+1;
            if eee=2 then goto nextt;
           end;
     writeln(0);
     halt(0);

  nextt:
  for ii:=1 to k do
    begin
     read(ch);
     fillchar(nm,sizeof(nm),0);
     if ch='U' then
       begin
        for i:=1 to n do
          for j:=0 to g do
            begin
             nm[i-1,j]:=nm[i-1,j] or (s[i,j] and e[i-1,j]);
             nm[i,j]:=nm[i,j] or (ee[i-1,j] and s[i,j]);
            end;
       end;
     if ch='D' then
       begin
        for i:=n downto 1 do
          for j:=0 to g do
            begin
             nm[i+1,j]:=nm[i+1,j] or (s[i,j] and e[i+1,j]);
             nm[i,j]:=nm[i,j] or (ee[i+1,j] and s[i,j]);
            end;
       end;

     if ch='L' then
       begin
        for i:=1 to n do
          begin
           for j:=0 to g do
             begin
              if (j<>0)then
                begin
                 if ((s[i,j] and 1)=1)and((e[i,j-1] and (1 shl 31))>0) then
                    nm[i,j-1]:=nm[i,j-1] or (1 shl 31) else if (s[i,j] and 1)=1 then
                    nm[i,j]:=nm[i,j] or 1;
                end else nm[i,j]:=nm[i,j] or (s[i,j]and 1);

              nm[i,j]:=nm[i,j] or ((s[i,j] shr 1)and e[i,j]);
              nm[i,j]:=nm[i,j] or (((s[i,j] shr 1)and ee[i,j]) shl 1);
             end;
          end;
       end;

     if ch='R' then
       begin
        for i:=1 to n do
          begin
           for j:=0 to g do
             begin
              if (j<>g)then
                begin
                 if ((s[i,j] and (1 shl 31))>0)and((e[i,j+1] and 1)>0) then
                    nm[i,j+1]:=nm[i,j+1] or 1 else if (s[i,j] and (1 shl 31))>0 then
                    nm[i,j]:=nm[i,j] or (1 shl 31);
                end else nm[i,j]:=nm[i,j] or (s[i,j] and (1 shl 31));

              nm[i,j]:=nm[i,j] or ((((s[i,j] shl 1)and e[i,j]))and ee[0,0]);
              nm[i,j]:=nm[i,j] or (((((s[i,j] shl 1)and ee[i,j]) shr 1))and ee[0,0]);
            //  if (ii=3)and(i=2)and(j=0) then writeln((((s[i,j] shl 1)and ee[i,j]) shr 1));
             end;
          end;
       end;

     s:=nm;
     eee:=0;{
     for i:=1 to n do
       begin
        for j:=0 to 31 do
          if (s[i,0] and (1 shl j))>0 then write(1)else write(0);
        for j:=0 to 31 do
          if (s[i,1] and (1 shl j))>0 then write(1)else write(0);
        writeln;
       end;
             }
     ok:=true;
     for i:=1 to n do
       for j:=0 to g do
         if s[i,j]>0 then
           begin
            if i <> x1 then ok:=false;
            if j <> (y1 shr 5) then ok:=false;
            if s[i,j] <> (longword(1) shl (y1 and 31)) then ok:=false;
            eee:=eee+1;
            if eee=2 then ok:=false;
           end;

     if ok then
     if eee=1 then
       begin
     writeln(ii);
     halt(0);
       end;

    end;
  writeln(-1);
 end.


label 1,2;
var s,m:string;
p,i,d:byte;
begin
readln(s);
m:='hello';
if length(s)<5 then begin writeln('NO'); goto 1; end;
d:=1; p:=0;
for i:=1 to length(s) do begin
if s[i]=m[d] then begin d:=d+1; p:=p+1; end;
if d>length(m) then goto 2;
end;
2:if p=5 then writeln('YES') else writeln('NO');
1:end.


Const fi='';
      fo='';
var f1,f2:text;
    a,b,dem,nho:int64;

begin
        assign(f1,fi);
        assign(f2,fo);
        reset(f1);
        rewrite(f2);
        readln(f1,a,b);
        dem:=0;
        while b<>1 do
            begin
            dem:=dem+a div b;
            a:=a mod b;
            nho:=a;
            a:=b;
            b:=nho;
            end;
        dem:=dem+a;
        writeln(f2,dem);
        close(f1);
        close(f2);
end.


Program B96;
Var Ans,N,M:Int64;
Procedure Rec(Res,A,B:Int64);
 Begin
  If Res>10000000000 Then Exit;
  If (Res>=N)And(A=B) Then
   Begin
    If Res<Ans Then Ans:=Res;
  End;
  If Res<=N*10 Then Rec(Res*10+4,A+1,B);
  If Res<=N*10 Then Rec(Res*10+7,A,B+1);
 End;
Begin
 Readln(N);
 Ans:=10000000000;
 Rec(0,0,0);
 Writeln(Ans);
End.


var  n, i, f:int64;
begin
readln(n);
if n mod 2=0 then
f:=n div 2
else
f:=n div 2-n;
writeln(f);
end.


var s:string;
sum,i:integer;
begin

readln(s);
sum:=0;
for i:=1 to (length(s) div 2) do if s[i]<>s[length(s)-i+1] then inc(sum);

if (sum=1)or((sum=0)and(odd(length(s)))) then writeln('YES') else writeln('NO');

end.


var
    i, len: Integer;
    s: string;

begin
    ReadLn (s);

    len := Length (s);
    i:= len div 2 + 1;

    while (i < len) and (Copy (s, 1, i) <> Copy (s, len - i + 1, len)) do
        Inc (i);

    if i < len then
    begin
        WriteLn ('YES');
        WriteLn (Copy (s, 1, i))
    end
    else
        WriteLn ('NO')
end.


var
 i,j:longint;
 l,r,m,ll,lr:longint;
 ans:int64;
 d:int64;
 last:longint;
 f:boolean;

procedure check;
begin
 ans:=ans+(d-last+1)*d;
 last:=d+1;
end;
procedure dfs(w:longint);
var
 j:longint;
begin
 if w=i then
  begin
   if (d>=l) and (d<=r) then
    begin
    // writeln(last,' ',d);
     check
    end
   else
    if (d>r) and (not f) then
     begin

      //writeln('over',last,' ',d);
      ans:=ans+(r-last+1)*d;
      f:=true;
      writeln(ans);
      halt;
     end;
   exit;
  end;
 d:=d*10+4;
 dfs(w+1);
 d:=d-4+7;
 dfs(w+1);
 d:=d div 10;
end;

begin
 readln(l,r);
 m:=l;
 while m<>0 do
  begin
   m:=m div 10;
   inc(ll);
  end;
 m:=r;
 while m<>0 do
  begin
   m:=m div 10;
   inc(lr);
  end;
 last:=l;
 for i:=ll-1 to lr+1 do
  begin
   dfs(0);
  end;
 writeln(ans);
end.


const
  yy:set of char=['a','e','i','o','u','y'];

var
  s:string;
  n,i,len:longint;
  ch:char;

begin
  readln(n);
  len:=0; s:='';
  for i:= 1 to n do
    begin
      read(ch);
       if ch in yy then
         begin
            inc(len);
            if len<2 then s:=s+ch;
         end
       else begin
              s:=s+ch;
              len:=0;
             end;
    end;
   writeln(s);
end.


var
 z,q,w,i,j,n,m,k,t,x:longint;
 a,b:array[0..4]of longint;
begin
 readln(n);
 for i:=1 to n do readln(a[i]);
 if n=0 then
 begin
  writeln('YES');writeln(1);writeln(1);writeln(3);writeln(3);halt;
 end;
 for i:=1 to n-1 do for j:=i+1 to n do if a[i]>a[j] then
 begin
  t:=a[i];a[i]:=a[j];a[j]:=t;
 end;
 if n=4 then
 begin
  for i:=1 to 3 do for j:=i+1 to 4 do if a[i]>a[j] then
  begin
   t:=a[i];a[i]:=a[j];a[j]:=t;
  end;
  if((a[1]+a[2]+a[3]+a[4])/4=(a[2]+a[3])/2)and((a[2]+a[3])/2=a[4]-a[1])then
  begin
   writeln('YES');halt;
  end;
 end;
 if n=1 then
 begin
  writeln('YES');
  writeln(a[1]);
  writeln(a[1]*3);
  writeln(a[1]*3);
  halt;
 end;
 if n=2 then
 begin
  for q:=1 to 1500 do for w:=1 to 1500 do
  begin
   b:=a;
   a[3]:=q;a[4]:=w;
   for i:=1 to 3 do for j:=i+1 to 4 do if a[i]>a[j] then
   begin
    t:=a[i];a[i]:=a[j];a[j]:=t;
   end;
   if((a[1]+a[2]+a[3]+a[4])/4=(a[2]+a[3])/2)and((a[2]+a[3])/2=a[4]-a[1])then
   begin
    writeln('YES');writeln(q);writeln(w);halt;
   end;
   a:=b;
  end;
 end;
 if n=3 then
 begin
  for q:=1 to 1500 do
  begin
   b:=a;
   a[4]:=q;
   for i:=1 to 3 do for j:=i+1 to 4 do if a[i]>a[j] then
   begin
    t:=a[i];a[i]:=a[j];a[j]:=t;
   end;
   if((a[1]+a[2]+a[3]+a[4])/4=(a[2]+a[3])/2)and((a[2]+a[3])/2=a[4]-a[1])then
   begin
    writeln('YES');writeln(q);halt;
   end;
   a:=b;
  end;
 end;
 writeln('NO');
end.


program _212A_Privatization;

const INF=100000007;

var q:array[1..200000]of longint;
	e:array[1..20000]of record y,rev,f,next,w:longint;end;
	visit:Array[1..1000]of boolean;
	prv,be,pre,px,py,usd,f,degx,degy:array[1..5010]of longint;
	head,tail,ss,tt,n,m,k,t,i,j,x,y,z,e0,ans:longint;

procedure addedge(x,y,c,w:longint);
begin
	inc(e0);
	e[e0].y:=y; e[e0].next:=prv[x]; e[e0].rev:=e0+1;
	e[e0].f:=c; e[e0].w:=w; prv[x]:=e0;
	inc(e0);
	e[e0].y:=x; e[e0].next:=prv[y]; e[e0].rev:=e0-1;
	e[e0].f:=0; e[e0].w:=-w; prv[y]:=e0;
end;

function spfa:boolean;
var i:longint;
begin
	for i:=1 to tt do f[i]:=INF;
	fillchar(visit,sizeof(visit),false);
	visit[ss]:=true;
	q[1]:=ss;
	head:=1;
	tail:=1;
	f[ss]:=0;
	while head<=tail do begin
		x:=q[head];
		inc(head);
		z:=prv[x];
		while z<>0 do begin
			y:=e[z].y;
			if (e[z].f>0)and(f[x]+e[z].w<f[y]) then begin
				f[y]:=f[x]+e[z].w;
				pre[y]:=x;
				be[y]:=z;
				if not visit[y] then begin
					visit[y]:=true;
					inc(tail);
					q[tail]:=y;
				end;
			end;
			z:=e[z].next;
		end;
		visit[x]:=false;
	end;
	exit(f[tt]<INF);
end;

procedure imp;
var delta:longint;
begin
	x:=tt;
	delta:=INF;
	while x<>ss do begin
		if e[be[x]].f<delta then delta:=e[be[x]].f;
		x:=pre[x];
	end;
	x:=tt;
	while x<>ss do begin
		dec(e[be[x]].f,delta);
		inc(e[e[be[x]].rev].f,delta);
		x:=pre[x];
	end;
end;

begin
	//assign(input,'212A.in');reset(input);
	readln(n,m,k,t);
	for i:=1 to k do begin
		readln(px[i],py[i]);
		usd[i]:=0;
		inc(degx[px[i]]);
		inc(degy[py[i]]);
	end;
	ans:=0;
	for i:=1 to n do if degx[i] mod t>0 then inc(ans);
	for i:=1 to m do if degy[i] mod t>0 then inc(ans);
	ss:=n+m+1;  tt:=ss+1;
	while (t>0) do begin
		e0:=0;
		fillchar(prv,sizeof(prv),0);
		for j:=1 to k do if usd[j]=0 then addedge(px[j],n+py[j],1,0);
		for j:=1 to n do begin
			addedge(ss,j,degx[j] div t,0);
			if degx[j] mod t>0 then addedge(ss,j,1,1);
		end;
		for j:=1 to m do begin
			addedge(n+j,tt,degy[j] div t,0);
			if degy[j] mod t>0 then addedge(n+j,tt,1,1);
		end;
		while spfa() do imp;
		z:=1;
		for j:=1 to k do if usd[j]=0 then begin
			if e[z].f=0 then begin
				usd[j]:=t;
				dec(degx[px[j]]); dec(degy[py[j]]);
			end;
			inc(z,2);
		end;
		dec(t);
	end;
	writeln(ans);
	for i:=1 to k do write(usd[i],' ');
	writeln;
end.


{$M 100000000}

var xx,j,n,i:longint;
ans:array[0..10000]of longint;
u:array[0..10000]of longint;
num,size:array[0..10000]of longint;
x,y,a,b,next,pr:array[0..10000]of longint;
aa:array[0..10000]of extended;
s:array[0..10000]of string;

function polar(xx,yy:extended):extended;
 begin
  if (xx>0)and(yy=0) then polar:=0 else
  if (xx>0)and(yy>0) then polar:=arctan(yy/xx) else
  if (xx=0)and(yy>0) then polar:=pi/2 else
  if (xx<0)and(yy>0) then polar:=pi-arctan(-yy/xx) else
  if (xx<0)and(yy=0) then polar:=pi else
  if (xx<0)and(yy<0) then polar:=pi+arctan(yy/xx) else
  if (xx=0)and(yy<0) then polar:=pi+pi/2 else
  if (xx>0)and(yy<0) then polar:=pi+pi-arctan(-yy/xx);
 end;

procedure sort(l,r: longint);
var
i,j: longint;
sx,sy:extended;
z:longint;
      begin
         i:=l;
         j:=r;
         sx:=aa[(l+r) div 2];
         repeat
           while aa[i]<sx do
            inc(i);
           while sx<aa[j] do
            dec(j);
           if not(i>j) then
             begin
                z:=num[i];
                num[i]:=num[j];
                num[j]:=z;
                z:=x[i];
                x[i]:=x[j];
                x[j]:=z;
                z:=y[i];
                y[i]:=y[j];
                y[j]:=z;

                sy:=aa[i];
                aa[i]:=aa[j];
                aa[j]:=sy;
                z:=u[i];
                u[i]:=u[j];
                u[j]:=z;
                inc(i);
                dec(j);
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

procedure dfs(v,p:longint);
var i:longint;
 begin
  i:=pr[v];
  size[v]:=1;
  while i>0 do
    begin
     if b[i]<>p then
       begin
        dfs(b[i],v);
        size[v]:=size[v]+size[b[i]];
       end;
     i:=next[i];
    end;
 end;

procedure rec(v,p,l,r:longint);
var i,j,ll,rr,co:longint;
max,maxx,numm:longint;
 begin
  max:=-2000000000;
  for i:=l to r do
   if u[i]=0 then
    if (y[i]>max)or((y[i]=max)and(x[i]>maxx)) then
      begin
       max:=y[i];
       maxx:=x[i];
       numm:=i;
      end;
  ans[num[numm]]:=v;
  u[numm]:=1;

  for i:=l to r do
   if i<>numm then
    begin
     aa[i]:=polar(x[i]-x[numm],y[i]-y[numm]);
    end;

  sort(l,r);

  j:=pr[v];

  rr:=l-1;
// moi kod ^^
  while j>0 do
    begin
     if b[j]<>p then
       begin
        ll:=rr+1;
        while u[ll]=1 do ll:=ll+1;
        co:=1;
        rr:=ll;
        while co<size[b[j]] do
          begin
           rr:=rr+1;
           if u[rr]=0 then co:=co+1;
          end;
        rec(b[j],v,ll,rr);
       end;

     j:=next[j];
    end;
 end;

 begin
  readln(n);
  for i:=1 to n-1 do
    begin
     read(a[i],b[i]);
     a[i+n-1]:=b[i];
     b[i+n-1]:=a[i];
    end;
  for i:=1 to n+n-2 do
    begin
     next[i]:=pr[a[i]];
     pr[a[i]]:=i;
    end;
  for i:=1 to n do
    begin
     readln(x[i],y[i]);
     num[i]:=i;
    end;

  dfs(1,0);
  rec(1,0,1,n);

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


uses math;
var
     T,X,Y,answer,Z,lcm,mn,md:Int64;

function gcd(X,Y:Int64):Int64;
begin
     while (X>0) and (Y>0) do
     if X>Y then X:=X mod Y
            else Y:=Y mod X;
     Exit(X+Y);
 end;

begin
     Readln(T,X,Y);
     Z:=gcd(X,Y);
     if (Y div Z)>(T div X) then begin
                                      mn:=min(X,Y)-1;
                                      mn:=min(mn,T);
                                      Z:=gcd(mn,T);
                                      mn:=mn div Z;
                                      T:=T div Z;
                                      if mn=T then Writeln('1/1')
                                              else Writeln(mn,'/',T);
                                      Halt;
                                  end;
     lcm:=(X div Z)*Y;
     answer:=T div lcm;
     mn:=min(X,Y)-1;
     md:=T mod lcm;
     answer:=answer+answer*mn;
     answer:=answer+min(mn,md);
     Z:=gcd(T,answer);
     answer:=answer div Z;
     T:=T div Z;
     if answer=T then Writeln('1/1')
                 else Writeln(answer,'/',T);
 end.


var
  i,tt,tmp,a,b:longint;
  r1,r2,x:int64;
  res:array[1..5]of string;
  function gcd(a,b:longint):longint;
    begin
      while (a>0)and(b>0)do
        if (a>b)then a:=a mod b else b:=b mod a;
      gcd:=a+b;
    end;
begin
  res[1]:='Dasha';
  res[2]:='Masha';
  reaD(a,b);
  tt:=1;
  if (a>b)then begin
    tmp:=a;a:=b;b:=tmp;
    tt:=3-tt;
  end;
  if (b>2*a)then begin
    writeln(res[tt]);
    exit;
  end;
  if (b=2*a)then begin
    writeln('Equal');
    exit;
  end;
  x:=int64(a)*b div gcd(a,b);
  r2:=0;
  for i:=1 to x div b do r2:=r2+i*int64(b-a);
  r1:=x-r2;
  if (r1<r2)then writeln(res[tt])else
  if (r1>r2)then writeln(res[3-tt])else
  writeln('Equal');
end.


var m,cm,m1:array[0..10] of longint;
    s:string;
    n,i,j,max,jj:longint;
begin
  readln(s);
  if s='1' then
  begin
    writeln(1);
    halt;
  end;
  for i:=1 to length(s) do m[i]:=ord(s[i])-ord('0');
  n:=length(s);
  m1[0]:=1;
  for i:=1 to n do m1[0]:=m1[0]*m[i];
  for i:=1 to n do
  begin
    cm:=m;
    if m[i]=0 then
    begin
      m1[i]:=0;
      continue;
    end;
    cm[i]:=m[i]-1;
    for j:=i+1 to n do cm[j]:=9;
    m1[i]:=1;
    j:=1;
    while cm[j]=0 do inc(j);
    for jj:=j to n do m1[i]:=m1[i]*cm[jj];
  end;
  max:=0;
  for i:=0 to n do if m1[i]>max then max:=m1[i];
  writeln(max);
end.


  const eps=0.0000000001;  besk=20000000000008;  nn=200000;
   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;
   { mass1=^mass; }
    var qq,kk,cc,pp,rr,v1,v2,kol,t,p,sum,k1,ii,jj,q,pos,z,pmax,imax,p1,p2,p3,p4,l,ot,nm,s1,s2,m,s,smin,cen,dl,t2,i1:int64;
    n,k,h,step,i,j:longint;
    tt,modul,aaa,bbb, aa,bb,ccc,dd:int64;
    xnew,xold, bold,bnew,r,x,y,d,c,aold,b,a:array[-10..300000] of int64;
     dda:array[-10..1200,-10..1200] of int64;
     marked:array[-10..300030] of boolean;
   zanx,zany:array[-10..200000] of boolean;
    sss, ss1,ss2:string;
    sot:array [-10..1000000] of char;
     zan,fl:array[-10..200000] of boolean;
    ss:string;ch:char;
   mm,matr,ddp, pole :array [-10..100,-10..100,-10..101] of int64;
   sm:array[-10..100,-10..100,-10..100] of int64;
    maxpr:array[0..nn] of string;
    st2:array[0..nn] of string;
     left,right,v0,s0,t0:extended;
     zv:point;
     newx,newy,xx,yy:array[-1..200000] of int64;

     yot:double;
       flag,flag1:boolean;
    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 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);
 begin
     a[0]:=1; for i:=1 to 18 do a[i]:=a[i-1]*10;
     ot:=0;
     for step:=1 to 18 do
       begin
           t:=step;
           if n>=a[step-1] then
             begin
                 p:=min(a[step]-1,n)-a[step-1]+1;
                 ot:=ot+p*t;

             end;

       end;
         if n<10 then ot:=n-1;
         if (n>=10)and(n<1000000000000) then ot:=ot else ot:=ot+1;
        writeln(ot);

 end;

   1:          close(output);
end.


uses math;
var
  a:array[1..12] of extended;
  x,y,z:extended;
  pos,i:longint;
begin
  readln(x,y,z);
  a[1]:=power(y,z)*ln(x);
  a[2]:=power(z,y)*ln(x);
  a[3]:=z*ln(power(x,y));
  a[4]:=y*ln(power(x,z));
  a[5]:=power(x,z)*ln(y);
  a[6]:=power(z,x)*ln(y);
  a[7]:=z*ln(power(y,x));
  a[8]:=x*ln(power(y,z));
  a[9]:=power(x,y)*ln(z);
  a[10]:=power(y,x)*ln(z);
  a[11]:=y*ln(power(z,x));
  a[12]:=x*ln(power(z,y));

  pos:=1;
  for i:=2 to 12 do
    if a[i]>a[pos]+1e-12
      then pos:=i;

  case pos of
    1:writeln('x^y^z');
    2:writeln('x^z^y');
    3:writeln('(x^y)^z');
    4:writeln('(x^z)^y');
    5:writeln('y^x^z');
    6:writeln('y^z^x');
    7:writeln('(y^x)^z');
    8:writeln('(y^z)^x');
    9:writeln('z^x^y');
    10:writeln('z^y^x');
    11:writeln('(z^x)^y');
    12:writeln('(z^y)^x');
  end;

end.


Var a, b, n, i, j:Integer;
    x, y:Array[1..4]of Integer;
    t:Boolean;
 Begin
  Read(n);
   For i:=1 to n do
   ReadLn(x[i],y[i]);
  if n=1 then Begin
               Write(-1);
               Halt(0);
              End;
  if(x[1]<>x[2])and(y[1]<>y[2])and(n=2)then Begin
                                          x[3]:=x[1];
                                          y[3]:=y[2];
                                         n:=3;
                                         End;

  For i:=1 to n-1 do
   For j:=i+1 to n do
    Begin
     if(X[i]=X[j])then Begin
                        a:=abs(y[i]-y[j]);
                       End else
     if(Y[i]=Y[j])then Begin
                        b:=abs(X[i]-X[j]);
                       End
    End;
  if A*b=0 then Write(-1)else
  Write(a*b);
 End.


program cf690D2;
const mo=1000003;
var n,c,i:longint;
    fac,ni:array[0..700010] of int64;
    ans:int64;
function power(x:int64;n:longint):int64;
var t:int64;
begin
  if n=1 then exit(x);
  if n=0 then exit(1);
  t:=power(x,n shr 1);
  t:=t*t mod mo;
  if n and 1=1 then t:=t*x mod mo;
  exit(t);
end;
begin
  readln(n,c);
  ans:=0;
  fac[0]:=1;
  for i:=1 to n+c do
    begin
      fac[i]:=(fac[i-1]*i) mod mo;
      ni[i]:=power(fac[i],mo-2);
    end;
  ni[0]:=1;
  for i:=1 to n do
      ans:=(ans+fac[i+c-1]*ni[c-1] mod mo *ni[i] mod mo) mod mo;
  writeln(ans);
end.


var
  s:ansistring;
  kg,st1,sl,sr,st,nom:array[0..1000500]of longint;
  g:array[0..1000000,0..3]of longint;
  kst,kq,xx,yy,kst1,kst2,n,i:longint;
  ty,st2:array[0..1000500]of char;
  f:array[0..1000000,0..1,0..1]of longint;

  function calc(x,y:longint;t:char):longint;
    begin
      if (t='|')then calc:=x or y else
      if (t='&')then calc:=x and y else
      if (t='^')then calc:=x xor y;
    end;

  function rec(t,x,y:longint):boolean;
    var
      x1,y1,x2,y2:longint;

    begin
      if (f[t][x][y]<>-1)then begin
        if (f[t][x][y]=1)then rec:=true else rec:=false;
        exit;
      end;
      if (s[sl[t]]<>'(')then begin
        if (s[sl[t]]='?')then begin
          f[t][0][1]:=1;
          f[t][1][0]:=1;
        end else begin
          x1:=ord(s[sl[t]])-48;
          f[t][x1][x1]:=1;
        end;
        if (f[t][x][y]<>1)then f[t][x][y]:=0;
        rec:=f[t][x][y]=1;
        exit;
      end;
      f[t][x][y]:=0;
      for x1:=0 to 1 do
        for y1:=0 to 1 do
          for x2:=0 to 1 do
            for y2:=0 to 1 do
              if (rec(g[t][1],x1,y1))and(rec(g[t][2],x2,y2))
                then f[t][calc(x1,x2,ty[t])][calc(y1,y2,ty[t])]:=1;
      rec:=f[t][x][y]=1;
    end;

begin
  //assign(input,'input.txt');reset(input);
  //assign(output,'output.txt');rewrite(output);
  readln(n);
  readln(s);
  for i:=1 to length(s)do begin
    if (s[i]='(')or(s[i]in['0','1','?'])then begin
      inc(kq);
      inc(kst);
      st[kst]:=i+1;
      nom[kst]:=kq;
      sl[kq]:=i;
    end;
    if (s[i]=')')or(s[i]in['0','1','?'])then begin
      yy:=nom[kst];
      sr[nom[kst]]:=i;
      dec(kst);
      xx:=nom[kst];
      inc(kg[xx]);
      g[xx][kg[xx]]:=yy;
    end;
    if (s[i] in ['&','|','^'])then ty[nom[kst]]:=s[i];
  end;
  fillchar(f,sizeof(f),$FF);
  if (rec(1,0,1))or
     (rec(1,1,0))
       then writeln('YES')
       else writeln('NO');
end.


var
   a,s : longint;
begin
     read(s);
     if s = 0 then
     begin
          writeln('1');
          exit;
     end
     else if s = 1 then
     begin
          writeln('8');
          exit;
     end
     else if s = 2 then
     begin
          writeln('4');
          exit;
     end
     else if s = 3 then
     begin
          writeln('2');
          exit;
     end
     else if s = 4 then
     begin
          writeln('6');
          exit;
     end
     else if (s mod 4) = 0 then
     begin
          writeln('6');
          exit;
     end
     else if (s mod 4) = 1 then
     begin
          writeln('8');
          exit;
     end
     else if (s mod 4) = 2 then
     begin
          writeln('4');
          exit;
     end
     else if (s mod 4) = 3 then
     begin
          writeln('2');
          exit;
     end;
end.


var i,a,b,c,n,pl,mn:integer;
begin

i:=0;a:=0;b:=0;c:=0;n:=0;pl:=0;mn:=0;
read(n);
for i:=1 to n do
begin
read(a); if a>0 then b+=1;if a<0 then c+=1;
end;
if b>0 then if (n-b)<= b then begin write(1);pl:=1;end;
if (c>0) and (pl=0) then if (n-c)<=c then begin write(-1);mn:=1;end;
if (pl+mn)=0 then write(0);
end.


var n,x,y:int64;
begin
  readln(n);
  read(x,y);
  if (x+y)<=(n+1) then writeln('White') else writeln('Black');
end.


var f1:text;n,res,i:longint;s:string;
function lt2(k:longint):longint;
var m:longint;
begin
        if k=0 then exit(1);
        m:=lt2(k div 2);
        if k mod 2=0 then lt2:=m*m else lt2:=m*m*2;
end;
function biendoi(a:string):longint;
var ii,ress:longint;
begin
        ress:=0;
        for ii:=n downto 1 do
        if s[ii]='1' then ress:=ress+lt2(n-ii);
        exit(ress);
end;
begin
        assign(f1,'');reset(f1);
        readln(f1,s);
        n:=length(s);
        for i:=1 to n-1 do
        res:=res+lt2(i);
        for i:=1 to n do if s[i]='4' then s[i]:='0' else s[i]:='1';
        write(res+biendoi(s)+1);
end.


{
   255A.pas

   Copyright 2014 Adzka <adzka@adzka-AOD270>

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
   MA 02110-1301, USA.

}

var
	n,a,x,chest,biceps,back:longint;

begin
	readln(n);
	for a:=1 to n do begin
		read(x);
		if a mod 3=1 then inc(chest,x)
		else if a mod 3=2 then inc(biceps,x)
		else if a mod 3=0 then inc(back,x);
	end;
	readln;
	if (chest>biceps) and (chest>back) then writeln('chest')
	else if (biceps>chest) and (biceps>back) then writeln('biceps')
	else writeln('back');
end.


var x, i, j: longint;
begin
        readln(x);
        x := abs(x);
        while (j < x) or ((j - x) mod 2 = 1) do
        begin
                inc(i);
                j := j + i;
        end;
        writeln(i);
end.


var a:array[1..100000] of longint;
n,m,q,k,w:int64;
i,j:longint;
s,s1:string;
ch:char;
	begin
	readln(k);
	readln(m);
	readln(q);
	readln(w);
	readln(n);
	j:=1;
	while j*k<=n do
		begin
		a[j*k]:=1;
		inc(j);
		end;
	j:=1;
	while j*m<=n do
		begin
		a[j*m]:=1;
		inc(j);
		end;
	j:=1;
	while j*q<=n do
		begin
		a[j*q]:=1;
		inc(j);
		end;
	j:=1;
	while j*w<=n do
		begin
		a[j*w]:=1;
		inc(j);
		end;
	j:=0;
	for i:=1 to n do
	if a[i]=1 then inc(j);
	write(j);
	end.


var
	n, m, a : integer;
begin
	read(n, m);
	if (n > m) then
		a := m
	else
		a := n;
	if (a mod 2 = 0) then
		writeln('Malvika')
	else
		writeln('Akshat');

end.


program p1 ;
var a,b,n,m:int64;i,j,k,c,r:real;
begin
readln (n,m,a,b);
if n mod m =0 then r:=0;
if n mod m <>0 then
begin
 c:=int(n/m);
i:=abs((c*m-n))*b;
j:=((c+1)*m-n)*a;
if i>j then r:=j else r:=i;
end;
writeln (r);
end.


var
l,r,n,k,mid,j,i,z,ma:integer;
begin
read (n,k);
r:=n;
while l<=r do begin
mid:=(l+r) div 2;
if z+k<=240 then begin
 if mid>ma then begin
  for i:=ma+1 to mid do begin
 inc (z,i*5);
  if z+k>240 then begin write (i-1);halt  end;
 ma:=mid;
 end;end;
 l:=mid+1 ;
 end;

if z+k>240 then
r:=mid-1;
end;
write (ma);end.


var
  n,i,ans,max:longint;
  ch:char;
  a:array['a'..'z']of longint;
begin
  readln(n);
  for i:=1 to n do
    begin
      read(ch);
      if ch in['A'..'Z'] then
        begin
          fillchar(a,sizeof(a),0);
          if ans>max then
            max:=ans;
          ans:=0;
        end else
        begin
          if a[ch]=0 then
            begin
              a[ch]:=1;
              inc(ans);
            end;
        end;
    end;
  if ans>max then
    max:=ans;
  writeln(max);
end.


const
   fin='a210062016.inp';fon='a210062016.out';
var n,t:qword;
procedure solve;
begin
readln(n);
if n mod 2 = 1 then write((n-1) div 2)
else
   begin
   t:=1;
   while t*2<=n do
      t:=t*2;
   write((n-t) div 2);
   end;
end;

begin
//assign(input,fin);reset(input);
//assign(output,fon);rewrite(output);
solve;
end.


uses math;
type mass=array[1..2000,0..2000] of integer;
     mahh=array[1..2000] of boolean;
     maxx=array[1..2000] of integer;
var m:mass;m1:mahh;
    m2:maxx;u:boolean;i:integer;n,num,j,k,c,t,z,max1,a,b:integer;
procedure dfs(x:integer);
var i:integer;
Begin
   for i:=1 to n do
      if (m[x,i]=1) and (m1[i])
      then Begin
              m1[i]:=false;
              inc(num);
              m2[num]:=i;
              dfs(i);
           end;
end;
begin
 //  assign(input,'input.txt');
 //  assign(output,'output.txt');
   fillchar(m,sizeof(m),0);
   readln(n);
   readln(k);
   for i:=1 to k do
      Begin
         readln(a,b);
         m[a,b]:=1;
         m[b,a]:=1;
      end;
   readln(k);
   for i:=1 to k do
      Begin
         readln(a,b);
         m[a,b]:=-1;
         m[b,a]:=-1;
      end;
   fillchar(m1,sizeof(m1),true);
   max1:=0;
   for i:=1 to n do
      if m1[i]
      then Begin
               u:=true;
               num:=1;
               m1[i]:=false;
               m2[1]:=i;
               dfs(i);
               for z:=1 to num do
                  for j:=z+1 to num do
                     if m[m2[z],m2[j]]=-1
                     then Begin
                            u:=false;
                            break;
                          end;
               if u
               then max1:=max(max1,num);
           end;
   writeln(max1);
end.


const p=200;
const md=1000000007;

var x:int64;
    i,j,k,k1,k2,n,i1,i2,j1,j2:longint;
    v:array[0..201,0..51,0..51] of int64;
    w:array[0..201,0..51,0..51] of longint;
    c:array[0..51,0..51] of int64;

 begin
  read(n,k);
  for i:=1 to n do
   begin
    read(x);
    if x=50 then inc(k1)
            else inc(k2);
   end;

  c[0,0]:=1;
  for i:=1 to n do
   begin
    c[i,0]:=1;
    for j:=1 to n do
     c[i,j]:=(c[i-1,j]+c[i-1,j-1]) mod md;
   end;

  v[0,k1,k2]:=1;
  w[0,k1,k2]:=1;
  for i:=0 to p do
   begin
    if (i mod 2=1) and
       (w[i,0,0]=1) then begin
                          writeln(i);writeln(v[i,0,0]);halt;
                         end;

    for i1:=0 to k1 do
     for i2:=0 to k2 do
      begin
       if w[i,i1,i2]=0 then continue;

       if i mod 2=0 then begin
                          for j1:=0 to i1 do
                           for j2:=0 to i2 do
                            begin
                             if (50*j1+100*j2>k) then continue;
                             if (j1+j2=0) then continue;
                             w[i+1,i1-j1,i2-j2]:=1;

                             x:=c[i1,j1]*c[i2,j2] mod md;
                             x:=v[i,i1,i2]*x mod md;

                             v[i+1,i1-j1,i2-j2]:=(v[i+1,i1-j1,i2-j2]+x) mod md;
                            end;
                         end
                    else begin
                          for j1:=0 to (k1-i1) do
                           for j2:=0 to (k2-i2) do
                            begin
                             if (50*j1+100*j2>k) then continue;
                             if (j1+j2=0) then continue;

                             w[i+1,i1+j1,i2+j2]:=1;
                             x:=c[k1-i1,j1]*c[k2-i2,j2] mod md;
                             x:=v[i,i1,i2]*x mod md;

                             v[i+1,i1+j1,i2+j2]:=(v[i+1,i1+j1,i2+j2]+x) mod md;
                            end;
                         end;
      end;

   end;

  writeln(-1);
  writeln(0);
 end.


uses
Math;

var
  n, w, h: Int32;

begin
  ReadLn(n);
  w := ceil(sqrt(n));
  h := ceil(n / w);

  WriteLn(w + h);
  ReadLn;
end.


Var dp:array[0..1000000,0..1] of int64;
n,k,d,ans,md:int64;
i,j,next,ok:longint;
begin
 read(n,k,d);
 dp[0][0]:=1;
 md:=1000000007;
  for i:=0 to n do
   begin
    for next:=1 to k do
     for j:=0 to 1 do
      begin
       if(next+i>n) then continue;
       ok:=j;
       if(next>=d)then ok:=1;
        dp[i+next][ok]:=(dp[i+next][ok]+dp[i][j])mod md;
      end;
   end;
  ans:=dp[n][1];
  writeln(ans);
end.


var
  l1, l2, r1, r2, t1, t2, d1, d2, ans1, ans2, nd: integer;

function nod(a, b: integer): integer;
begin
  if a > b then swap(a, b);
  while (a <> 0) do
  begin
    b := b mod a;
    swap(a, b)
  end;
  result := b;
end;

begin
  read(l1, r1, t1, l2, r2, t2);

  nd := nod(t1, t2);
  d1 := r1 - l1 + 1;
  d2 := r2 - l2 + 1;
  l1 := l1 mod nd;
  l2 := l2 mod nd;
  r1 := l1 + d1 - 1;
  r2 := l2 + d2 - 1;
  if l1 > l2 then begin
    swap(l1, l2);
    swap(r1, r2);
    swap(t1, t2);
    swap(d1, d2);
  end;
  ans1 := max(min(r1, r2) - max(l1, l2) + 1, 0);
  inc(l1, nd);
  inc(r1, nd);
  ans2 := max(min(r1, r2) - max(l1, l2) + 1, 0);
  writeln(max(ans1, ans2));
end.


program B;

var
  p, x, y, i, t, k: longint;

function ok(t: longint): boolean;
var
  ii, j: longint;
begin
  j := (t div 50) mod 475;
  for ii := 1 to 25 do begin
    j := (j * 96 + 42) mod 475;
    if p = (j + 26) then begin
      result := true;
      exit;
    end;

  end;
  result := false;
end;

begin
  read(p, x, y);
  k := (x - y) div 50;
  for i := k downto 0 do begin
    t := x - i * 50;
    if ok(t) then begin
      write('0');
      halt;
    end;
  end;

  i := 1;
  while true do begin
    t := x + i * 50;
    if ok(t) then begin
      write((i + 1) div 2);
      halt;
    end;
    inc(i);
  end;
end.


const tfi = '';
tfo = '';
var fi,fo: text;
s: string[20];
a,i: longint;
procedure ghif;
begin
assign(fi, tfi);
reset(fi);
assign(fo, tfo);
rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure xuly;
begin
read(fi,s);
for i:=length(s) downto 1 do
    begin
        if s[i]='0' then delete(s,i,1)
        else break;
    end;
a:=length(s);
for i:=1 to length(s) do
        begin
                if s[i]<>s[a] then
                begin
                write(fo, 'NO');
                exit;
                end;
                dec(a);
                end;
                write(fo, 'YES');

        end;

begin
ghif;
xuly;
closef;
end.


const fi='';//63e.inp';
      fo='';//63e.out';
      d:array[1..3] of integer=(0,1,1);
      c:array[1..3] of integer=(1,1,0);
      l='Lillebror';
      kk='Karlsson';

var f1:array[0..1 shl 19-1] of longint;
    a:array[0..6,0..6] of longint;
    s:Array[1..5,1..5] of char;
    st:longint;
    f:text;

procedure nhap;
var i,j,m:longint;  ch:char;
begin
     assign(f,fi); reset(f);
     st:=0;
     for i:=1 to 5 do
          for j:=1 to 5 do s[i,j]:='.';
     st:=0;  m:=0;
     for i:=1 to 5 do
     begin
     while not eoln(f) do
     begin
          read(f,ch);
          if ch<>' ' then inc(m);
          if ch='O' then st:=st or (1 shl (m-1));
     end;
          readln(f);
     end;
     close(f);
end;

procedure khoitao;
var i,j:longint;
begin
     fillchar(a,sizeof(a),255);
     a[1,1]:=1; a[1,2]:=2; a[1,3]:=3; a[1,4]:=-1; a[1,5]:=-1;
     a[2,1]:=4; a[2,2]:=5; a[2,3]:=6; a[2,4]:=7; a[2,5]:=-1;
     a[3,1]:=8; a[3,2]:=9; a[3,3]:=10; a[3,4]:=11; a[3,5]:=12;
     a[4,1]:=-1; a[4,2]:=13; a[4,3]:=14; a[4,4]:=15; a[4,5]:=16;
     a[5,1]:=-1; a[5,2]:=-1; a[5,3]:=17; a[5,4]:=18; a[5,5]:=19;
end;

function game(u:longint):longint;
var i,j,k,v,d1,c1,d2,c2:longint;
    dau:array[0..2] of longint;
begin
     if f1[u]<>-1 then exit(f1[u]);
     if u=0 then
     begin
          f1[u]:=0;
          exit(f1[u]);
     end;
     dau[0]:=0;  dau[1]:=0;
     for i:=0 to 18  do
     begin
          if u and (1 shl i)<>0 then
          begin
               for j:=1 to 5 do
                    for k:=1 to 5 do if a[j,k]=i+1 then
                    begin
                         c1:=j; d1:=k;
                    end;
               v:=u xor (1 shl i);
               dau[game(v)]:=1;
               for j:=1 to 3 do
               begin
                    d2:=d1; c2:=c1;
                    v:=u xor (1 shl i);
                    while (a[c2+c[j],d2+d[j]]<>-1) and (v and (1 shl (a[c2+c[j],d2+d[j]]-1))<>0) do
                    begin
                         c2:=c2+c[j]; d2:=d2+d[j];
                         //if v and (1 shl (a[c2,d2]-1))<>0 then
                         begin
                              v:=v xor (1 shl (a[c2,d2]-1));
                              dau[game(v)]:=1;
                         end;
                    end;
               end;
               //f1[u]:=0;
               //exit(f1[u]);
          end;
     end;
     if dau[0]=0 then f1[u]:=0 else f1[u]:=1;
     exit(f1[u]);
end;

procedure inkq;
var res:longint;
begin
     assign(f,fo); rewrite(f);
          fillchar(f1,sizeof(f1),255);
     res:=game(st);

     if res=0 then writeln(f,l) else writeln(f,kk);
     close(f);
end;

begin
     nhap;
     khoitao;

     inkq;
end.