let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}
function pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}
function highestOneBit(i) {
  i |= i >> 1;
  i |= i >> 2;
  i |= i >> 4;
  i |= i >> 8;
  i |= i >> 16;
  return i - (i >>> 1);
}

function main() {
  const arr = [];
  const permutations = [];
  function permutation(arr, len, store = "") {
    if (store.length === len) {
      permutations.push(store);
      return;
    }
    for (let i = 0; i < arr.length; i++) {
      const newArr = [...arr];
      const newChar = newArr.splice(i, 1);
      permutation(newArr, len, store.concat(newChar));
    }
  }

  permutation([1, 2, 3, 4, 5], 5);

  for (let i = 0; i < 5; i++) {
    const line = readLine()
      .split(" ")
      .map((n) => parseInt(n));
    arr.push(line);
  }

  let max = -Infinity;
  for (let value of permutations) {
    max = Math.max(max, calculate(value));
  }

  console.log(max);

  function calculate(str) {
    const [one, two, three, four, five] = [+str[0] - 1, +str[1] - 1, +str[2] - 1, +str[3] - 1, +str[4] - 1];
    return (
      arr[one][two] +
      arr[two][three] +
      arr[three][four] +
      arr[three][four] +
      arr[four][five] +
      arr[four][five] +
      arr[two][one] +
      arr[three][two] +
      arr[four][three] +
      arr[four][three] +
      arr[five][four] +
      arr[five][four]
    );
  }
}


var c = {};

function T(i, n) {
  if (i > n / 2) i = n - i;
  if (i === 0) return 1;
  if (c[i + '+' + n]) return c[i + '+' + n];
  if (i == 1) {
    return n;
  }
  var ans = 0;
  for (var j = 1; j < n; j++) {
    ans += T(i - 1, j);
  }
  return c[i + '+' + n] = ans;
}

print(function(n, m, t) {
  var a = [];
  for (var i = 1; i <= m; i++) {

    var j = t - i;

    if (j <= n && j >= 4) {
      a.push([T(i, m), T(j, n)]);
    }
  }

  var b = [];
  var x = 0;
  a.forEach(function(v){
  	if(v[0]>1e8||v[1]>1e8){
  		var xx=v[1].toString();
  		var j=xx.length-1;
  		for(var i=1; i<v[1]; i*=10){
  			b.push( v[0]*xx[j--]*i )
  		}
  	}else{
  		b.push(v[0]*v[1]);
  	}
  });

  return b.reduce(function(a,b){
  	//print(a,b)
  	a=a.toString();
  	b=b.toString();
  	var sum=[];
  	var i=a.length-1;
  	var j=b.length-1;
  	var c=0;
  	while(i>=0||j>=0){
  		var k= +(a[i]||0) +  +(b[j]||0) + c;
  		c=~~(k/10);
  		sum.push(k%10);
  		i--;
  		j--;
  	}
  	if(c>0){
	  	sum.push(c)
  	}
  	return sum.reverse().join('');
  });
}.apply(0, readline().split(' ').map(Number)));


process.stdin.resume()
process.stdin.setEncoding('utf-8')

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

