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++];
}

function main() {
	const position = readLine().split('');
	let counter = 1,
		{ length } = position,
		dangerous = false,
		currentPlayer = position[0];

	for (let i = 1; i < length; ++i) {
		if (position[i] === currentPlayer) {
			counter++;
		} else {
			counter = 1;
			currentPlayer = position[i];
		}

		if (counter >= 7) {
			dangerous = true;
			break;
		}
	}

	dangerous ? console.log('YES') : console.log('NO');
}


function main(input) {

    let [limak, bob] = input.split(' ');
    [limak, bob] = [parseInt(limak), parseInt(bob)];
    let counter = 0;
    while(true){
        if(limak > bob) {
            console.log(counter);
            return;
        }
        else {
            limak = 3 * limak;
            bob = 2 * bob;
            counter++;
        }
    }

}

function getBaseLog(a, b) {
    return Math.log(b) / Math.log(a)
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});


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

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    [yH, bH] = d.split(' ').map(Number);
    return;
  }

  const [y, g, b] = d.split(' ').map(Number);

  const yellow = y * 2 + g;
  const blue = b * 3 + g;
  const ans = Math.max(0, yellow - yH) + Math.max(0, blue - bH);

  console.log(ans);

  c++;
});


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++];
}

function main() {
	const a = readLine() >> 0;
	const b = readLine() >> 0;
	const c = readLine() >> 0;

	let values = [];
	values.push(a + b + c);
	values.push(a * (b + c));
	values.push(a * b + c);
	values.push((a + b) * c);
	values.push(a + b * c);
	values.push(a * b * c);

	console.log(Math.max(...values));
}


//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');} function nextDoubleArray(size){return nextArray(size, 'double');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());} function nextDouble(){return parseFloat(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
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';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//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 t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var set = new Set();
		for(var i = 1; i * i <= N; i++){
			if(i * i * i <= N){
				set.add(i * i * i);
			}
			set.add(i * i);
		}
		myout(set.size);
	}
}


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

let l = 0;
rl.on('line', (input) => {
    rl.close();
    let inp = input.split(" ").map(x => parseInt(x))
    let ct = 0
    let s = inp[1]
    for (let i = inp[0]; i >= 0 && s > 0; i--) {
        ct += Math.floor(s / i)
        s = s - i * Math.floor(s / i)
    }
    console.log(ct)
    return 0;
});


const readline = require('readline');

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

rl.on("line", (line) => {
    var n = parseInt(line);
    if (n % 2 == 1) console.log(0);
    else {
        console.log(Math.pow(2, n/2));
    }
    rl.close();
});


'use strict';

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

let inputString = '',
    currentLine = 0;

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

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

const readline = () => {
    return inputString[currentLine++];
};

//////////

const main = () => {
    const [n, m, a] = readline().split(' ').map(x => parseInt(x));

    console.log(Math.ceil(n / a) * Math.ceil(m / a));
}


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

let l = 0;
rl.on('line', (input) => {
    if (l === 0) { l++ }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        let cnt = 0
        let max = 0
        for (let i = 1; i < arr.length; i++) {
            if (arr[i]===arr[i-1]+1) {
                cnt++
                if(i===1 && arr[i-1]===1){
                    cnt++
                }
                if(i+1<arr.length&&arr[i]+1!==arr[i+1]){
                    cnt--
                }
                if(i===arr.length-1 && arr[i]!==1000){
                    cnt--
                }
                if(cnt>max){
                    max=cnt
                }
            } else {
                cnt=0
            }
        }
        console.log(max)
        return 0;
    }
})


const readline = require("readline");

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

var answer = 0;
var counter = 0;
var check = true;

rl.on("line", input => {

      let temp = input.match(/B/g);

      counter =(temp!=null)? temp.length : 0;

    if (counter == 8) {
      answer++;
    }
    else if (check && counter > 0) {
      answer += counter;
      check = false;
    }

}).on("close", () => {
    console.log(answer);
  });


let buffer = '';
process.stdin.on('data', c => buffer += c);
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = buffer.split(EOL);
  lines.pop();

  main(lines);
});

function main(lines) {
  let index = 0;
  let T = Number(lines[index++]);
  let N;

  while (T--) {
    N = Number(lines[index++]);
    solve(N);
  }
}

function solve(N) {
  const seen = new Set();
  let result = 1;
  let sqrtN = Math.floor(Math.sqrt(N));
  let a, b;

  for (let n = 2; n <= sqrtN; ++n) {
    a = n ** 2;
    b = n ** 3;

    if (a <= N && !seen.has(a)) {
      result++;
      seen.add(a);
    }

    if (b <= N && !seen.has(b)) {
      result++;
      seen.add(b);
    }
  }

  console.log(result);
}


//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 N = nextInt();
	if(N <= 2){
		myout(N);
	}else{
		myout(1);
	}
}


'use strict';

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function main() {
    let x = parseInt(readLine());
    if (x % 5 == 0) {
        console.log(x / 5);
    } else {
        console.log(Math.floor(x / 5) + 1);
    }
}


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

rl.on('line', function(line) {
	chatRoom(line);
	rl.close();
});

//M N
let chatRoom = (input) => {
	//hello
	let word = [ 'h', 'e', 'l', 'l', 'o' ];
	let count = 0;
	for (let i = 0; i < input.length; i++) {
		if (input.charAt(i) === word[count]) {
			count++;
		}
	}
	count === 5 ? console.log('YES') : console.log('NO');
};


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}

function main() {
    let brain = readLine();
    while (brain.includes('>')) {
        brain = brain.replace('>', '1000');
    }
    while (brain.includes('<')) {
        brain = brain.replace('<', '1001');
    }
    while (brain.includes('+')) {
        brain = brain.replace('+', '1010');
    }
    while (brain.includes('-')) {
        brain = brain.replace('-', '1011');
    }
    while (brain.includes('.')) {
        brain = brain.replace('.', '1100');
    }
    while (brain.includes(',')) {
        brain = brain.replace(',', '1101');
    }
    while (brain.includes('[')) {
        brain = brain.replace('[', '1110');
    }
    while (brain.includes(']')) {
        brain = brain.replace(']', '1111');
    }
    let ans = convertBase(brain, 2, 10);

    let final = 0;
    let length = ans.length;
    for (let i = 0; i < length; i++) {
        final = (final * 10 + (ans[i] - 0)) % 1000003;
    }
    console.log(final);
}

function parseBigInt(bigint, base) {
    //convert bigint string to array of digit values
    for (var values = [], i = 0; i < bigint.length; i++) {
        values[i] = parseInt(bigint.charAt(i), base);
    }
    return values;
}

function formatBigInt(values, base) {
    //convert array of digit values to bigint string
    for (var bigint = '', i = 0; i < values.length; i++) {
        bigint += values[i].toString(base);
    }
    return bigint;
}

function convertBase(bigint, inputBase, outputBase) {
    //takes a bigint string and converts to different base
    var inputValues = parseBigInt(bigint, inputBase),
        outputValues = [], //output array, little-endian/lsd order
        remainder,
        len = inputValues.length,
        pos = 0,
        i;
    while (pos < len) {
        //while digits left in input array
        remainder = 0; //set remainder to 0
        for (i = pos; i < len; i++) {
            //long integer division of input values divided by output base
            //remainder is added to output array
            remainder = inputValues[i] + remainder * inputBase;
            inputValues[i] = Math.floor(remainder / outputBase);
            remainder -= inputValues[i] * outputBase;
            if (inputValues[i] == 0 && i == pos) {
                pos++;
            }
        }
        outputValues.push(remainder);
    }
    outputValues.reverse(); //transform to big-endian/msd order
    return formatBigInt(outputValues, outputBase);
}


//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");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return 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 k = one[0];
  var r = one[1];
  var count = 1;
  while(true){
    if(k * count % 10 == r || k * count % 10 == 0){
      break;
    }
    count++;
  }
  myout(count);
}


let inputString = '';
let currentLine = 0;

const runMain = () => {
  inputString = inputString.trim().split('\n').map(string => string.trim());
  main();
  process.exit();
}
const readLine = () => inputString[currentLine++];

process.stdin.on('data', inputStdin => inputString += inputStdin);
process.stdin.on('end', runMain);
process.on('SIGINT', runMain);

function main() {
  const n = readLine();
  const str1 = readLine();
  let pred = '';
  let str2 = '';
  for (let i = 0; i < n; i++) {
    if (str1[i] !== pred) {
      str2 += str1[i];
      pred = str1[i];
    }
  }
  console.log(str1.length - str2.length);
}