process.stdin.on('end', () => {
  input = input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  const [u, v] = readInts()
  if(u > v || u % 2 !== v % 2)
    wr(-1)
  else if(u === 0 && v === 0) wr(0)
  else if(u === v && u !== 0) {
    wr(1)
    wr(u)
  }
  else {
    let x = (v - u) / 2
    if((x & u) === 0) {
      wr(2)
      wr(u + x, x)
    }
    else {
      wr(3)
      wr(u, x, x)
    }
  }
}


if (process.env.ANT)
{
    global.print = this.print ||
        function(){console.log([...arguments].join(' '))} ||
        require('lol-io').print;
    global.debug = function(){console.log('debug:', [...arguments].join(' '))}
    global.write = this.write || require('lol-io').write
    global.readline = this.readline || require('lol-io').readline
    main();
}
else
{
    const rl = require('readline').createInterface({ input: process.stdin,
        output: process.stdout });
    global.print = console.log
    global.debug = ()=>{};
    global.write = (...args) => {
        process.stdout.write(args.join(' '));
    }
    const lines = []
    rl.on('line', line =>{
        lines.push(line);
    });
    rl.on('close', main)
    let rli = 0;
    global.readline = ()=>lines[rli++];
}

///////////// CODE

function main(){
    let D = [];

    let s = readline();
    let t = readline();

    function test(i, m)
    {
        debug('test ', i, m)
        let is = 0, it = 0;
        if (is==i)
            is += m;
        while (it<t.length)
        {
            while (t[it]!=s[is] && is<s.length)
            {
                is++;
                if (is==i)
                    is += m;
            }
            if (is==s.length)
                return false;
            it++;
            is++;
            if (is==i)
                is += m;
        }
        return it==t.length;
    }

    function check(n){
        debug('check '+n)
        for (let i=0; i<s.length-n+1; i++)
        {
            if (test(i, n))
                return true;
        }
    }

    let l = 1, r = s.length-t.length;
    while (l+1<r)
    {
        let m = (l+r)/2|0;
        if (check(m))
            l = m;
        else
            r = m;
    }
    print(check(r) ? r : r-1);

}


function getInput() {
    var line = readline();
    var lines = [line];
    while (line = readline()) {
        lines.push(line);
    }
    return lines;
}

function main() {
    var lines = getInput().map(item => item.split(' '));
    var durationA = Number(lines[0][1]);
    var durationB = Number(lines[1][1]);
    var repeatB = Number(lines[1][0]);

    // first bus run at 5:00.
    var firstBusTime = 5 * 60;
    // start time in minutes.
    var startTime = lines[2][0].split(':').map(Number);
    // after 00
    if (startTime[0] < 5) {
        startTime[0] *= 24;
    }
    startTime = startTime[0] * 60 + startTime[1];

    var count = 0;
    var firstBBusTime = firstBusTime;
    while((firstBBusTime + durationB) < startTime) {
        firstBBusTime += repeatB;
    }

    while(firstBBusTime < (startTime + durationA)) {
        firstBBusTime += repeatB;
        count++;
    }

    print(count);
}

main();


function getInput() {
    var line = readline();
    var lines = [line];
    while (line = readline()) {
        lines.push(line);
    }
    return lines;
}

function main() {
    var lines = getInput().map(item => item.split(' '));
    var durationA = Number(lines[0][1]);
    var durationB = Number(lines[1][1]);
    var repeatB = Number(lines[1][0]);

    // first bus run at 5:00.
    var firstBusTime = 5 * 60;
    // start time in minutes.
    var startTime = lines[2][0].split(':').map(Number);
    startTime = startTime[0] * 60 + startTime[1];

    var x1 = startTime;
    var y1 = x1 + durationA;

    var count = 0;
    for (var x2 = firstBusTime; x2 < 24 * 60; x2 += repeatB) {
        var y2 = x2 + durationB;
        var x = Math.max(x1, x2);
        var y = Math.min(y1, y2);

        if (x < y) {
            count++;
        }
    }

    print(count);
}

main()


var nk = readline().split(" ").map(function(x) { return parseInt(x); });
var o = readline().split(" ").map(function(x) { return parseInt(x); });

var n = nk[0];
var k = nk[1];

var s = 0;
for (var i=0; i<n; i++)
    s += o[i];
s /= n;

var iter = 0;

while (Math.round(s) < k) {

    iter ++;

    s = 0;
    for (var i=0; i<n; i++)
        s += o[i];

    for (var i=0; i<iter; i++)
        s += k;

    s /= (n+iter);

}

print(iter);


var s = readline().split(' ');
var n = Number(s[0]), k = Number(s[1]);
var marks = readline().split(' ');

var sum = 0;
var count = 0;
for (var i=0; i<marks.length; i++) {
    sum += Number(marks[i]);
}

while (Math.round(sum/n) < k) {
    sum += k;
    n++;
    count++;
}

print(count);


const readline = require('readline').createInterface({
  input: process.stdin,
});

const getNumber = (k) => {
  let str = '';
  let i = 1;

  while (str.length < k) {
    str += i;
    i += 1;
  }

  return str[k - 1];
};

readline.on('line', (line) => {
  const k = Number(line);

  console.log(getNumber(k));
});


function gcd(a, b){
	if(!b){
		return a;
	}
	return gcd(b, a%b);
}
function e_gcd(a, b){
	if(a===0)
		return [0, 1];
	else{
		xy=e_gcd(b%a, a);
		return [xy[1]-Math.floor(b/a)*xy[0], xy[0]];
	}
}
var n=readline();
var a=parseInt(readline());
var b=parseInt(readline());
if(n%gcd(a, b)!==0){
	print("NO");
}
else{
	xy=e_gcd(a, b);
	x=xy[0];
	y=xy[1];
	x=x*n/gcd(a, b);
	y=y*n/gcd(a, b);
	if(x<0 && y>=0){
		var k=Math.ceil(Math.abs(x)*gcd(a, b)/b);
		x=x+k*b/gcd(a, b);
		y=y-k*a/gcd(a, b);
	}
	else{
		if(x>=0 && y<0){
			b = [a, a = b][0];
			y = [x, x = y][0];
			var k=Math.ceil(Math.abs(x)*gcd(a, b)/b);
			x=x+k*b/gcd(a, b);
			y=y-k*a/gcd(a, b);
			y = [x, x = y][0];
		}
	}
	if(x>=0 && y>=0){
		print("YES");
		print(x, y);
	}
	else{
		// print("NO");
		console.log("NO");
	}
}


const n = Number(readline());

print(Math.floor((n - 1) / 2));


var n = +readline();

    var i = 1;
    var j = n;
    var sum = 0;
    while (i < j) {
        sum += (i + j) % (n + 1);
        i++;
        if (i < j) {
            sum += (i + j) % (n + 1);
            j--;
        }
    }
    print(sum);


process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.split(/\n/);
    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
  const n = BigInt(readLine())
  let plus = 1n
  let minus = 1n
  const div = 1000000007n
  for (let i = 0n; i < n - 1n; i++) {
    plus *= (n - i)
    plus %= div
    minus *= 2n
    minus %= div
  }
  console.log((plus >= minus ? plus - minus : plus - minus + div).toString())
}


var len = parseInt(readline());
	var str = readline();
	var ans = 0, sum = 0;
	var s='', s1=[];
	var a=[];
	if(str.indexOf('B') < 0){
		print(0);
	}
	else if(str.indexOf('W') < 0){
		ans = len;
		print(1);
		print(ans);
	}
	else{
		var r = "W";
		s = str.replace(new RegExp(r, 'gm'),' ');
		var r1 = /\s+/g;
		s = s.replace(r1,' ');
		s1 = s.split(" ");
		var k = 0;
		for(var i = 0; i < s1.length; i++){
			if(s1[i] !== ""){
				a[k++] = s1[i].length;
			}
		}
		print(k);
		for(var j = 0; j < k; j++){
			print(a[j]+' ');
		}
	}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  let n = +d;
  let ans = 0;

  if (n <= 7) {
    ans++;
    console.log(ans);
    return;
  }

  if (n % 5 === 1) {
    ans += 3;
    n -= 6;
    ans += ans / 5;
    console.log(ans);
  }
  else {
    ans += Math.floor(n / 5);

    if (n % 5 !== 0) {
      ans++;
    }

    console.log(ans);
  }

  c++;
});


function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var n = parseInt(readline());
	var boxes = tokenizeIntegers(readline());
	boxes.sort(function(a, b) {
		return b-a;
	});

	for (var size = 1; size < n; ++size) {
		var piles = [];
		for (i = 0; i < size; ++i) {
			piles.push([]);
		}
		var feasible = true;
		for (i = 0; feasible && i < n; ++i) {
			var ix = i%size;
			var pile = piles[ix], height = pile.length;
			var okay = true;
			for (var j = 0; feasible && j < height; ++j) {
				if (pile[j] == height-1-j) {
					feasible = false;
				}
			}
			pile.push(boxes[i]);
		}
		if (feasible) {
			print(size);
			return;
		}
	}
	print(n);
}

main();


(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var input = rdArN();
    var n = input[0];
    var k = input[1];
    var A = rdArN();

    var M = {0: []};
    for (var i = 0; i < n; ++i) {
        var a = A[i];
        var pr = 0;
        while (a > 0) {
            if (!M[a]) {
                M[a] = [];
            }
            M[a].push(pr);

            a = (a >> 1);
            ++pr;
        }
        M[0].push(pr);
    }
    //prOb(M)
    //return;
    var res = Infinity;
    for (var key in M) {
        //print(key)
        var ar = M[key];
        //print(ar.length, k)
        if (ar.length >= k) {
            var fullPrice = 0;
            ar.sortLt();
            for (var i = 0; i < k; ++i) {
                fullPrice += ar[i];
            }
            res = Math.min(res, fullPrice);
        }
    }
    print(res);
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
const arr = [];

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  arr.push(d.split(' ').map(Number));

  c++;
});

rl.on('close', () => {
  let ans = 0;

  for (let i = 0; i < arr.length; i++) {
    for (let j = 0; j < arr.length; j++) {
      ans += arr[i][j];
    }
  }

  if (arr.length > 3) {
    ans -= arr[0][1];
    ans -= arr[0][arr.length - 2];
    ans -= arr[arr.length - 1][1];
    ans -= arr[arr.length - 1][arr.length - 2];
    ans -= arr[1][0];
    ans -= arr[1][arr.length - 1];
    ans -= arr[arr.length - 2][0];
    ans -= arr[arr.length - 2][arr.length - 1];
  }

  console.log(ans);
});


'use strict';