'use strict';

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.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

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

function print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // input
  const n = readline();
  const colors = readline();
  let pre;
  let result = 0;
  for (let i = 0; i < n; i++) {
    const c = colors.charAt(i);
    if (pre === c) {
      result++;
    } else {
      pre = c;
    }
  }
  // output
  print(result);
}


const readLine = require('readline')

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

const input = []

rl.on('line', line => input.push(line.toString().split(' ').map(Number)))

rl.on('close', () => {
  const [[w]] = input
  console.log(['NO', 'YES'][Number((w - 2) % 2 === 0 && w > 3)])
})


//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');} function nextDoubleArray(size){return nextArray(size, 'double');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());} function nextDouble(){return parseFloat(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
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';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//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 t = nextInt();
	while(hasNext()){
		var N = nextInt();
		myout((1 << N) - 1);
	}
}


function main() {
    var num = stdin[0].split(' ');
    var n = parseInt(num[0]);
    var m = parseInt(num[1]);
    var a = parseInt(num[2]);
    var na = (n - n % a) / a;
    var ma = (m - m % a) / a;
    if (na * a < n) na = na + 1;
    if (ma * a < m) ma = ma + 1;
    console.log(na * ma);
}

const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var stdin = [];
rl.on('line', function (line) {stdin.push(line);});
rl.on('close', main)


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

rl.on('line', (d) => {
  let n = +d;
  const letters = ['D', 'A', 'C', 'B'];
  let best = n % 4;
  let idx = 0;

  for (let i = 0; i <= 2; i++) {
    const current = (n + i) % 4;
    const prevBest = best;

    if (current === 1) {
      idx = i;
      best = current;
      break;
    }

    best = Math.max(best, current);

    if (prevBest !== best) {
      idx = i;
    }
  }

  console.log(idx, letters[best]);
});


let input = [];

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

RL.on('line', (line) => {
    input.push(line);
});

RL.on('close', () => {
    let n = parseInt(input[0]);
    let num = []; input[1].split(' ').forEach(i => num.push(parseInt(i)));

    let max = 0, count = 0;
    for(let i = 0; i < n; i++){
        for(let j = i; j < n; j++)
            if(num[i] === num[j])
                count++;
        if(max < count)
            max = count;
        count = 0;
    }
    console.log(max);
});


'use strict';

const fs = require('fs');

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function readInt(s) {
    return parseInt(s, 10);
}

function readIntArray(a) {

    return a.map(e => parseInt(e, 10));
}

function solve(n) {
    let a = [0, 1, 2, 0, 2, 1, 0];
    let max = 0;
    for (let i = 0; i < 7; i++) {
        let korm = n.slice(0);
        let days = 0;
        let ok = true;
        for (let j = i; j < 7; j++) {
            if (korm[a[j]] > 0) {
                korm[a[j]]--;
                days++;
            } else {
                ok = false;
                break;
            }
        }
        if (!ok) {
            if (days > max) max = days;
            continue;
        }
        let weeks = Math.min(Math.floor(korm[0] / 3), Math.floor(korm[1] / 2), Math.floor(korm[2] / 2));
        days += weeks * 7;
        korm[0] -= 3 * weeks;
        korm[1] -= 2 * weeks;
        korm[2] -= 2 * weeks;
        for (let j = 0; j < 7; j++) {
            if (korm[a[j]] > 0) {
                korm[a[j]]--;
                days++;
            } else {
                break;
            }
        }
        if (days > max) max = days;
    }
    return max;
}

function main() {

    const a = readIntArray(readLine());
    let result = solve(a);
    console.log(result);
}


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    if(lines[0] % 2 === 0 && lines[0] > 2) {
      console.log("YES")
    }  else {
      console.log("NO");
    }
})


let stdin = process.stdin;
stdin.setEncoding('utf8');
stdin.on('data', function (data) {
    let input = data.split('\n');
    console.log(solution(input[0]));
});

// End of interface

const solution = (n) => {
	let res = 0;
	for (let i=1; i<n; i++){
		if (n % i === 0){
			res++;
		}
	}
	return res;
};


function main() {
    let line = stdin[0].split(' ');
    let n = parseInt(line[0], 10);
    let p = parseInt(line[1], 10);
    let k = parseInt(line[2], 10);

    const lo = Math.max(p - k, 1);
    const hi = Math.min(p + k, n);

    let str = [];

    if (lo !== 1) str.push("<<")

    for (let i = lo; i <= hi; ++i) {
       if (i === p) {
         str.push(`(${i})`);
       } else {
         str.push(i + '')
       }
    }

    if (hi !== n) str.push(">>")

    console.log(str.join(' '));
}

const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var stdin = [];
rl.on('line', function (line) {stdin.push(line);});
rl.on('close', main);


//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');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
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 n = one[0];
  var m = one[1];
  var output = 0;
  for(var i = 0; i <= n; i++){
    for(var j = 0; j <= m; j++){
      if(i * i + j == n && i + j * j == m){
        output++;
      }
    }
  }
  myout(output);
}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
var n,m,a;
rl.on('line', (line) => {
  [n,m,a]=line.split(' ');
}).on('close',()=>{
  var ans=Math.ceil(n/a)*Math.ceil(m/a);
  console.log(ans);
});


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++];
}
function main() {
  const arr = readLine().split("WUB");
  console.log(arr.join(" ").trim());
}


const readline = require('readline');

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

let numberOfStones;
let arrOfStones;
let previousElement;
let counter = 0;
rl.on("line", (input) => {
    if (!numberOfStones) {
        numberOfStones = parseInt(input.split(" "))
    } else {
        arrOfStones = input.split(" ").toString();
        for (let i = 0; i < arrOfStones.length; i++) {
            const currentElement = arrOfStones[i];
            if (!previousElement) {
                previousElement = currentElement;
                continue;
            } else {
                previousElement = arrOfStones[i-1];
                if (previousElement == currentElement) {
                    counter++
                }
                else continue ;
            }
        }
        console.log(counter)
        rl.close();
    }

})


process.stdin.on('data', function(chunk){
    var inp = Number(chunk);
        console.log(inp > 2 && inp % 2 === 0 ? 'YES' : 'NO');
});


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

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

  const arr = d.split(' ').map(Number);
  arr.sort((a, b) => b - a);

  let sum = 0;
  let ans = 0;

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

  if (sum < k) {
    console.log(-1);
  }
  else {
    console.log(ans);
  }

  c++;
});


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())
}


'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const [a, b] = ipt.split(EOL)[0].split(' ').map(v => parseInt(v))

  const da = []
  const db = []

  let [c, d] = [a, b]
  let i = 2
  while (c > 1) {
    while (!(c % i)) {
      c /= i
      da.push(i)
    }
    i++
  }
  i = 2
  while (d > 1) {
    while (!(d % i)) {
      d /= i
      db.push(i)
    }
    i++
  }

  let p = 1

  const od = []
  for (let j = 0; j < da.length; j++) {
    let x = db.indexOf(da[j])
    if (~x) {
      od.push(da[j])
      da.splice(j, 1)
      db.splice(x, 1)
    }
  }
  for (let j = 0; j < db.length; j++) {
    let x = da.indexOf(db[j])
    if (~x) {
      od.push(db[j])
      db.splice(j, 1)
      da.splice(x, 1)
    }
  }
  p = od.reduce((p, v) => p * v, 1)

  if (a > b) {
    console.log(a - p > b ? 'Masha' : a - p < b ? 'Dasha' : 'Equal')
  } else if (a < b) {
    console.log(b - p > a ? 'Dasha' : b - p < a ? 'Masha' : 'Equal')
  }
})


let input = '';
const {EOL} = require('os');
process.stdin.on('data', i => input += i);

process.stdin.on('end', async () => {
  const isSumOfDigitsDivisibleByFour = num => num.toString().split('').reduce((acc, num) => acc + parseInt(num), 0) % 4 === 0;

  let number = parseInt(input.split(EOL)[0]);
  while (!isSumOfDigitsDivisibleByFour(number++)) {}
  console.log(--number);
});


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

rl.on('line', (data) => {
  let [a, b, c, d] = data.split(' ').map(Number);
  let x = Math.min(a, c, d);

  a -= x;
  c -= x;
  d -= x;

  let y = Math.min(a, b);

  console.log(x*256 + y*32);
});


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.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

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

function abs(x) {
    return x < 0 ? -x : x;
}