/*let input = `5
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1`.split('\n');
function print(output) {
	console.log(output);
}
function readline() {
	return input.shift();
}*/

//code

var n = Number(readline());
var matrix = [];
for (var i = 0; i < n; i++) {
	matrix.push(readline().split(' ').map(Number));
}
var sum = 0;
//main diag
for (var i = 0; i < n; i++) {
	sum += matrix[i][i];
}
//sec diag
for (var i = 0; i < n; i++) {
	sum += matrix[i][n - i - 1];
}
//mid row
for (var i = 0; i < n; i++) {
	sum += matrix[(n - 1) / 2][i];
}
//mid col
for (var i = 0; i < n; i++) {
	sum += matrix[i][(n - 1) / 2];
}
//sub
sum -= matrix[(n - 1) / 2][(n - 1) / 2] * 3;
print(sum);


readline();
var g = readline().split(" ").join().split("");
var arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
var count = 0;
for(i=0;i<g.length;i++){
    for(b=0;b<arr.length;b++){
        if(g[i] == arr[b]) count++;
    }
}
print(count);


function numCapitals(word) {
  var total = 0;
  for (var i = 0; i < word.length; i++) {
    if (/[A-Z]/.test(word[i])) {
      total++;
    }
  }
  return total;
}

function main() {
  var n = readline();
  var words = readline().split(' ');

  var max = words.reduce((max, curr) => {
    var count = numCapitals(curr);
    if (count > max) {
      return count;
    }
    return max;
  }, -1);

  print(max);
}

main();


(function() {
  var s = readline();

  if (s.length < 26) {
    print(-1);
    return 0;
  }

  const alph = 'abcdefghijklmnopqrstuvwxyz';

  var sIdx = 0;
  var resultString = '';

  for (var i = 0; i < alph.length; i++) {
    if (sIdx >= s.length) {
      print(-1);
      return 0;
    }

    var aLetter = alph[i];
    var searchNeeded = true;

    while (searchNeeded && sIdx < s.length) {
      var sLetter = s[sIdx];

      if (sLetter <= aLetter) {
        resultString += aLetter;
        searchNeeded = false;
      } else {
        resultString += sLetter;
      }

      sIdx++;
    }
  }

  for (var i = sIdx; i < s.length; i++) {
    resultString += s[i];
  }

  print(resultString);
  return 0;
})();


var booksNumber = readline();
var booksNumberLength = booksNumber.toString().length;
var booksDistinctNumber = 0;

function getDistinctNumber(booksNumber,booksNumberLength) {
    for (var index =booksNumberLength; index>0; index--) {
        booksDistinctNumber+=(booksNumber-(Math.pow(10,index-1)-1))*index;
        booksNumber=Math.pow(10,index-1)-1;

    }
    print(booksDistinctNumber);
}

getDistinctNumber(booksNumber,booksNumberLength);


/**
 * Created by Utilisateur on 25/03/2016.
 */

var h = readline().split(' '),
    h0 = h1 = parseInt(h[0]),
    h2 = parseInt(h[1]),
    ab = readline().split(' '),
    a = parseInt(ab[0]),
    b = parseInt(ab[1]),
    t = 14,
    d = 0

if (a<b || (a==b && (h1+8*a < h2))) {
  d = -1
} else {

  while (h1 < h2) {
    if (t >= 10 && t < 22) h1 += a
    else h1 -= b
    if (++t >= 24) {
      t = 0
      d++
    }
  }
}

print(d)


/**
 * Created by Utilisateur on 25/03/2016.
 */

var h = readline().split(' '),
    h0 = h1 = parseInt(h[0]),
    h2 = parseInt(h[1]),
    ab = readline().split(' '),
    a = parseInt(ab[0]),
    b = parseInt(ab[1]),
    t = 14,
    d = 0

while(h1 < h2) {
  if (t >= 10 && t < 10) h1 += a
  else h1 += b
  if (++t >= 24) {
    t = 0
    d++
    if (h1 <= h0) {
      d = -1
      break
    }
  }
}

print(d)


(function () {
    var line = readline(),
        n = parseInt(line[0]),
        m = parseInt(line[0]),
        array = readline().split(" "),
        buses = 1,
        i = 0,
        m1 = m;
    while (i < n) {
        m1 -= array[i];
        i++;
        if (m1 < 0) {
            i--;
            buses++;
            m1 = m;
        }
    }
    print(buses);
})();


var values = readline().split('').map((elements)=>{
	return parseInt(elements)
})
var circleDistance = 2*values[0]
var path = Math.ceil(Math.sqrt(
	(Math.pow(values[1] - values[3],2) + Math.pow(values[2] - values[4]),2)
	)/circleDistance)
print(path)


var n;
        var dp = new Array(120).fill(new Array(3).fill(-1));

        function solve (arr, ind, last){
            if(ind == n){
                return 0;
            }
            if(dp[ind][last] != -1)
                return dp[ind][last];
            var mn = 100000;
            mn = Math.min(mn, solve(arr, ind+1, 0)+1);
            if((arr[ind] == 1 || arr[ind] == 3) && last != 1){
                mn = Math.min(mn, solve(arr, ind+1, 1));
            }
            if((arr[ind] == 2 || arr[ind] == 3) && last != 2){
                mn = Math.min(mn, solve(arr, ind+1, 2));
            }
            dp[ind][last] = mn;
            return mn;
        }

        n = readline();
        var arr = readline().split(' ').map(Number);
        print(solve(arr, 0, 0));


var number = readline();
function isNiceDigit(curNumber) {
    var res = 0;
    while (curNumber > 0)
    {
     res += curNumber % 10
     curNumber = Math.floor(curNumber/10)
    }
    if (res == 10) return true;
    return false;
}

var i, enumerator;

for (i = 0, enumerator = 0; enumerator < parseInt(number,10); i++) {
    if (isNiceDigit(i)) enumerator++;
}

write(--i);


function sa(n ,moves){
    var positionX = 0;
    var positionY = 0;
    for(var i=0;i<n;i++){
        var move = moves[i].split(' ');
        var val = Number(move[0]);
        if(positionY > 0){
            return "NO"
        }
        if(positionY < -20000){
            return "NO"
        }
        if(positionY == 0){
            if(move[1] != "South"){
                return "NO"
            }
        }
        if(positionY == -20000){
            if(move[1] != "North"){
                return "NO"
            }
        }
        if(move[1] == "South"){
            positionY -= val
        } else if(move[1] == "East"){
            positionX -= val
        }else if(move[1] == "North"){
            positionY += val
        } else if(move[1] == "West"){
            positionX += val
        }
    }
if(positionY > 0){
            return "NO"
        }
        if(positionY < -20000){
            return "NO"
        }
    if(positionY == 0){
        return "YES";
    }

        return "NO"
}

var n = Number(readline());
var moves = [];
for(var i=0;i<n;i++){
    moves.push(readline())
}

print(sa(n, moves));


m=Number(readline()) ;
    arr=readline() ;
    ans="1"
   for(j=0;j<m;j++)
    {
        if(arr[j]=="0")
        {
          ans+="0"
        }

    }

print(ans);


var time = readline();
time = time.split(":");
time[0] = parseInt(time[0]);
time[1] = parseInt(time[1]);
if(time[0] >= 12){time[0] -= 12;}
print((time[0]*30+time[1]*0.5).toFixed(9) + " " + (time[1]*6).toFixed(9));


var n = Number(readline());
var k = 1, sum = 0;
while (sum < n - 1) {
    sum += k++;
}
print(n - sum);


var strN = readline(),
			numN = parseInt(strN);

		if(strN.indexOf('8') >= 0)	{
			print(10);
		} else	{
			for(var i = 1; i<=10; i++)	{
				var temp = numN + i;

				if(temp.toString().indexOf('8') >= 0)	{
					print(i);
					break;
				}
			}
		}


var x ;
 var n ,k,losers,dipl ,cert  ,sum , count ;

nextLine();
function nextLine(){
var x = readline()
if(x){
    Arr = x.split(" ").map(function(x) { return parseInt(x); })
    n= Arr[0]
    k = Arr[1]
    dipl = Math.floor((.5*n/(1+k)));
    cert=k*dipl ;
    var losers = n - cert - dipl ;
    sum = 0 ;
    console.log(dipl,cert,losers)
    print(dipl+' '+cert+' '+ losers)

    }
}


var x ;
 var n ,k,losers,dipl ,cert  ,sum , count ;

nextLine();
function nextLine(){
var x = readline()
if(x){
    Arr = x.split(" ").map(function(x) { return parseInt(x); })
    n= Arr[0]
    k = Arr[1]
    dipl = Math.floor((.5*n/(1+k)));
    cert=k*dipl ;
    var losers = n - cert - dipl ;
    sum = 0 ;
    print(dipl+' '+cert+' '+ losers)
    nextLine()
    }
}

// function readline(){
//     return '18 2'
// }


//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var x = one[0];
  var y = one[1];
  var z = one[2];
  one = nextIntArray();
  var a = one[0];
  var c = one[1];
  var b = one[2];
  if(a < x){
    myout("NO");
    return;
  }
  a -= x;
  if(a + c < y){
    myout("NO");
    return;
  }
  var ac = a + c;
  ac -= y;
  if(ac + b < z){
    myout("NO");
    return;
  }else{
    myout("YES");
    return;
  }
}