function solve() {
    let n = 5;
    let data = []
    for (let i = 0; i < n; i++) {
        let l = readLine();
        let d = l.split(' ');
        let len = d.length;
        let row = []
        for (let j = 0; j < len; j++)
            row.push(d[j] == "1" ? 1 : 0);
        data.push(row);
    }

    let x = 0, y = 0;
    for (let i = 0; i < n; i++) {
        for (let j = 0; j < n; j++) {
            if (data[i][j] == 1) {
                x = j;
                y = i;
            }
        }
    }

    return abs(x - 2) + abs(y - 2);
}

function main() {
    console.log(solve());
}


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++];
}

function multiply(a, b) {
	a = a.toString(10).split('').reverse();
	b = b.toString(10).split('').reverse();

	if (a.length < b.length) {
		[a, b] = [b, a];
	}

	let res = Array(a.length + b.length).fill(0);
	for (let i = 0, lb = b.length; i < lb; ++i) {
		let carry = 0;
		let scarry = 0;
		for (let j = 0, la = a.length; j < la; ++j) {
			let m = b[i] * a[j];
			m += carry;

			if (m > 9) {
				let [c, d] = m.toString(10).split('');
				res[i + j] += (scarry >> 0) + (d >> 0);
				carry = c >> 0;
			} else {
				res[i + j] += (scarry >> 0) + m;
				carry = 0;
			}

			if (res[i + j] > 9) {
				let [c, d] = res[i + j].toString(10).split('');
				res[i + j] = d >> 0;
				scarry = c;
			} else {
				scarry = 0;
			}
		}
		if (carry > 0) res[a.length + i] = carry;
		if (scarry > 0) res[a.length + i] = scarry;
	}

	res.reverse();
	let mulVal = '';
	let flag = false;
	res.forEach(d => {
		if (!flag && d !== 0) flag = true;
		if (flag) mulVal += d;
	});
	return mulVal;
}

function main() {
	let [n, k] = readLine()
		.split(' ')
		.map(x => parseInt(x));

	let m = Math.ceil(n / 2);
	let x = 0;
	if (k > m) {
		if ((n & 1) === 1) {
			x = 2 * k - n - 1;
		} else {
			x = 2 * k - n;
		}
	} else {
		x = 2 * k - 1;
	}
	console.log(x);
}


const { EOL } = require('os');

let i = '';
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  let lines = i.split(EOL);

  tester(lines[0]);
});

function tester(y) {
  let newY = Number(y) + 1;
  let stringY = String(newY);
  let countNumbers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  let isAllDifferent = true;

  for(let i = 0; i < stringY.length; i++) {
    let n = +stringY.charAt(i);

    countNumbers[n]++;
  }

  countNumbers.map(c => {
    if (c > 1) isAllDifferent = false;
  });

  isAllDifferent
    ? console.log(newY)
    : tester(newY)
}


function main() {
  const is = new Scanner();
  const [n, m] = is.nextArray().map(Number);
  const word = is.nextLine().split('');
  word.forEach((item, index, array) => {
    array[index] = item.charCodeAt() - 'a'.charCodeAt() + 1;
  });
  word.sort((a, b) => a - b);

  function theFor(i, j, accum, number) {
    if (m === number) {
      return accum;
    }
    if (j === n) {
      return -1;
    }

    if (word[j] - word[i] > 1) {
      return theFor(j, j + 1, accum + word[j], number + 1);
    }
    return theFor(i, j + 1, accum, number);
  }

  console.log(theFor(0, 1, word[0], 1));
}

/*
 *  Api Scanner
 */

class Scanner {
  constructor() {
    this.index = 0;
    this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
  }

  nextLine() {
    return this.lines[this.index++]; // eslint-disable-line
  }

  nextInt() {
    return parseInt(this.nextLine(), 10);
  }

  nextDouble() {
    return parseFloat(this.nextLine());
  }

  nextArray() {
    return this.nextLine().split(' ');
  }

  hasNext() {
    return this.index < this.lines.length;
  }
}

let stdinInput = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', (input) => { stdinInput += input; });
process.stdin.on('end', () => { main(); });


'use strict';

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function main() {
    let ans = readLine()
        .split('+')
        .map(value => parseInt(value));
    ans.sort((a, b) => a - b);
    console.log(ans.reduce((sum, value) => {
        return sum + "+" + value;
    }))
}


const readline = require('readline');

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

rl.question('', (answer) => {
    // TODO: Log the answer in a database

    check(answer);

    rl.close();
});

function check(x) {
  var arr = x.split(" ");
  let  F = parseInt(arr[0]);
  let  S = parseInt(arr[1]);
  let counter = 0;

    while (F <= S) {

        for (let k in arr) {
            if (k == 0) {
                F = F * 3;
            }

            if (k == 1) {
                S = S * 2;
            }

        }

        counter++;
    }

console.log(counter);

}


process.stdin.setEncoding('utf8');

process.stdin.on('readable', () => {
    let input = process.stdin.read();
    input = input.trim();

    input = input.split('+');
    input = input.sort((a, b) => a - b);

    console.log(input.join('+'));
    process.exit(0);
});


const stdin = process.stdin;
stdin.setEncoding("utf8");
let n;
let data;
stdin.on("data", function(rawInput) {
  const inputLines = rawInput.split("\n");
  const [n, k] = splitAndConvert(inputLines[0], 2);
  const result = solve(n, k);
  console.log(result);
});
function splitAndConvert(stringOfNumbers, numOfValid) {
  return stringOfNumbers
    .split(" ")
    .slice(0, numOfValid)
    .map(function(num) {
      return parseInt(num);
    });
}
function solve(n, k) {
  const red = Math.ceil((n * 2) / k);
  const green = Math.ceil((n * 5) / k);
  const blue = Math.ceil((n * 8) / k);
  return red + green + blue;
}


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/

    const BubbleSort = (vector) => {
        for (let i = vector.length - 1; i >= 1; i--) {
            for (let j = 1; j <= i; j++) {
                if (vector[j] < vector[j-1]) {
                    let temp = vector[j-1];
                    vector[j-1] = vector[j];
                    vector[j] = temp;
                }
            }
        }

        return vector;

    }

    let vector = lines[0].split(' ').map( n => parseInt(n));
    vector = BubbleSort(vector);
    let res = 0;
    res = vector[2] - vector[0];

    console.log(res);
});


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

rl.on('line', (d) => {
    let [k, n, w] = d.split(' ').map(Number);

    for (let i = 1; i <= w; i++) {
        n -= k*i;
    }

    console.log(Math.abs(Math.min(0, n)));
});


const readline = require('readline');

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

function isPrime(num) {
    if (num == 2) return true;
    if (num % 2 == 0 || num < 2) return false;
    let s = Math.sqrt(num);
    for (let i = 3; i <= s; i+=2) {
        if (num % i == 0) return false;
    }
    return true;
};

function hasExactlyTwoPrimeDivis(num) {
    var counter = 0;
    for (var i = 2; i < num; i++) {
        if (num % i == 0 && isPrime(i))
            counter++;
        if (counter > 2)
            return false;

    }
    return counter==2;
}

rl.on('line', (input) => {
    var N = parseInt(input);
    var ans = 0;
    for (let i = 6; i <= N; i++)
          ans+=hasExactlyTwoPrimeDivis(i);

     console.log(ans);
     rl.close();
});


const readline = require('readline');

let inputs = [];
const vowels = ['a', 'o', 'y', 'e', 'u', 'i'];

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

rl.on('line', lineInput => {
    inputs.push(lineInput);
    rl.close();
})

rl.on('close', () => {

    let word = inputs[0];

    word = word.split('').filter(char => {
        if (!vowels.includes( char.toLowerCase() ))
            return char
    }).map(char => {
        return `.${char}`
    }).join('').toLowerCase()

    console.log(word)
})


//Petya and Strings

const {EOL} = require('os');

let inp = '';

process.stdin.on('data', c => inp += c);

process.stdin.on('end', () => {
    let lines = inp.split(EOL);
    lines[0] = lines[0].toLowerCase();
    lines[1] = lines[1].toLowerCase();

    process.stdout.write((lines[0] > lines[1]) ? '1' : ((lines[0] < lines[1]) ? '-1' : '0'));
    return;
});


const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var input = [];
rl.on('line', function (line) {input.push(line);});
rl.on('close', function() {
  for (let i = 0; i < input.length; i++) {
    const newArray = input[i].split(' ');
    input[i] = newArray;
  }

//   console.log(input);

  for (let i = 0; i < input.length; i++) {
    for (let j = 0; j < input[i].length; j++) {
      if (input[i][j] === '1') {
        // 2
        let x = Math.abs(j - 2);
        let y = Math.abs(i - 2);
        // console.log(i+1,j+1);
        console.log(x + y)
      }
    }
  }
});


function main() {
    // write code here:
    var game = {
        'rock': 'scissors',
        'scissors': 'paper',
        'paper': 'rock'
    };
    var F = stdin[0],
        M = stdin[1],
        S = stdin[2];
    if (game[F] === M && game[F] === S) {
        console.log('F');
    } else if (game[M] === F && game[M] === S) {
        console.log('M');
    } else if (game[S] === F && game[S] === M) {
        console.log('S');
    } else {
        console.log('?');
    }
}

const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var stdin = [];
rl.on('line', function (line) {
    stdin.push(line);
});
rl.on('close', main);


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

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  let answer = 0;
  let [n, k] = input[0].split(' ').map(x => parseInt(x));

  if (n % 2 === 0) {
    if (k >= n/2) {
      if (k === n/2)
        console.log(k*2 - 1);
      else
        console.log( (k - (n/2)) * 2 );
    } else {
      console.log(k*2 - 1);
    }
  } else {
    if (k >= (n+1)/2) {
      if (k === (n+1)/2)
        console.log(k*2 - 1);
      else console.log( (k - ((n+1)/2)) * 2 );
    } else {
      console.log(k*2 - 1);
    }
  }
});


const stdin = process.stdin;
stdin.setEncoding("utf8");
let data = "";
stdin.on("data", function(chunk) {
  data += chunk;
});
stdin.on("end", function() {
  const inputs = data.split(/[\n\r]+/);
  const [n, k] = splitAndConvert(inputs[0], 2);
  const result = solve(n, k);
  console.log(result);
});

function splitAndConvert(stringOfNumbers, numOfValid) {
  return stringOfNumbers
    .split(" ")
    .slice(0, numOfValid)
    .map(function(num) {
      return parseInt(num);
    });
}

function solve(n, k) {
  for (let i = 0; i < k; i++) {
    if (n % 10) {
      n = n - 1;
    } else {
      n = n / 10;
    }
  }
  return n;
}


'use strict';

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.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();
    console.log(x%2==0&&x>2?'YES':'NO');
}


var input = ''
process.stdin.on('data', c => input += c)
process.stdin.on('end', () => {
  console.log('.' + input.toLowerCase().replace(/[aeiouy]|\W/g, '').replace(/\B/g, '.'))
})


const readline = require('readline')

class ReadStream {
    lines = []

    currPromise = undefined

    readlineHandler = input => {
        this.lines.push(input)
    }

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

        this.rl.on('line', this.readlineHandler)
    }

    async next() {
        this.currPromise = new Promise((resolve, reject) => {
            const tempPromise = this.currPromise ? this.currPromise : Promise.resolve()

            tempPromise.then(_ => {
                if (this.lines .length) {
                    resolve(this.lines.shift())
                }
                else {
                    this.rl.off('line', this.readlineHandler)
                    this.rl.once('line', (input) => {
                        resolve(input)
                        this.rl.on('line', this.readlineHandler)
                    })
                }
            })

        })
        return this.currPromise
    }

    close() {
        this.rl.off('list', this.readlineHandler)
        this.rl.close()
    }
}

const cin = new ReadStream()

async function main() {
    const weight = parseInt(await cin.next())

    if (weight % 2 === 0 && weight > 2) {
        console.log('YES')
    } else {
        console.log('NO')
    }

    // cin.close()
}

main()


let _inputLines;
let _lineNumber = 0;
let inputReader = _inputReader ();

function _main() {

	_inputLines = _inputData.trim().split('\n').map((string) => {
		return string.trim();
	});;

	let s = inputReader.readLine();
	let t = inputReader.readLine();

	var flag = true;

	for (var i = 0; i < s.length; i++) {
	  if (s[i] != t[t.length - 1 - i]) flag = false;
	}

	if (flag) console.log("YES");
	else console.log("NO");

}

var _inputData = '';
function cacheInput(data) {
	_inputData += data;
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', cacheInput).on('end', _main);

function _inputReader () {
	function readLine(){
		return _inputLines[_lineNumber++];
	}

	return {
		readLine,
	}
}


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

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

  let ans = 0;

  for (let i = 0; i < str.length; i++) {
    if (str[i] === 'R' && str[i + 1] === 'U' || str[i] === 'U' && str[i + 1] === 'R') {
      ans++;
      i++;
    }
    else {
      ans++;
    }
  }

  console.log(ans);

  c++;
});


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

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    [n, s] = d.split(' ').map(Number);
    return;
  }

  const arr = d.split(' ').map(Number);
  arr.sort((a, b) => a - b);
  let amount = 0;

  for (let i = 0; i < n - 1; i++) {
    amount += arr[i];
  }

  if (amount > s) {
    console.log('NO');
  }
  else {
    console.log('YES');
  }

  c++;
});


process.stdin.setEncoding('utf8');

process.stdin.on('readable', () => {
    let input = process.stdin.read();
    if (input !== null) {
        let odd = Array.from(new Set(input.trim().split(''))).length;

        if (odd % 2 === 0) process.stdout.write(`CHAT WITH HER!\n`);
        else process.stdout.write(`IGNORE HIM!\n`);
    }
});


const readline = require('readline');

let secondLine = false;

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

let inputs = [];

rl.on('line', lineInput => {
    inputs.push(lineInput);
})

// Read Inputs
rl.on('close', () => {
    const line1 = inputs[0].split(' ');
    const songs = inputs[1].split(' ');
    const D = parseInt(line1[1].split(' ')[0]);
    let spareTime = 0;
    let neededDurationForSongs = 0;
    for (let i = 0; i < songs.length; i++) {
        neededDurationForSongs += parseInt(songs[i]);
    }

    spareTime = (songs.length - 1) * 10;

    if (neededDurationForSongs + spareTime > D)
        return console.log(-1)

    let durationsForJokes = D - neededDurationForSongs;

    return console.log(Math.floor(durationsForJokes / 5))
});


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++];
}

function main() {
	const num = readLine() >> 0;
	const happy = [];
	const regex = /^[47]+$/g;

	for (let i = 1; i <= 1000; ++i) {
		if (regex.test(i.toString(10))) {
			happy.push(i);
		}
	}

	if (regex.test(num.toString(10))) {
		console.log('YES');
		return;
	}

	let almost = false;

	for (let i = 0, l = happy.length; i < l; ++i) {
		if (num % happy[i] === 0) {
			almost = true;
			break;
		}
	}

	almost ? console.log('YES') : console.log('NO');
}


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

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

  const ans = str.match(/[B]+/g) || [];
  console.log(ans.length);
  console.log(ans.map(x => x.length).join(' '));

  // let ans = 0;
  // const arr = [];
  // let inc = 0;

  // for (let i = 0; i < str.length - 1; i++) {
  //   if (str[i] === 'B') {
  //     inc++;

  //     if (str[i + 1] === 'W') {
  //       ans++;
  //       arr.push(inc);
  //     }
  //   }
  //   else {
  //     inc = 0;
  //   }
  // }

  // if (str[str.length - 1] === 'B') {
  //   ans++;
  //   inc++;
  //   arr.push(inc);
  // }

  // console.log(ans);
  // console.log(arr.join(' '));

  c++;
});


const readline = require('readline');

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

//
let numberOfStones;
let arrOfStones;
let previousElement;
let counter = 0;
rl.on("line", (input) => {
    if (!numberOfStones) {
        numberOfStones = parseInt(input.split(" "))
       // console.log(numberOfStones, typeof (numberOfStones))
    } else {
        arrOfStones = input.split(" ").toString();
     //   console.log(arrOfStones, typeof (arrOfStones))
        for (let i = 0; i < arrOfStones.length; i++) {
            const currentElement = arrOfStones[i];
            if (!previousElement) {
                previousElement = currentElement;
                continue;
            } else {
                previousElement = arrOfStones[i-1];
                if (previousElement == currentElement) {
                    counter++
                }
                else continue ;

            }

        }
        console.log(counter)
        rl.close();
    }

})


const readline = require('readline');

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

var countChar = function(s){
    let counter = 0;
    for(let i=0; i<s.length;i++)
        counter+=(s[i]=='B');

    return counter;
}
var ans=0, met=false;
rl.on('line', (input) => {
    if(input=="BBBBBBBB")
                ans++;
     else if(!met){
         ans += countChar(input);
         met=true;
     }

  }).on('close',()=>{
      console.log(ans);
  });