function fail(s){
	var n = s.length;
	for (var i = 1; i < n; ++i) {
		var j = F[i - 1];
		while (j > 0 && s[i] != s[j])
			j = F[j - 1];
		if (s[i] == s[j])  ++j;
		F[i] = j;
	}
}
function init(){
	dp = new Array(105);
	for(var i = 0; i < 105; i++) {
		dp[i] = new Array(105);
		for (var j = 0; j < 105; j++) {
			dp[i][j] = new Array(105);
			for (var k = 0; k < 105; k++)
				dp[i][j][k] = {x: -1, y: ""};
		}
	}
	F = new Array(105);
	for(var i = 0; i < 105; i++) F[i] = 0;
}
function clone(o){
	return JSON.parse(JSON.stringify(o));
}
function lcs(i, j, k){
	if(i >= n || j >= m) return {x: 0, y: ""};
	if(dp[i][j][k].x != -1) return clone(dp[i][j][k]);
	//console.log(i + " "+ j  + " " +k);
	var skipLeft = clone(lcs(i + 1, j, k)) , skipRight = clone(lcs(i, j + 1, k)), equal = {x:-1, y:""};
	if(s[i] == t[j]){
		var tempK = k;
		//console.log(i + " " + j + " "+ k + " HENA1");
		if(s[i] == v[k]){
			//console.log("HENA");
			tempK++;
		}
		else if(k > 0){
			//console.log("YALLAA " + tempK + " " + F[tempK - 1]);
			tempK = F[tempK - 1];
			while(tempK > 0 && v[tempK] != s[i]) tempK = F[tempK - 1];
			if(v[tempK] == s[i]) tempK++;
		}
		if(tempK != vv){
			equal = clone(lcs(i + 1, j + 1, tempK));
			equal.x++;
			//console.log(s[i] + " " + equal.y);
			equal.y = s[i] + equal.y;
			//console.log(equal.y);
		}
		//else console.log("HeeeeeeeeEEH");
	}
	var sols = [skipLeft, skipRight, equal]; sols.sort(function(a, b){return parseInt(b.x) - parseInt(a . x);});
	var sol = sols[0];
	//return sol;
	return (dp[i][j][k] = clone(sol));
}
var s = readline();
var t = readline();
var v = readline();
var n = s.length, m = t.length, vv = v.length, dp, F;
init();fail(v);
var soli = lcs(0, 0, 0);
if(soli.x == 0){
	print("0");
}
else print(soli.y);


var n = parseInt(readline());
var res = 1;
for (var i = 1; i <= n; i++) res *= i;
res /= n;
res /= (n / 2);
print(res);


var arr = [];
for (var i = 0; i < 4; i++) {
    for (var j = 0; j < 4; j++) {
        if (!arr[i]) {
            arr[i] = [];
        }
        arr[i][j] = readline();
    }
}

var testPosition = function(x, y) {
    if (x + 1 == 4 || y + 1 == 4) {
        return false;
    }
    if (arr[x][y] == arr[x][y + 1] && arr[x][y] == arr[x + 1][y] && arr[x][y] == arr[x + 1][y + 1]) {
        return true;
    }
    return false;
};

var testSquare = function() {
    for (var i = 0; i < 4; i++) {
        for (var j = 0; j < 4; j++) {
            if (testPosition(i, j)) {
                return true;
            }
        }
    }
};

var change = function(x, y) {
    if (x + 1 == 4 || y + 1 == 4) {
        return false;
    }
    var colors = {
        firstColor: {
            color: '',
            found: 0
        },
        secondColor: {
            color: '',
            found: 0
        }
    };
    colors.firstColor = arr[x][y];
    for (var ix = x; ix <= x + 1; ix++) {
        for (var jy = y; jy <= y + 1; jy++) {
            if (colors.firstColor === arr[ix][jy]) {
                colors.firstColor.found += 1;
            } else {
                if (colors.secondColor.color !== '')
                    colors.secondColor.color = arr[ix][jy];
                colors.secondColor.found += 1;
            }
        }
    }
    if (colors.secondColor.found === 1 || colors.firstColor.found === 1) {
        return true;
    }
    return false;
};

var testChange = function() {
    for (var i = 0; i < 4; i++) {
        for (var j = 0; j < 4; j++) {
            if (change(i, j)) {
                return true;
            }
        }
    }
};

for (var i = 0; i < 4; i++) {
    for (var j = 0; j < 4; j++) {
        write(arr[i][j]);
    }
    print()
}