function findGreeting(str) {
  const word = 'hello';
  let i = 0;
  for(const l of str) {
    if(l === word[i]) {
      i++;
    }
  }
  return i === word.length ? 'YES' : 'NO';
}

const { EOL } = require('os');

let i = '';

process.stdin.on('data', c => i += c)
        process.stdin.on('end', () => {
            const lines = i.split(EOL)
            const res = findGreeting(lines[0])
            console.log(res);
        })


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

process.stdin.on('data', (input) => {
  const isDanger = () => {
    let team, count;

    for (let i = 0; i < input.length; i++) {
      team = input[i];
      count = 1;

      for (; input[i + 1] === team && i < input.length - 1; i++) count++;

      if (count > 6) return 'YES';
    }

    return 'NO';
  };

  process.stdout.write(isDanger());
});


let fs = require('fs');

let txt = fs.readFileSync(0, "utf-8").split("\r\n").filter(data => {
    return data.length > 0;
});

for (let i = 0; i < txt.length; i++) {
    let info = txt[i].split(" ").filter(data => {
        return data.length > 0;
    });
    doit(info[0] * 1, info[1] * 1 - 1);
}

function doit(n, index) {
    if (index < Math.ceil(n / 2)) {
        console.log(index * 2 + 1);
    } else {
        let r = index - Math.ceil(n / 2);
        console.log(r * 2 + 2);
    }
}


// Plate Game - https://codeforces.com/problemset/problem/197/A

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

readline.question("", (_input) => {
  const input = _input.split(" ").map(Number);
  digiGame(input[0], input[1], input[2]);
});

const digiGame = (a, b, r) => {
  if (2 * r <= a && 2 * r <= b) {
    console.log("First");
  } else {
    console.log("Second");
  }
};


let input = [];

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

RL.on('line', (line) => {
    input.push(line);
});

RL.on('close', () => {
    let {0:w, 1:h, 2:k} = {...input[0].split(' ')};
    w = parseInt(w); h = parseInt(h); k = parseInt(k);

    let answer = 0;
    for(let i = 0; i < k; i++){
        answer += (w*2 + h*2 - 4);
        w -= 4; h-=4;
    }
    console.log(answer);
});


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

rl.on('line', (str) => {
  if (/[HQ9]/.test(str)) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }
});


// https://codeforces.com/problemset/problem/596/A
// Big O:
// Time complexity:
// Space complexity:

// Read input
var readline = require("readline");
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let numberOfVertices;
let vertices = [];
rl.on('line', (input) => {
    if (!numberOfVertices) {
        numberOfVertices = parseInt(input);
        return;
    }

    const verticesArray = input.split(" ").map(Number)
    const x = verticesArray[0];
    const y = verticesArray[1];
    vertices.push({ x, y });

    if (vertices.length === numberOfVertices) {
        console.log(findRectangleArea(numberOfVertices, vertices));
        rl.close();
    }

});

// Problem
function findRectangleArea(numberOfVertices, vertices) {

    const xPositions = new Set();
    const yPositions = new Set();

    for (let vertex of vertices) {
        xPositions.add(vertex.x);
        yPositions.add(vertex.y);
    }

    if (xPositions.size < 2 || yPositions.size < 2) {
        return -1;
    }

    const xPositionsArray = Array.from(xPositions)
    const yPositionsArray = Array.from(yPositions)

    return Math.abs((xPositionsArray[0] - xPositionsArray[1]) * (yPositionsArray[0] - yPositionsArray[1]));
}


//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 N = nextInt();
	var list = nextCharArray();
	var output = "";
	var isOne = false;
	for(var i = 0; i < N; i++){
		if(list[i] == "0"){
			output += "0";
		}else{
			isOne = true;
		}
	}
	if(isOne){
		myout("1" + output);
	}else{
		myout("0");
	}

}


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

let currentLine = 0;
let inputString = "";

process.stdin.on("data", (raw_data) => {
  inputString += raw_data;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

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

/******** Main function*************/

function main() {
  var s = readLine();
  var t = readLine().split("");

  var str = "";
  for (var i = 0; i < t.length; i++) {
    str = str + t[t.length - 1 - i];
  }
  if (str === s) {
    console.log("YES");
  } else {
    console.log("NO");
  }
}


const { EOL } = require('os');

let i = '';
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  let lines = i.split(EOL);

  tester(lines[0], lines[1]);
});

function tester(w1, w2) {
  let newW = '';

  for(let i = w1.length - 1; i >= 0; i--) {
    newW += String(w1.charAt(i));
  }

  console.log(newW === w2 ? 'YES' : 'NO');
}


const readline = require('readline');

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

rl.question('', (weight) => {

  if (weight % 2 == 0 && weight > 2) {
    console.log("YES");
  } else {
    console.log("NO");
  }

  rl.close();
});


const input = [];

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

RL.on('line', (line) => {
    input.push(line);
});

RL.on('close', () => {
  let [n, m, a, b] = input[0].split(' ').map(x => parseInt(x));

  if (b/m <= a) {
    if (n % m === 0) {
      console.log( (n/m) * b );
    } else {
      console.log(Math.min(
        (parseInt(n/m) * b) + (n - parseInt(n/m) * m) * a,
        parseInt(Math.ceil(n/m) * b)
      ));
    }
  } else {
    console.log(n*a);
  }
});


let inputString = '';
let currentLine = 0;

const runMain = () => {
  inputString = inputString.trim().split('\n').map(string => string.trim());
  main();
  process.exit();
}
const readLine = () => inputString[currentLine++];

process.stdin.on('data', inputStdin => inputString += inputStdin);
process.stdin.on('end', runMain);
process.on('SIGINT', runMain);

function main() {
  const str1 = readLine().toLowerCase();
  const str2 = readLine().toLowerCase();
  console.log(str1 > str2 ? 1 : (str1 < str2 ? -1 : 0));
}


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

const isVowel = (char) => {
  return ["a", "o", "u", "i", "e"].includes(char);
}

rl.on('line', (str) => {
  let ans = 'YES';

  for (let i = 1; i < str.length; i++) {
    if (!isVowel(str[i]) && !isVowel(str[i - 1]) && str[i - 1] !== 'n') {
      ans = 'NO';
      break;
    }
  }

  if (!isVowel(str[str.length - 1]) && str[str.length - 1] !== 'n') {
    ans = 'NO';
  }

  console.log(ans);
  c++;
});


'use strict';

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.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

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

function printResult(x) {
    process.stdout.write(x);
}

function main() {
    const arrPoints = new Array(8);
    for (let i = 0; i < 8; i++) {
        let rl = readLine().split(' ').map(Number);
        arrPoints[i] = new Point(rl[0], rl[1]);
    }

    eightPointSet(arrPoints);
}

function Point(x, y)
{
    this.x = x;
    this.y = y;
}

const comparePoints = (a, b) => {
    if (a.x < b.x || (a.x === b.x && a.y < b.y)) {
        return -1;
    }
    if (a.x > b.x || (a.x === b.x && a.y > b.y)) {
        return 1;
    }
    return 0;
}

/**
 * eightPointSet
 *
 * 2    4   7
 * 1        6
 * 0    3   5
 *
 * => Equal
 * x0 = x0 = x2
 * x3 = x4
 * x5 = x6 = x7
 * y0 = y3 = y5
 * y1 = y6
 * y2 = y4 = y7
 *
 * => Not equal
 * x0 != x3
 * x3 != x5
 * y0 != y1
 * y1 != y2
 */
const eightPointSet = (a) => {
    a.sort(comparePoints);
    if (a[0].x === a[1].x && a[1].x === a[2].x
        && a[3].x === a[4].x
        && a[5].x === a[6].x && a[6].x === a[7].x
        && a[0].y === a[3].y && a[3].y === a[5].y
        && a[1].y === a[6].y
        && a[2].y === a[4].y && a[4].y === a[7].y

        && a[0].x !== a[3].x
        && a[3].x !== a[5].x
        && a[0].y !== a[1].y
        && a[1].y !== a[2].y) {
        printResult('respectable');
    } else {
        printResult('ugly');
    }
};


const input = [];

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

RL.on('line', (line) => {
    input.push(line);
});

function fact(num)
{
    if(num === 0)
        return 1;
    return num * fact(num-1);
}

RL.on('close', () => {
    const check = new Set(); check.add('a'); check.add('e');
    check.add('i'); check.add('o'); check.add('u');
    const str = input[0];
    let answer = 0;
    for(let i = 0; i < str.length; i += 1) {

        if(check.has(str.charAt(i))) {
            answer += 1;
        } else if( !isNaN(parseInt(str.charAt(i), 10)) && parseInt(str.charAt(i), 10) % 2 === 1) {
            answer += 1;
        }
    }
    console.log(answer);
});


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});
function readLine() {
  return inputString[currentLine++];
};
process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });
  solve();
  // cmd: node cp.js < input.txt > output.txt
});
function solve() {
  let t = parseInt(readLine());
  while (t--) {
    let set=new Set();
    set.add(1);
    let num=parseInt(readLine());
    for(let i=2;i<=Math.sqrt(num);i++){
      let pow=Math.pow(i,2);
      let cube=Math.pow(i,3);
      if(pow<=num){
        set.add(pow)
      }
      if(cube<=num){
        set.add(cube)
      }
    }
    console.log(set.size);
  }
}

//------------------------------------------------------------------------------------


'use strict';

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function checkLuckyNumber(n) {
    let check = 1;
    for (var i = 0; i <= 9; i++) {
        if (String(n).indexOf(i) != -1 && i != 4 && i != 7) {
            check = 0;
            break;
        }
    }
    if (check == 1) return true;
    else return false;
}

function count4(n) {
    return String(n).split('').filter(value => value == '4').length;
}

function count7(n) {
    return String(n).split('').filter(value => value == '7').length;
}

function main() {
    let n = parseInt(readLine());
    let l = 0;
    let r = 0;
    let A = [];
    A[0] = 0;
    while (1) {
        // console.log(A)
        A[++r] = A[l] * 10 + 4;
        if (A[r] >= n && count4(A[r]) == count7(A[r])) {
            console.log(A[r]);
            break;
        }
        A[++r] = A[l] * 10 + 7;
        if (A[r] >= n && count4(A[r]) == count7(A[r])) {
            console.log(A[r]);
            break;
        }
        l++;
    }
}


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

rl.on('line', (d) => {
  let n = +d;

  let curr = 1;
  let x = 1;

  while (n >= curr) {
    n -= curr;
    x++;
    curr += x;
  }

  console.log(x - 1);

  // let sum = 0;
  // let ans = 0;
  // let c = 1;

  // while (sum < n) {
  //   let s = 0;
  //   for (let j = 1; j <= c; j++) {
  //     s += j;
  //   }

  //   sum += s;
  //   c++;

  //   if (sum > n) {
  //     break;
  //   }
  //   else {
  //     ans++;
  //   }
  // }

  // console.log(ans);

});


const input = [];

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

RL.on('line', (line) => {
    input.push(line);
});

RL.on('close', () => {
  const [n, k] = input[0].split(' ').map(x => parseInt(x));
  let time = 240; let answer = 0, problems = 1;

  while (time - (problems*5) >= k && answer < n) {
    answer += 1;
    time -= (problems*5);
    problems += 1;
  }

  console.log(answer);
});


const readline = require('readline')

class ReadStream {
    lines = []

    currPromise = undefined

    readlineHandler = input => {
        this.lines.push(input)
    }

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

        this.rl.on('line', this.readlineHandler)
    }

    async next() {
        this.currPromise = new Promise((resolve, reject) => {
            const tempPromise = this.currPromise ? this.currPromise : Promise.resolve()

            tempPromise.then(_ => {
                if (this.lines .length) {
                    resolve(this.lines.shift())
                }
                else {
                    this.rl.off('line', this.readlineHandler)
                    this.rl.once('line', (input) => {
                        resolve(input)
                        this.rl.on('line', this.readlineHandler)
                    })
                }
            })

        })
        return this.currPromise
    }

    close() {
        this.rl.off('list', this.readlineHandler)
        this.rl.close()
    }
}

const cin = new ReadStream()

async function main() {
    const weight = parseInt(await cin.next())

    if (weight % 2 === 0 && weight > 2) {
        console.log('YES')
    } else {
        console.log('NO')
    }

    cin.close()
}

main()


const readline = require('readline');

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

/*
       012345678910
str = "abcdZZZefgh"

strart = 4
len = 3

       012345
input="///one"
       01234
input="//one"
*/
var eraseAt = function(str, start, len){
    return str.substring(0, start) + str.substring(start + len);
}

rl.on('line', (input) => {

    for(let i=0; i<input.length-1; i++){
        if(input[i]=='/' && input[i+1]=='/'){
             input=eraseAt(input, i, 1);
             i--;
        }
    }

    if(input.length > 1 && input[input.length-1] == '/')
         input = eraseAt(input ,input.length-1, 1);

    console.log(input);
    rl.close();
  });


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.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

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

let stepeni = [1, 2]
let stepen = function (n) {
    if (stepeni[n]) return stepeni[n];
    let l = stepeni.length - 1;
    while (l < n) {
        stepeni.push(2 * stepeni[l++]);
    }
    return stepeni[n];
}

function main() {
    let t = readLine();
    let red = [];
    while (t--) {
        red.push(readLine());
    }
    red.map(e => console.log((stepen(parseInt(e)) - 1)))
}


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

    let row = line.split(' ').map(Number);
    if (!point) {
        for (let j = 0; j < row.length; j++) {
            if (row[j] === 1) {
                point = {i, j};
            }
        }
    }
    i++
    if (i === 5) {
        let moves = 0;
        if (point.i > 2) {
            moves += point.i - 2;
        } else if (point.i < 2) {
            moves += 2 - point.i;
        }
        if (point.j > 2) {
            moves += point.j - 2;
        } else if (point.j < 2) {
            moves += 2 - point.j;
        }
        console.log(moves);
    }
});


'use strict';
// 9- 8- 8- 7- 7- 7- 7- 7- 7-  6- 5- 3- 2- 2- 2 2- 2- 2 1- 1- 1 0- 0-

// 7 4 2  - - - - -
// value = 3
// arr[minIndx] = 4
// min = 1
// 4  - - -

// 9 8 8 7 6 5 4 2 1 0
// 7 7 7 2 1 0
// 7 7 2 2 1
// 1 1
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let arr = []
let input = []
let n;
var readline = require('readline')

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

process.stdin.on('end', _ => {
    input = input.trim().split('\n').map(string => {
        return string.trim();
    });
    n = input[0]
    arr = input[1].split(" ")
    arr = arr.map(s=>parseInt(s))
    main();
});
function main() {
    // console.log("len",arr.length)
  let visted = {};
  arr.sort(function(a, b){return b-a});
//   arr.reverse();
    //   arr.map(s=>console.log(typeof s))

  function findMinDifference(value) {
    let min = 100000000;
    let minIndex;
    for (let i = 0; i < arr.length; i++) {
      if (visted[i]) continue;
      if (Math.abs(arr[i] - value) < min  ) {
        min = Math.abs(arr[i] - value);
        minIndex = i;
      }
    }
    visted[minIndex] = true;
    return arr[minIndex];
  }
  let pils = 1;
  let boxesCanHold = arr[0]; // 9
  visted[0] = true;

  for (let i = 0; i < arr.length; i++) {
    if (visted[i]) continue;
    if(boxesCanHold ==0){
        boxesCanHold = arr[i];
        visted[i] = true;
        ++pils;
    }
    if(boxesCanHold!=0){
     let nextStrength = findMinDifference(boxesCanHold-1);
     boxesCanHold = nextStrength >= boxesCanHold ? --boxesCanHold : nextStrength;
    //  console.log(nextStrength," ",boxesCanHold)
    }
    boxesCanHold = boxesCanHold < 0 ? 0 : boxesCanHold;
    if (boxesCanHold == 0 && Object.keys(visted).length != arr.length) {
        // console.log("here")
        i = 0;
    }
    else if(i < arr.length-1 && Object.keys(visted).length != arr.length){
                    i = 0;
    }

  }
  console.log(pils );

}


const input = [];

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

RL.on('line', (line) => {
    input.push(line);
});

RL.on('close', () => {
  const code = input[0];
  const m = code[0]; const r = code[1];

  let flag = false;
  input[1].split(' ').forEach(card => {
    if (m === card[0] || r === card[1]) {
      flag = true;
    }
  });

  console.log( flag ? "YES" : "NO" );
});


'use strict';
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.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

const readLine=()=> inputString[currentLine++];
/* ================================================
           Main Solution Starts Here
===================================================*/