if (testSquare()) {

    for (var i = 0; i < 4; i++) {
        for (var j = 0; j < 4; j++) {
            write(arr[i][j]);
        }
        print()
    }
    print('YES1');
} else {

    if (testChange()) {

        for (var i = 0; i < 4; i++) {
            for (var j = 0; j < 4; j++) {
                write(arr[i][j]);
            }
            print()
        }
        print('YES2');
    } else {
        print('NO');
    }
}


'use strict'
Object.defineProperty(exports, '__esModule', { value: !0 })
var os = require('os')
const stdin = process.stdin,
  stdout = process.stdout,
  integerRegex = /-?\d+/g,
  decimalRegex = /-?\d+(?:\.\d+)?/g
class InputAndOutput {
  lineIndex = 0
  lines = []
  dried() {
    return this.lineIndex >= this.lines.length
  }
  readLine() {
    const e = this.lines[this.lineIndex]
    return (this.lineIndex += 1), e
  }
  readIntegersOfLine() {
    const e = this.readLine().match(integerRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  readNumsOfLine() {
    const e = this.readLine().match(decimalRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  print(e) {
    stdout.write(e)
  }
  async init() {
    const e = await this.readLines()
    this.lines = e
  }
  readLines() {
    const e = []
    return new Promise(n => {
      stdin.on('data', n => e.push(n)),
        stdin.on('end', function () {
          const t = e.join('').split(os.EOL)
          n(t)
        })
    })
  }
}
async function __main__(e) {
  const n = new InputAndOutput()
  await n.init(), e(n)
}
const MOD = BigInt(1000000007),
  MAX_N = 200010,
  f = new Array(MAX_N)
function solve(e, n) {
  if (0 === n) return 1n
  const t = f[e - 1]
  let s = fastPower((t + MOD) % MOD, BigInt(n), MOD)
  if (0 == (1 & e)) return s
  let i = 1n
  for (let e = 1; e <= n; ++e) (s += i * f[n - e]), (i = (i * t) % MOD)
  return s
}
function fastPower(e, n, t) {
  let s = 1n
  for (let i = n, r = e; i > 0; i /= 2n, r = (r * r) % t)
    i % 2n === 1n && (s = (s * r) % t)
  return s
}
__main__(function (e) {
  f[0] = 1n
  for (let e = 1; e < MAX_N; ++e) f[e] = (2n * f[e - 1]) % MOD
  const n = Number(e.readLine())
  for (let t = 1; t <= n; ++t) {
    const [n, t] = e.readIntegersOfLine(),
      s = ((solve(n, t) % MOD) + MOD) % MOD
    e.print(s + '\n')
  }
})


const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
})

function main() {
    comparison(stdin[0],stdin[1])
}

var stdin = [];
rl.on('line', function (line) {stdin.push(line);});
rl.on('close', main);
/*
const main = async () => {
  await question1()
  rl.close()
}

main()
*/

function comparison(n, m) {
  var firstStr = String(n);
  if(String(n).length == 1 || String(m).length == 1){
      return n == m ? console.log("OK") : console.log("WRONG_ANSWER")
  }
  var result = '';
  var count = 0
  while( firstStr ) {
    var min = 999;
    for(var i = 0; i < firstStr.length; i++) {
      if(Number(firstStr[i] < min)) {
      	if(count == 0 && Number(firstStr[i]) == 0){
        } else {
        	min = firstStr[i]
        }
      }
  	}
    var index = firstStr.indexOf(min);
    result += firstStr.slice(index, index+1)
    firstStr = firstStr.slice(0, index) + firstStr.slice(index+1, firstStr.length)
    count ++
  }
  if(result == m) {
  	console.log("OK")
  } else {
  	console.log("WRONG_ANSWER")
  }
}


function ProblemSolver() {
    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;

    this.solveCase = function() {
        var res , i , j , l1 , l2 , a , fl , zz ;
        res = 0;
        l1 = this.s.length ;
        l2 = this.t.length ;
        j = 0 ;
        for( i = 0 ; i < l1 && j < l2 ; i++ ) {
            if( this.s[ i ] == this.t[ j ] ) {
                j++ ;
            }
        }
        if( j == l2 ) {
            res = 1 ;
        }
        for( i = 0 ; i < l1 ; i++ ) {
            a = this.s.charCodeAt( i ) - "a".charCodeAt( 0 ) ;
            this.arr[ a ]++ ;
        }
        for( i = 0 ; i < l2 ; i++ ) {
            a = this.t.charCodeAt( i ) - "a".charCodeAt( 0 ) ;
            this.brr[ a ]++ ;
        }
        fl = 1 ;
        zz = 0 ;
        for( i = 0 ; i < 26 ; i++ ) {
            if( this.arr[ i ] < this.brr[ i ] ) {
                fl = 0 ;
                break ;
            }
            if( this.arr[ i ] != this.brr[ i ] ) {
                zz = 1 ;
            }
        }
        if( zz == 1 && fl == 1 && res == 0 ) {
            res = 3 ;
        }
        else if( fl == 1 && res == 0 ) {
            res = 2 ;
        }
        if( res == 0 ) {
            print( "need tree" );
        }
        else if( res == 1 ) {
            print( "automaton" );
        }
        else if( res == 2 ) {
            print( "array" );
        }
        else {
            print( "both" );
        }
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.s = irObj.nextString();
            this.t = irObj.nextString();
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.arr = new Array();
        this.brr = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        this.clearArraysPerCase() ;
    };

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.done[ i ].push( 0 );
            }
        }
    };

    this.init();
}

function InputReader() {
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx;
        len = this.allLines[ this.currrentLineNumber ].length;
        if( flag == 0 ) {
            res = "";
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += this.allLines[ this.currrentLineNumber ][ i ];
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ][ i ] != ' ' ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = -1;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ][ i ] == ' ' ) {
                    endIdx = i;
                    break;
                }
                res += this.allLines[ this.currrentLineNumber ][ i ];
            }
            if( endIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            else {
                this.currrentCharacterIndex = endIdx;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCode = function() {
        var testCases , i , hasMoreTestCases , isLocal , localContext ;
        try {
            if( __dirname != null ) {
                isLocal = true;
            }
        }
        catch( ex ) {
            isLocal = false;
        }
        if( isLocal == true ) {
            print = console.log;
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
        }
        else {
            this.irObj.readAllLines();
        }
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.runCode();
}

new CodeExecutioner();


var x ;
 var Arr , c ,v0 ,v1 ,a ,l ,sum , count ;

nextLine();
function nextLine(){
var x = readLine()
if(x){
Arr = x.split(" ").map(function(x) { return parseInt(x); })
c= Arr[0]
v0 = Arr[1]
v1 = Arr[2]
a =Arr[3]
l = Arr[4]
sum = 0 ;
count=0 ;
sum = 0 ;
count = 0;

summer();
}
}

function summer (){
sum += (v0+count*a<v1)?v0+count*a:v1 ;
if(sum < c ){sum-= l ;count++; summer() }
else {print(count+1) ;nextLine() }

}


var tux = Number(readline());
var foo = 0;
var bar = 0;
var baz = 0;
var quz = 1;
while (tux--) {
  foo += Number(readline());
  bar++;
  if (foo * quz > bar * baz) {
    baz = foo;
    quz = bar;
  }
}
print(baz / quz);


function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var points = [], pointCounts = {};

	function point2key(x, y) {
		return [x, y].join(',');
	}

	function key2point(s) {
		var xy = s.split(',');
		return { x: xy[0], y: xy[1] };
	}

	function addPoint(x, y) {
		var key = point2key(x, y);
		if (pointCounts[key] === undefined) {
			points.push(key);
			pointCounts[key] = 1;
		}
		else {
			pointCounts[key] += 1;
		}
	}

	for (var i = 0; i < 4; i += 1) {
		var integers = tokenizeIntegers(readline());
		addPoint(integers[0], integers[1]);
		addPoint(integers[2], integers[3]);
	}

	for (var i = 0; i < points.length; i += 1) {
		if (pointCounts[points[i]] != 2) {
			print("NO");
			return;
		}
		points[i] = key2point(points[i]);
	}

	var invert = new Array(4);
	var okay = false;

	function go(count) {
		if (count == 4) {
			var a = points[invert[0]], b = points[invert[1]],
				c = points[invert[2]], d = points[invert[3]];
			if (a.x == b.x && a.y != b.y && c.x == d.x && c.y != d.y &&
					a.y == d.y && a.x != d.x && b.y == c.y && b.x != c.x) {
				okay = true;
			}
		}
		else {
			for (var i = 0; i < 4; i += 1) {
				if (invert[i] === undefined) {
					invert[i] = count;
					go(count+1);
					invert[i] = undefined;
				}
			}
		}
	}

	go(0);
	print(okay ? "YES" : "NO");
}

main();


var temp = readline().split(" ").map(Number);
var i = 0;
var check = false;
while(temp[0]*i<=temp[2]){
    if((temp[2]-temp[0]*i)%temp[1]==0){
        check=true;
    }
    i++;
}
print(check ==true?"Yes":"No")