const isVowel=(x)=>{
    let result;
    result = x === "A" || x==="Y" || x === "E" || x === "I" || x === "O" || x === "U" || x==="a" || x === "e" || x === "i" || x === "o" || x === "u" || x==="y"
    return result;
}

const main=()=>{
	let first = readLine().toLowerCase()
	let newString=''
	for(let char of first){
		if(!isVowel(char))
			newString+='.'+char
	}

	console.log(newString)

}


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 = 'NO';

  while (n > 0) {
    if (n % 7 === 0) {
      ans = 'YES';
      break;
    }

    if (n % 3 === 0) {
      ans = 'YES';
      break;
    }

    n -= 7;
  }

  n = +d;
  while (n > 0) {
    if (n % 7 === 0) {
      ans = 'YES';
      break;
    }

    if (n % 3 === 0) {
      ans = 'YES';
      break;
    }

    n -= 3;
  }

  console.log(ans);

  c++;
});


let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const line = i.split(EOL);
  const [n, m, a] = line[0].split(' ');
  console.log(minFlagStones(n, m, a));
});

function minFlagStones(n, m, a) {
  return Math.ceil(n / a) * Math.ceil(m / a);
}


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++];
}
function main() {
  const [x, y, a] = readLine()
    .split(" ")
    .map((n) => parseInt(n));

  console.log(Math.ceil(x / a) * Math.ceil(y / a));
}


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

rl.on('line', (d) => {
  const n = +d;
  const weeks = Math.floor(n / 7);
  const remainder = n % 7;
  const min = weeks * 2 + (remainder === 6 ? 1 : 0);
  const max = (weeks * 2) + Math.min(2, remainder);

  console.log(min, max);
  c++;
});


process.stdin.on('data', function(input) {
	[n,m,a] = input.toString().split(' ');
	x = Math.ceil;
	console.log(x(n/a) * x(m/a));
});


let inputBuffer = "", curLine = 0;

function readline() {
	return inputBuffer[curLine++];
}

let curTokens = [], curToken = 0;

function next() {
	while (curToken >= curTokens.length) {
		curTokens = readline().split(/[\s]+/);
		curToken = 0;
	}
	return curTokens[curToken++];
}

function nextInt () {
	return parseInt(next(), 10);
}

process.stdin.resume();
process.stdin.setEncoding("utf8");

process.stdin.on('data', (chunk) => {
	inputBuffer += chunk;
});

process.stdin.on('end', () => {
	inputBuffer = inputBuffer.trim().split('\n').map(line => line.trim());
	main();
});

function print(data) {
	process.stdout.write(data + "\n");
}

function main () {
	const a = nextInt();
	const b = nextInt();

	// console.log(a + ' ' + b);

	if (a === b) {print(1); return; }

	const lg = (Math.log(b/a) / Math.log(1.5));

	const ceilLog = Math.ceil(lg);

	if (parseInt(lg, 10) === ceilLog) print(ceilLog+1);
	else print(ceilLog);
}


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

const strs = [];

readline.on('line', line => {
  strs.push(line.toLowerCase());
  if (strs.length === 2) {
    if (strs[0] === strs[1]) {
      console.log(0);
    } else if (strs[0] < strs[1]) {
      console.log(-1);
    } else if (strs[0] > strs[1]) {
      console.log(1);
    }
  }
});


process.stdin.on('data', data => {
    var input = data.toString().trim().split(" ");

    process.stdout.write((Math.ceil(parseInt(input[0]) / parseInt(input[2])) *Math.ceil(parseInt(input[1]) / parseInt(input[2]))).toString());
});


let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  let nums = lines[1].split(' ');
  nums = nums.map(num => parseInt(num, 10));
  console.log(getMinNums(nums));
});

function getMinNums(nums) {
  nums = nums.sort((a, b) => a - b);
  let count = 0;
  for (let i = 0; i < nums.length; i++) {
    if (nums[i] > 0) {
      count++;
      for (let j = i + 1; j < nums.length; j++) {
        if (nums[j] % nums[i] === 0) {
          nums[j] = 'a';
        }
      }
    }
  }
  return count;
}


let i = ''
process.stdin.on('data', c => i += c )
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL)
  actOn(lines)
})

function actOn(lines) {
  for(let line of lines) {
    if(line !== '') {
      let answer = '';
      splitted = line.split("")
      for(let c of splitted) {
        if('aeiouy'.split("").includes(c.toLowerCase())) {
          continue;
        } else {
          answer += '.' + c.toLowerCase()
        }
      }
      console.log(answer)
    }
  }
}


'use strict';

const readline = require('readline');

let lines = [];

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

rl.on('line', (line) => {
    lines.push(line);
});

rl.on('close', (cmd) => {
    let n = parseInt(lines[0]);
    let sf = 0;
    let fs = 0;
    const s = lines[1];
    for (let i = 0; i < n - 1; ++i) {
        if (s[i] == 'S' && s[i + 1] == 'F') { ++sf; }
        if (s[i] == 'F' && s[i + 1] == 'S') { ++fs; }
    }
    const ret = sf > fs ? "YES" : "NO";
    console.log(ret);
    process.exit(0);

});


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

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  const [n] = input[0].split(' ').map(x => parseInt(x));

  console.log(25);
});


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}

function main() {
    let n = parseInt(readLine());
    let stones = readLine();
    let final = 0;
    for (let i = 0; i < n; i++) {
        if (stones[i] === stones[i + 1]) {
            final++;
        }
    }
    console.log(final);
}


const main = (data) => {
  const n = +data[1];
  let x = data[0];

  for (let i = 0; i < n; i++) {
    if (x[x.length - 1] === '0') {
      x = x.slice(0, x.length - 1);
    } else {
      x = x.slice(0, x.length - 1) + ('' + (+x[x.length - 1] - 1));
    }
  }

  console.log(x);
};

let data = '';

process.stdin.on('data', input => data += input);
process.stdin.on('end', () => {
  data = data.split(' ');

  main(data);
});


const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin
});

let lines = [];
rl.on('line', (line) => {
    lines.push(line);
}).on('close', () => {
  let c = +lines[0].split(' ')[1];
  const us = lines[1].split(' ').map(v => +v);

  if (us[0] <= 0) {
    process.stdout.write('0');
  } else if (us[c - 1] > 0) {
    while(us[c - 1] === us[c] && c - 1 !== us.length) {
      c++;
    }
    process.stdout.write(c.toString());
  } else {
    while(us[c - 1] <= 0 && c !== 0 ) {
      c--;
    }
    process.stdout.write(c.toString());
  }
});


let stdin = process.stdin;
stdin.setEncoding('utf8');
stdin.on('data', function (data) {
    let input = data.split('\n');
    let n = input[0].split(' ').map(function (a) { return parseInt(a); });
    let k = input[1].split(' ').map(function (a) { return parseInt(a); });
    let result = solution(n, k);
    console.log(result);
});

// End of interface

const solution = (n, studentsArray) => {
	let res = 0;
	studentsArray.sort(function(a, b){return a-b});
	for (let i = 0; i<n-1; i=i+2){
		res = res + (studentsArray[i+1]-studentsArray[i]);
	}
	return res;
};


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

const input = [];
readLine.on('line', line => input.push(line));
const gender = () => {
    let count = 0;
    let s = input.toString();
    const a = {};
    for (let i = 0; i < s.length; i++) {
        a[s[i]] = true;
    }
    console.log( Object.keys(a).length % 2 === 0 ? "CHAT WITH HER!" :"IGNORE HIM!");

};

readLine.on('close', gender);


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

let input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  const cord = parseInt(input[0], 10)
  const _result = Math.ceil(cord / 5)
  console.log(_result)
})


'use strict';

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.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}
function main(){
   const w = readLine();
   if (w%2===0 && w!=2){
       console.log("YES");
   }
   else{
       console.log("NO");
   }

}


//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 t = nextInt();
	var output = new Array(t);
	for(var i = 0; i < t; i++){
		var x = nextInt();
		var count = 1;
		var now = 1;
		while(true){
			if(now == x){
				break;
			}
			var tmp = now % 10;
			now *= 10;
			now += tmp;
			if(now > 9999){
				now %= 10;
				now++;
			}
			count += now.toString().length;
		}
		output[i] = count;
	}
	myout(myconv(output, 9));
}


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

const isVowel = (char) => {
  return ["a", "o", "u", "i", "e"].includes(char);
}

rl.on('line', (str) => {
  let ans = 'YES';

  for (let i = 1; i < str.length; i++) {
    if (!isVowel(str[i]) && !isVowel(str[i - 1]) && str[i - 1] !== 'n') {
      ans = 'NO';
      break;
    }
  }

  if (!isVowel(str[str.length - 1]) && str[str.length - 1] !== 'n') {
    ans = 'NO';
  }

  console.log(ans);
  c++;
});


let _inputLines;
let _lineNumber = 0;
let inputReader = _inputReader ();

function _main() {

	_inputLines = _inputData.trim().split('\n').map((string) => {
		return string.trim();
	});;
	let [s, v1, v2, t1, t2] = inputReader.readNumberArray();

	let res1 = 2 * t1 + v1 * s;
	let res2 = 2 * t2 + v2 * s;
	if (res1 < res2) {
		console.log("First");
	} else if (res1 > res2) {
		console.log("Second");
	} else {
		console.log("Friendship");
	}

}

var _inputData = '';
function cacheInput(data) {
	_inputData += data;
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', cacheInput).on('end', _main);

function _inputReader () {
	function readNumberArray(){
		return _inputLines[_lineNumber++].split(' ').map(val => Number(val));
	}

	return {
		readNumberArray,
	}
}


var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.on('line', function(line){
    m = parseInt(line.split(' ')[0]);
    n = parseInt(line.split(' ')[1]);
    console.log(Math.floor((m*n)/2));
    process.exit(0);
});


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

const divisors = (n) => {
  const divs = [];

  for (let i = 1; i <= n / 2; i++) {
    if (n % i === 0) {
      divs.push(i);
    }
  }

  divs.push(n);

  return divs;
}

rl.on('line', (d) => {
  const arr = divisors(+d);
  let min = Infinity;
  let a = 1;
  let b = 1;

  for(let i = 0; i < arr.length; i++) {
    for (let j = i; j < arr.length; j++) {
      const v = arr[j] - arr[i];

      if (v < min && arr[j] * arr[i] === +d) {
        min = v;
        a = arr[i];
        b = arr[j];
      }
    }
  }

  console.log(a, b);
});


process.stdin.resume();
process.stdin.setEncoding('utf8');

var input= '', cin, cout;

process.stdin.on('data', function(chunk) {
    input+=chunk;
});

process.stdin.on('end', function() {
    input = input.split('\n');
    cout = function(data) {process.stdout.write(data+'\n')};
    var inputLineIndex = 0;
    cin = function(){return inputLineIndex>=input.length?undefined:input[inputLineIndex++]};
    process.exit(main() || 0);
});

function main() {
    [n, m, k] = cin().split(' ');
    let res = 0;
    for (let i = 0;  i < k; i++) {
        res += 2*(+n + +m - 8*(+i)) - 4;
    }
    cout(res);
    return 0;
}


const readline = require('readline');

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

var IsPrime = function (num) {
    if (num == 2)
        return true;
    if (num < 2 || num % 2 == 0)
        return false;
    var limit = parseInt(Math.sqrt(num));
    for (i = 3; i <= limit; i += 2) {
        if (num % i == 0)
            return false;
    }
    return true;
}

var prev = 2,
    n, k, counter = 0,
    helper;

rl.on('line', (input) => {
    var temp = input.split(' ').map(item => parseInt(item));
    n = temp[0];
    k = temp[1];

    for (let i = 3; i <= n; i++) {
        if (IsPrime(i)) {
            helper = prev + i + 1;
            if (IsPrime(helper) && helper <= n)
                counter++;
            prev = i;
        }
    }
    console.log((counter >= k) ? "YES" : "NO");
    rl.close();
});


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

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  //let [x1, x2, x3, x4] = input[0].split(' ').map(x => parseInt(x));
  let [n] = input[0].split(' ').map(x => parseInt(x));

  let answ = 0;
  while (n > 0) {
    if (n % 2 === 0) n /= 2;
    else if (n % 2 === 1) {
      n -= 1; answ += 1;
      n /= 2;
    }
  }

  console.log(answ);
});


process.stdin.on('data', input => {
    input = String(input).split(' ');

    n = input[0];
    m = input[1];
    a = input[2];

    n_neded = 0;
    m_neded = 0;

    if (n % a != 0) {
        n_neded = Math.floor(n / a) + 1;
    } else {
        n_neded = Math.floor(n / a);
    }

    if (m % a != 0) {
        m_neded = Math.floor(m / a) + 1;
    } else {
        m_neded = Math.floor(m / a);
    }

    console.log(n_neded * m_neded);

   }
)


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

  // multi line input
  readline.on('line', line => {
    let number = parseInt(line)
    console.log(watermelon(number))
})

//it's a main function
function watermelon(number) {
    return number > 2 && number%2 === 0 ? 'YES' : 'NO'
}


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

rl.question('', (line) => {
  n = parseInt(line)
  main()
})

let wynik = 0

function main() {
    if (n % 2 === 0){
      wynik = n/2
    } else
      wynik = (n-1)/2 - n
  console.log(wynik)
  rl.close()
}


'use strict';

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.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

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

function main() {
    let s1 = readline();
    let lowercase = 0;
    let uppercase = 0;

    for (let i = 0 , c = s1.length ; i < c ; i++){
        if (s1[i].charCodeAt(0) >=97) lowercase++;
        else uppercase ++;
    }
    console.log((lowercase >= uppercase)? s1.toLowerCase() : s1.toUpperCase());
}


//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 N = one[0];
	var K = one[1];
	var list = nextIntArray();
	var count = 0;
	while(list.length > 0){
		var L = list[0];
		if(L <= K){
			count++;
			list.shift();
			continue;
		}
		var R = list[list.length - 1];
		if(R <= K){
			count++;
			list.pop();
			continue;
		}
		break;
	}

	myout(count);
}


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);
    myerr("-----start-----");
    var start = new Date();
    Main();
    var end = new Date() - start;
    myerr("----- end -----");
    myerr("Time: " + (end) + "ms");
    myerr("Memory: " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
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) {
    var returnObj = {
        list: input, index: 0, max: input.length,
        hasNext: function () { return (this.index < this.max); },
        next: function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { var returnInput = this.list[this.index]; this.index++; return returnInput; } }
    };
    return returnObj;
}
function myout(s) { console.log(s); }
function myerr(s) { console.error("debug:" + require("util").inspect(s, false, null)); }
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; } }

function Main() {
    var mat = [];

    var j = 0;
    for (var i = 0; i < 5; i++) {
        mat[i] = nextIntArray();
        for (var j = 0; mat[i][j] < 5; j++) {
            if (mat[i][j] === 1) {
                myout(Math.abs(i - 2) + Math.abs(j - 2));
            }
        }
    }

} // Use Terminal to debug, not Debug Console!


// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

function main(input) {
    let output = nameLookUp(input);
    process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {
    let inputs = str.trim().replace(/\r/g, '').split('\n');
    let dragons = inputs.slice(0, inputs.length - 1);
    let totalDragons = +inputs[inputs.length - 1];
    let damagedDragons = 0;
    if (dragons.indexOf('1') !== -1) {
        damagedDragons = totalDragons;
    }
    else {

        for (let i = 1; i <= totalDragons; i++) {
            if (i % dragons[0] == 0 || i % dragons[1] == 0 || i % dragons[2] == 0 || i % dragons[3] == 0) {
                damagedDragons++;
            }
        }
    }

    return damagedDragons.toString();
}


let fs = require('fs');

let txt = fs.readFileSync(0, "utf-8").split(/[\n\r]/).filter(data => data.length > 0);

for (let i = 0; i < txt.length; i += 2) {
    doit([...new Set(txt[i + 1].split("").filter(data => data.length > 0).map(data => data.toLowerCase().charCodeAt(0)).sort((a, b) => a - b))]);
}

function doit(tab) {
    for (let i = 0; i < 26; i++) {
        if (tab[i] != i + 97) {
            console.log('NO');
            return;
        }
    }
    console.log("YES");

}


const readline = require('readline');

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

var GCD = function (a, b) {
    if (b == 0) return a;
    return GCD(b, a % b);
};

rl.on('line', (input) => {
    var cont = input.split(' ').map(item => parseInt(item));
    var w = cont[0];
    var y = cont[1];
    var max = (w > y) ? w : y;
    var dot = 6 - max + 1;
    var temp = GCD(6, dot);
    //console.log("cont = %d  type = %s", dot / temp, typeof (6 / temp));
    console.log("%d/%d",dot/temp,6/temp);
    rl.close();
}).on('close', () => {
});