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 isPrime(x) {
	let s = Math.sqrt(x);
	let i = 2;
	while (i <= s) {
		if (x % i === 0) {
			return false;
		}
		i++;
	}
	return true;
}

function main() {
	let [n, m] = readLine()
		.split(' ')
		.map(x => x >> 0);
	n++;

	let next = false;

	while (n <= m) {
		if (isPrime(n)) {
			if (n === m) {
				next = true;
			}
			break;
		}
		n++;
	}

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


'use strict';

function solve(n, m, k) {
  if (n & 1) {
    if (k < m / 2) return 'NO';
    n--;
    k -= m / 2;
  }
  if (k & 1) return 'NO';
  if (k > n * Math.floor(m / 2)) return 'NO';
  return 'YES';
}

async function main(read) {
  try {
    let t = Number(await read());
    let res = new Array(t);
    for (let i = 0; i < t; i++) {
      const [n, m, k] = (await read()).split(' ').map(Number);
      res[i] = solve(n, m, k);
    }
    return res.join('\n');
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', async () => {
  inputs = str.split('\n').values();
  const output = await main(read);
  process.stdout.write(output);
});


const readline = require('readline')

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

async function getData() {
	return new Promise((res,rej)=>{
		rl.question('',answer=>res(answer))
	})

}
function counted(limak,bob){
	let years = 0

	limak = parseInt(limak,10)
	bob = parseInt(bob,10)

	while(limak <= bob){

		years++
		limak *= 3
		bob *= 2
	}
	console.info(years)
}

async function main(){

	let data = await getData()
	rl.close()
	data = data.trim().split(' ')

	counted(...data)
}

main()


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() {
  let n = Number(readLine()) + 1;
  let res = false;
  while (!res) {
    const a = Array.from(n.toString());
    res = true;
    a.forEach(_a => {
      if (a.filter(__a => __a !== _a).length !== 3) {
        res = false;
      }
    });
    n++;
  }
  console.log(--n);
}


function main() {
    var str = stdin[0].split(' ').map(x=>parseInt(x));
    var L = str[0];
    var P = str[1];
    var N = str[2];
    var M = ((N+P)%L+L)%L;
   console.log(M>0?M:L);
}

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 a = one[0];
  var b = one[1];
  var n = one[2];
  var turn = true;
  while(true){
  	if(turn){
  		var minus = gcd(a, n);
  		if(n < minus){
  			myout("1");
  			return;
  		}
  		n -= minus;
  		turn = false;
  	}else{
  		var minus = gcd(b, n);
  		if(n < minus){
  			myout("0");
  			return;
  		}
  		n -= minus;
  		turn = true;
  	}
  }
}
function gcd(m, n) {return n != 0 ? gcd(n, m % n) : m;}


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));
  const k = lines[0].split(' ')[1];
  console.log(minOperations(nums, parseInt(k, 10)));
});

function minOperations(nums, k) {
  if (nums.length === 1) return 0;
  let totalMin = Number.MAX_VALUE;

  for (const num of nums) {
    let currNum = num;
    while (currNum > 0) {
      let arr = [];
      for (let i = 0; i < nums.length; i++) {
        let temp = nums[i];
        let operations = 0;
        while (temp > currNum) {
          temp = Math.floor(temp / 2);
          operations++;
        }
        if (temp === currNum) arr.push(operations);
      }
      if (arr.length < k) {
        currNum = Math.floor(currNum / 2);
        continue;
      } else {
        arr = arr.sort((a, b) => a - b);
        let minSum = 0;
        for (let j = 0; j < k; j++) {
          minSum += arr[j];
        }
        totalMin = Math.min(minSum, totalMin);
        currNum = Math.floor(currNum / 2);
      }
    }
  }

  if (totalMin === Number.MAX_VALUE) {
    return 0;
  }
  return totalMin;
}


var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    // note:  d is an object, and when converted to a string it will
    // end with a linefeed.  so we (rather crudely) account for that
    // with toString() and then trim()
    d = d.toString().trim();
    var arr = d.split('WUB');
    for( var i = 0; i < arr.length; i++){
        if ( arr[i] === '') {
            arr.splice(i, 1);
            i--;
        }
    }

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

  });


function lexicographically(str1, str2) {
  for (let i = 0; i < str1.length; i++) {
    if (
      str1[i].toLocaleLowerCase().charAt(0) >
      str2[i].toLocaleLowerCase().charAt(0)
    ) {
      return console.log(1);
    } else if (
      str1[i].toLocaleLowerCase().charAt(0) <
      str2[i].toLocaleLowerCase().charAt(0)
    ) {
      return console.log(-1);
    } else {
      continue;
    }
  }
  return console.log(0);
}

const readline = require("readline");
// Create readline Interface
let inputs = [];
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
rl.on("line", (lineInput) => {
  inputs.push(lineInput);
});
rl.on("close", () => {
  let firstWord = inputs[0];
  let secondWord = inputs[1];
  lexicographically(firstWord, secondWord);
});


// https://codeforces.com/problemset/problem/1091/A
// Big O:
// Time complexity: O(1)
// Space complexity: O(1)

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

rl.on('line', (input) => {
    const numbers = input.split(" ").map(Number);
    const yellow = numbers[0];
    const blue = numbers[1];
    const red = numbers[2];
    console.log(findMaxOrnaments(yellow, blue, red));
    rl.close();
});

function findMaxOrnaments(yellow, blue, red) {
    const minimum = Math.min(yellow, blue, red)

    if (minimum == yellow) {
        return findMaxWithYellowMinimum(yellow, blue, red);
    }

    if (minimum == blue) {
        return findMaxWithBlueMinimum(yellow, blue, red);
    }

    return findMaxWithRedMinimum(yellow, blue, red);
}

function findMaxWithYellowMinimum(yellow, blue, red) {
    let solutionFound = false;

    let yellowChosen = yellow;
    let blueChosen = 0;
    let redChosen = 0;

    while (!solutionFound) {
        blueChosen = 1 + yellowChosen;
        redChosen = 2 + yellowChosen;
        if (blueChosen > blue || redChosen > red) {
            yellowChosen = yellowChosen - 1;
        } else {
            solutionFound = true;
        }

    }
    return yellowChosen + blueChosen + redChosen;
}

function findMaxWithBlueMinimum(yellow, blue, red) {
    let solutionFound = false;

    let yellowChosen = 0;
    let blueChosen = blue;
    let redChosen = 0;

    while (!solutionFound) {
        yellowChosen = blueChosen - 1;
        redChosen = blueChosen + 1;
        if (yellowChosen > yellow || redChosen > red) {
            blueChosen = blueChosen - 1;
        } else {
            solutionFound = true;
        }

    }

    return yellowChosen + blueChosen + redChosen;
}

function findMaxWithRedMinimum(yellow, blue, red) {
    let solutionFound = false;

    let yellowChosen = 0;
    let blueChosen = 0;
    let redChosen = red;

    while (!solutionFound) {
        yellowChosen = redChosen - 2;
        blueChosen = redChosen - 1;
        if (yellowChosen > yellow || blueChosen > blue) {
            redChosen = redChosen - 1;
        } else {
            solutionFound = true;
        }

    }
    return yellowChosen + blueChosen + redChosen;
}


'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 readint() {
    let line = readline().split(' ').map(function(num) {
        return parseInt(num);
    });
    return line;
}

function readfloat() {
    let line = readline().split(' ').map(function(num) {
        return parseFloat(num);
    });
    return line;
}

function print(x) {
    console.log(x);
}

function write(x) {
    process.stdout.write(x);
}
function main() {
    let [n,t,k,d] = readint();
    let times = parseInt(d / t) + 1;
    let qoldi = n - k * times;
    if(qoldi > 0 ) {
        print("YES");
    } else {
        print("NO");
    }

}


var readline = require('readline'),
    rl = readline.createInterface(process.stdin, process.stdout);

rl.on('line', function (line) {

    var n = line.split(' ')
    //n%2==0 && n!=2 ? console.log("YES") : console.log("NO");
    console.log(n % 2 == 0 && n != 2 ? "YES" : "NO");
    rl.close();

}).on('close', function () {

    process.exit(0);
});


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

rl.on('line', function(line) {
    let arr = line.split(' ').map(el => +el);
    console.log(func(arr));
});

const func = ([moves, sweetsLeft]) => {
    let tempMove = 0;
    let tempSweets = 0;
    let lastAddition = 0;
    while (tempMove < moves && (tempSweets - (moves - tempMove) != sweetsLeft)) {
        lastAddition++;
        tempSweets += lastAddition;
        tempMove++;
    }
    return moves - tempMove;
}


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 str = readLine();
  let countPlus = 0;
  const nums = str.split("").reduce((obj, char) => {
    if (char - char === 0) obj[char] = char;
    return obj;
  }, {});

  for (let i = 0; i < str.length; i++) {
    if (str[i] === "+") countPlus++;
  }

  Object.keys(nums).forEach((key) => {
    nums[key] = +nums[key] + countPlus;
  });

  if (str.includes("H") || str.includes("Q") || str.includes("9")) {
    console.log("YES");
  } else {
    console.log("NO");
  }
}


process.stdin.setEncoding('utf8');

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

    console.log(Math.ceil(input / 5));
    process.exit(0);
});


const readline = require('readline')

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

rl.on("line", main)
let i = 0;
let n = 0;
let x = 0;
let s1, s2 = ""
const arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' ,'k', 'l', 'm', 'n', 'o','p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

function main(input){

	if(i == 0){
		s1 = input
		i++
		return
	}
	if(i == 1){
		s2 = input
		i++
	}

	//let x = 0
	//let y = 0

	let r = 0;
	for(var j = 0 ; j < s1.length ; j++){

		let v = arr.indexOf(s1[j].toLowerCase())
		let w = arr.indexOf(s2[j].toLowerCase())

		if(v > w){
			r = 1
			break;
		}
		if(v < w){
			r = -1
			break
		}

	}

	console.log(r)
}


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

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

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

  c++;
});

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

  for (let i = 0; i < a.length; i++) {
    if (aCount.hasOwnProperty(a[i])) {
      aCount[a[i]] += 1;
    }
    else {
      aCount[a[i]] = 1;
    }

    if (bCount.hasOwnProperty(b[i])) {
      bCount[b[i]] += 1;
    }
    else {
      bCount[b[i]] = 1;
    }
  }

  for (let x in aCount) {
    if (bCount.hasOwnProperty(x)) {
      ans += aCount[x] * bCount[x];
    }
  }

  // for (let i = 0; i < a.length; i++) {
  //   for (let j = 0; j < b.length; j++) {
  //     if (a[i] === b[j]) {
  //       ans++;
  //     }
  //   }
  // }

  console.log(ans);
});


let input ='';

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data',(data)=>input+=data)
process.stdin.on('end',()=>{
    let count = 0;
    let tmp = input.split('\n');
    let arr = tmp[1].split(' ').map((val)=>+val).sort((a,b)=>a-b);

    for(let i = 0; i < arr.length; i+=2){
        count+=Math.abs(arr[i]-arr[i+1])
    }
   console.log(count)
})


//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().sort(function(a,b){return a - b;});
  var x1 = one[0];
  var x2 = one[1];
  var x3 = one[2];
  var output = 300;
  for(var i = 1; i <= 100; i++){
    var check = Math.abs(i - x1);
    check += Math.abs(i - x2);
    check += Math.abs(i - x3);
    output = Math.min(output, check);
  }
  myout(output);
}


process.stdin.setEncoding('utf8');
process.stdin.on('readable', () => {
    const chunk = process.stdin.read();
    if (chunk !== null) {
        let re = /\n\s*| /;
        let input = chunk.split(re).slice(0, -1);
        console.log(snowball.apply(null, input.map(value => parseInt(value))));
        process.exit(0);
    }
});

function snowball(w, h, u1, d1, u2, d2) {
    for (; h >= 0; h--) {
        w += h;
        if (h == d1) w -= u1;
        if (h == d2) w -= u2;
        w = Math.max(w, 0);
    }
    return w;
}


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

rl.on('line', (d) => {
  matrix.push(d.split(' ').map(Number));
  c++;
});

rl.on('close', () => {
  const states = new Array(3).fill(0).map(x => new Array(3).fill(1));

  for (let i = 0; i < matrix.length; i++) {
    for (let j = 0; j < matrix[i].length; j++) {
      if (matrix[i][j] % 2) {
        states[i][j] = +!states[i][j];

        let up = i - 1;
        let down = i + 1;
        let left = j - 1;
        let right = j + 1;

        if (up > -1) {
          states[up][j] = +!states[up][j];
        }

        if (down < 3) {
          states[down][j] = +!states[down][j];
        }

        if (left > -1) {
          states[i][left] = +!states[i][left];
        }

        if (right < 3) {
          states[i][right] = +!states[i][right];
        }
      }
    }
  }

  states.forEach(x => console.log(x.join('')));
});


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 [k, n, w] = readLine().split(' ').map(num => Number(num));
  const sum = w * (w + 1) * k / 2 - n;
  console.log(sum > 0 ? sum : 0);
}


"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();

  fn(x);
}

function fn(str) {
  console.log(
    new Set(str.split("")).size % 2 ? "IGNORE HIM!":"CHAT WITH HER!"
  );
}


// Generated by CoffeeScript 2.5.1
var find, lines, mainAux, numMoves, print, readline, rl, rli, sum, write;

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

print = console.log;

write = function(...args) {
  return process.stdout.write(args.join(' '));
};

lines = [];

rl.on('line', function(line) {
  return lines.push(line);
});

rl.on('close', main);

rli = 0;

readline = function() {
  return lines[rli++];
};

sum = function(items) {
  return items.reduce((function(a, b) {
    return a + b;
  }), 0);
};

find = function(input) {
  return [
    input.find((inp) => {
      return inp.includes('1');
    }).split(' ').findIndex((str) => {
      return str === '1';
    }),
    input.findIndex((inp) => {
      return inp.includes('1');
    })
  ];
};

numMoves = function(v) {
  return Math.abs(2 - v);
};

mainAux = function() {
  var input;
  input = [];
  input.push(readline());
  input.push(readline());
  input.push(readline());
  input.push(readline());
  input.push(readline());
  return print(sum(find(input).map(function(v) {
    return numMoves(v);
  })));
};

  function main() {
    return mainAux();
  }
;

//# sourceMappingURL=matrix.js.map


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

let standardInputString = '';
let currentLine = 0;

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

process.stdin.on('data', rawData=> {
    standardInputString += rawData;
})

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

function main() {
    const line1 = readLine().toLowerCase();
    const line2 = readLine().toLowerCase();
    if(line1 < line2) {
        console.log(-1);
    } else if(line1 > line2) {
        console.log(1);
    } else if(line1 === line2) {
        console.log(0);
    }
}


const state = { stdin: Buffer.alloc(0) };
const consume = (chunk) =>
  (state.stdin = Buffer.concat(
    [state.stdin, chunk],
    state.stdin.length + chunk.length
  ));
const commit = (answer) => process.stdout.write(answer);
//
const main = (args) => {
  let data = parseInt(state.stdin.toString("utf8"));
  let solution = "NO";
  if (data < 1 || data > 100) return commit(solution);

  // divide the watermelon into two parts,
  // each of them weighing even (%2==0) number of kilos;

  for (let i = 1; i < data; i++) {
    let part = (data - i) % 2 ===0;
    if (i % 2 === 0 && part) {
      solution = "YES";
    //   console.log(data, partOne, partTwo)
      commit(solution);
      return;
    }
  }
  commit(solution);
};

process.stdin.on("data", consume).on("end", main);


const rl = require('readline')

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

readline.on('line', line => {
	const [y, b, r] = line.split(' ').map(Number)
	let u = 0, v = 0, w = 0
	if (b >= y + 1 && r >= y + 2) u = 3 * y + 3
	if (y >= b - 1 && r >= b + 1) v = 3 * b
	if (b >= r - 1 && y >= r - 2) w = 3 * r - 3
	console.log(Math.max(u, v, w))
})


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

readline.on('line', hay => {
  const needle = 'hello';

  let found = false;
  let needleP = 0;
  let hayP = 0;

  while (hayP < hay.length) {
    // console.log(needleP, hayP, needle[needleP], hay[hayP]);
    if (hay[hayP] === needle[needleP]) {
      needleP++;
      // console.log(needle[needleP - 1], needle[needle.length - 1]);
      if (
        needleP === needle.length &&
        needle[needleP - 1] === needle[needle.length - 1]
      ) {
        found = true;
        break;
      }
    } else if (hay[hayP] === needle[needleP - 1]) {
    }
    hayP++;
  }

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


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++) {
    doit(txt[i]*1);
}

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

}


var n = +readline();
var a = readline().split(' ').map(Number);
var d1 = a.indexOf(1);
if (n - 1 - d1 > d1) d1 = n-1-d1;
var dn = a.indexOf(n);
if (n - 1 - dn > dn) dn = n-1-dn;
print(d1 > dn ? d1 : dn);


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

  driver();
});

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

function driver() {
  const x = readline();
  main(x);
}

function main(string) {
  if (!string.includes('+')) {
    console.log(string);
    return;
  }

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

  console.log(string);
}


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

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

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

  for (let i = 1; i <= 100; i += 1) {
    set.add(m*i);
  }

  let day = 0;
  while (n > 0) {
    n -= 1;
    day += 1;
    if (set.has(day)) n += 1;
  }

  console.log(day);
});


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

rl.on('line', (str) => {
  let letters = 'abcdefghijklmnopqrstuvwxyz';
  let ans = 0;

  for (let i = 0; i < str.length; i++) {
    let c = str[i];

    let idx = 0;
    while (letters[idx] !== c) {
      idx = (idx + 1) % 26;

      if (letters[idx] === c) {
        ans += Math.min(idx, 26 - idx);
        break;
      }
    }

    letters = letters.slice(idx) + letters.slice(0, idx);
  }

  console.log(ans);
});


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

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	let [n, m] = nl.nums();
	let max = Math.max(n,m);
	let cnt = 0;
	for(let a = 0; a <= max; a++){
		for(let b = 0; b <= max - a; b++){
			if (a*a + b === n && a + b*b === m){
				cnt++;
			}
		}
	}
	console.log(cnt);

};

process.stdin.on('end', sol);


let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  canSplitEqually(parseInt(lines, 10)) ? console.log('YES') : console.log('NO');
});

function canSplitEqually(w) {
  return w !== 2 && w % 2 === 0;
}


const readline = require('readline');

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

rl.on('line', line => {
    var [m, n] = line.split(' ');

    if (n == 1) {
        console.log(0);
        rl.close();
        return;
    }

    var result = parseInt(n/2) * m;

    if (n%2 === 1) {
        result += parseInt(m/2);
    }

    console.log(result);

    rl.close();
});


const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
rl.on('line', (inputString) => {
    let numberOfSquares = parseInt(inputString);
    console.log(findTheNumberOfLinesForLady(numberOfSquares));
});

function findTheNumberOfLinesForLady(forTheNumberOfSquaress) {
    let a = Math.sqrt(forTheNumberOfSquaress);
    let b = Math.trunc(a);
    if (a == b) return 2 * a;
    if (b * (b + 1) >= forTheNumberOfSquaress) return 2 * b + 1;
    return 2 * b + 2;
}


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

function main(){
    let a = cin();
    if(a > 2 && a % 2 === 0) cout("YES");
    else cout("NO");
    return 0;
}


const readline = require('readline');

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

const solution = (input) => {
    const vowels = ["A", "O", "Y", "E", "U", "I"];

    const consonants = Array.from(input).filter((item) => {
        return !(vowels.includes(item.toLowerCase()) || vowels.includes(item.toUpperCase()));
    }).map((item) => {
        return item.toLowerCase();
    });

    console.log(`.${consonants.join('.')}`);

    rl.close();
}

rl.question('', (input) => {
    solution(input);
});


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() {
  var strArr = readLine().split(" ").map(Number);
  var k = strArr[0];
  var n = strArr[1];
  var w = strArr[2];
  var result = 0;
  for (let i = 1; i <= w; i++) {
    result += k * i;
  }
  if (result > n) {
    console.log(result - n);
  } else {
    console.log(0);
  }
}


'use strict';

var data = [];

data.push(readline())

function sum(n) {
    return n.split('').map(function (d) {
        return parseInt(d);
    }).reduce(function (s, d) {
        return s + d;
    });
}

function minus1(s, i) {
    if (!s) return '';
    if (s[i] === '0') {
        return rem0(minus1(s.substring(0, i), i - 1) + '9' + '9'.repeat(s.substring(i + 1).length));
    } else {
        return rem0(s.substring(0, i) + String(parseInt(s[i]) - 1) + '9'.repeat(s.substring(i + 1).length));
    }
}
function rem0(s) {
    var i = 0;
    while (s[i] === '0') {
        i++;
    }
    return s.substring(i);
}

function solve() {
    var n1 = data[0];
    if (n1.length === 1) {
        return print(n1);
    }
    var s1 = sum(n1);
    var s2 = 0;
    var n2 = void 0;
    for (var i = 0; i < n1.length - 1; i++) {
        var s9 = minus1(n1, i);
        var s9s = sum(s9);
        if (s9s >= s2) {
            s2 = s9s;
            n2 = s9;
        }
    }

    print(s2 > s1 ? n2 : n1);
}

solve();


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStd) => {
  inputString += inputStd;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  const word = readLine();
  let [lowerCount, upperCount] = [0, 0];
  const isLowerCase = (char) => {
    return char.charCodeAt(0) >= 97 && char.charCodeAt(0) <= 122;
  };
  const convertTo = (word, type = "lower") => {
    const result = [];
    if (type === "upper") {
      for (let i = 0; i < word.length; i++) {
        const char = word[i];
        if (isLowerCase(char)) {
          let charCode = char.charCodeAt(0);
          result.push(String.fromCharCode(charCode - 32));
        } else {
          result.push(char);
        }
      }
    } else {
      for (let i = 0; i < word.length; i++) {
        const char = word[i];
        if (!isLowerCase(char)) {
          let charCode = char.charCodeAt(0);
          result.push(String.fromCharCode(charCode + 32));
        } else {
          result.push(char);
        }
      }
    }
    return result.join("");
  };
  for (let i = 0; i < word.length; i++) {
    if (isLowerCase(word[i])) lowerCount++;
    else upperCount++;
  }
  if (lowerCount >= upperCount) {
    console.log(convertTo(word));
  } else {
    console.log(convertTo(word, "upper"));
  }
}


function processData(input) {
    //Enter your code here
     let  res=input.split("\n"),   n=+(res[0]),
      arr=res[1].split("").filter((x)=>x!==""),
       cnt=dvsr(n);
       //console.log(cnt,arr)
  cnt.forEach((d)=>{
      ////console.log(arr,d)
    let temp="";
    while(d>0){
      temp+=arr.shift();
      d--
    }
    //console.log(arr,temp)
    temp=[...temp].reverse();
    arr=[...temp,...arr];

  })
  console.log(arr.reverse().join(""))
}

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
    _input += input;
});

process.stdin.on("end", function () {
   processData(_input);
});
function dvsr(n){
  let v=Math.sqrt(n),set=new Set()
for(let i=2;i<=v;i++){
  if(n%i===0){
      set.add(i);
      set.add(n/i)
  }
   // cnt.push(i)
}
  let cnt=[...set]
return cnt.sort((a,b)=>a-b)
}


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 len = +readLine();
  const str = readLine();
  let count = 0;
  for (let i = 0; i < len - 1; i++) {
    if (str[i] === str[i + 1]) count++;
  }
  console.log(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);
   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){
    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));}
      //[no]要素の扱い。数値型
      //不明値、異常時:引数そのまま返す 1:数値へ変換
      //2:半角SPで分割 4:半角SPで分割し、数値配列へ
      //6:1文字で分割  7:1文字で分割し、数値配列へ
      //8:半角SPで結合 9:改行で結合 0:文字なしで結合
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 output = [];

    var ul = next();
    var arr = nextIntArray() ;
    var brr = nextIntArray() ;
    arr.sort() ;
    brr.sort();
    var crr = arr.filter(x=>brr.includes(x));
    if(crr.length > 0) {
        myout(crr[0]) ;
    }
    else {
        var l = Math.min(arr[0],brr[0]) ;
        var h = Math.max(arr[0],brr[0]) ;
        myout(l+""+h)
    }

}


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

  const arr = d.split(' ').map(Number);
  let ans = 0;
  const coins = {};

  for (let i = 0; i < arr.length; i++) {
    if (coins.hasOwnProperty(arr[i])) {
      coins[arr[i]]++;
    }
    else {
      coins[arr[i]] = 1;
    }

    ans = Math.max(ans, coins[arr[i]]);
  }

  console.log(ans);

  c++;
});


var readline = require('readline');
var z = readline.createInterfrace

var r = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});
r.on('line', function (line) {
        r.close();
        bain(line);

});
function bain(line){
    let  b= line.split(" ");
    let n = b[0];
    let m = b[1];
    let a = b[2];
    let z = Math.ceil(n/a);
    let y = Math.ceil(m/a);
    console.log(z*y);
}


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

rl.on('line', (str) => {
  let ans = 0;
  const obj = {
    a: true,
    e: true,
    i: true,
    o: true,
    u: true,
    1: true,
    3: true,
    5: true,
    7: true,
    9: true
  };

  for (let i = 0; i < str.length; i++) {
    if (obj[str[i]]) {
      ans++;
    }
  }

  console.log(ans);
});


function solve(n) {
  let rest = n;
  let count = 0;
  while (rest > 0) {
    rest -= Math.max(...rest.toString().split(""));
    count += 1;
  }
  return count;
}

function* main() {
  const n = parseInt(yield);
  const r = solve(n);
  console.log(r);
  process.exit(0);
}

if (!module.parent) {
  (() => {
    const q = main();
    q.next();
    require("readline")
      .createInterface({
        input: process.stdin,
        output: null
      })
      .on("line", line => q.next(line));
  })();
}

exports.solve = solve;


'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 readAsInt(){
  return parseInt(readline());
}

function readAsIntList(){
  return readline().split(' ').filter(i => i).map(i => parseInt(i));
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  let [n, k] = readAsIntList();
  for(let i = 1; i <= k; i++) {
    if(n % 10 === 0) {
      n = n / 10;
    } else {
      n = n - 1;
    }
  }
  console.log(n);
}


const readline = require('readline').createInterface({input: process.stdin})
let lines = [];
readline.on("line", line => {
    lines.push(line);
}).on("close", () => {

    let myArray = lines[0].split('+');
    myArray.sort();
    console.log(myArray.join('+'));

});


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

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

const isCapitalize = ch => ch === ch.toUpperCase();

readLine.on('close', () => {
  const str = input[0];
  let flag = true;

  if (str.length === 1) {
    if (!isCapitalize(str[0]))
     console.log(str.toUpperCase());
    else
      console.log(str.toLowerCase());
    return
  }

  for (let i = 1; i < str.length; i += 1) if(!isCapitalize(str[i])) flag = false;

  if (flag) {
    if (isCapitalize(str[0]))
      console.log(str[0].toLowerCase() + str.slice(1).toLowerCase());
    else
      console.log(str[0].toUpperCase() + str.slice(1).toLowerCase());
    return;
  }

  console.log(str);
});


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

rl.on('line', (d) => {
  const arr = d.split(' ').map(Number);
  const max = Math.max(...arr);
  const min = Math.min(...arr);
  const point = arr.find((x) => x !== max && x !== min, 0);
  let ans = 0;

  for (let i = 0; i < arr.length; i++) {
    ans += Math.abs(point - arr[i]);
  }

  console.log(ans);
});


'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', _ => {
    solveWrap(inputString);
});

function solve(n){
	const bills = [1, 5, 10, 20, 100].reverse();
	let sum = 0;
	let acc = 0;
	let current = n;
	for (let el of bills) {
		while(el<=current){
			current-=el;
			acc++;
		}
	}
	return acc;
}

function solveWrap(input) {
    let n = input.trim().split('\n');
	console.log(solve(+n));
}


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStd) => {
  inputString += inputStd;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let num = readLine()
    .split("")
    .map((n) => parseInt(n));
  const map = {};
  for (let i = 0; i < num.length; i++) {
    if (!map[num[i]]) map[num[i]] = 1;
    else map[num[i]]++;
  }
  function isLucky(num) {
    if (!num) return false;
    while (num) {
      if (num % 10 !== 4 && num % 10 !== 7) return false;
      num = parseInt(num / 10);
    }
    return true;
  }
  let [four, seven] = [map["4"] || 0, map[7] || 0];
  const total = four + seven;
  if (isLucky(total)) console.log("YES");
  else 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', (d) => {
  let [n, m, z] = d.split(' ').map(Number);
  let ans = 0;

  for (let i = m; i <= z; i += m) {
    if (i % n === 0) {
      ans++;
    }
  }

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


//Word

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

let inp = '';

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

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

    let small = 0;
    for(let i = 0; i < lines.length; i++)  {
    	if(lines[i] >= 'a' && lines[i] <= 'z')  {
    		small++;
    		if(small > lines.length / 2)  {
    			break;
    		}
    	}
    }

    if(small >= lines.length / 2)  {
    	process.stdout.write(lines.toLowerCase());
    }  else  {
    	process.stdout.write(lines.toUpperCase());
    }

    return;
});


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() {
  var T = readLine();
  var Tarr = T.split(" ");
  var t1 = parseInt(Tarr[0]);
  var t2 = parseInt(Tarr[1]);
  var count = 0;
  var scores = readLine();
  var scoresArr = scores.split(" ");
  scoresArr = scoresArr.map(Number);
  var passScore = scoresArr[t2 - 1];
  for (let i = 0; i < t1; i++) {
    if (scoresArr[i] >= passScore && scoresArr[i] > 0) {
      count++;
    }
  }
  console.log(count);
}


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

  const training = {
    chest: 0,
    biceps: 0,
    back: 0
  };

  const arr = d.split(' ').map(Number);

  arr.forEach((x, idx) => {
    if (idx % 3 === 0) {
      training.chest += x;
    }

    if (idx % 3 === 1) {
      training.biceps += x;
    }

    if (idx % 3 === 2) {
      training.back += x;
    }
  });

  if (training.chest > training.biceps && training.chest > training.back) {
    console.log('chest');
  }
  else if (training.biceps > training.chest && training.biceps > training.back) {
    console.log('biceps');
  }
  else if (training.back > training.chest && training.back > training.biceps) {
    console.log('back');
  }

  c++;
});


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*/

    let teamsCount = parseInt(lines[0])

    let homeKitColors = Array(teamsCount)
    let awayKitColors = Array(teamsCount)

    for (i = 1; i <= teamsCount; i++) {
        let teamKits = lines[i].split(" ").map(value => {
            return parseInt(value)
        })

        homeKitColors[i-1] = teamKits[0]
        awayKitColors[i-1] = teamKits[1]

    }

    let overlappingKitCount = 0
    for(i = 0; i < teamsCount; i++) {
        for(j = 0; j < teamsCount; j++) {
            if (j === i) { continue }
            if (homeKitColors[i] === awayKitColors[j]) {
                overlappingKitCount++
            }
        }
    }

    console.log(overlappingKitCount)
})


const readline = require('readline');

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

var check = function (x, y, z) {
    if (x + y > z && x + z > y && y + z > x) return 'T';
    if (x + y == z || x + z == y || y + z == x) return 'S';
    return 'I';
};

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

    var cont = input.split(' ').map(item => parseInt(item));
    var a = cont[0],
        b = cont[1],
        c = cont[2],
        d = cont[3];
    if (check(a, b, c) == 'T' ||
        check(a, b, d) == 'T' ||
        check(a, d, c) == 'T' ||
        check(d, b, c) == 'T') console.log("TRIANGLE");
    else if (check(a, b, c) == 'S' ||
        check(a, b, d) == 'S' ||
        check(a, d, c) == 'S' ||
        check(d, b, c) == 'S') console.log("SEGMENT");
    else console.log("IMPOSSIBLE");
    rl.close();
});


'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    // if(Array.isArray(inputString)) inputString = inputString.join('\n');
    inputString += inputStdin;
    // inputString = inputString.trim().split('\n').map(string => {
    //     return string.trim();
    // });

    // main();
});

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

    main();
});

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

function readAsInt(){
  return parseInt(readline());
}

function readAsIntList(){
  return readline().trim().split(' ').filter(i => i).map(i => parseInt(i));
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  let n = readAsInt();
  console.log(n % 2 === 0 ? ( n + n*-1/2 ) : ( (n + 1)*-1/2));
}


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() {
  var T = readLine();
  var result = readLine()
    .split(" ")
    .map(Number)
    .sort((a, b) => a - b)
    .join(" ");
  console.log(result);
}


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

let lines = [];

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

reader.on('close', () => {
	//Code goes here. Input is in lines
	var [n, m, a] = lines[0].split(" ");
	var ans = Math.ceil(n/a) *Math.ceil(m/a);
	console.log(ans);
});


"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 x = readline();
  console.log(x.split('+').sort().join('+'));
}
function foo(x) {
  process.stdout.write("hello: "); // without auto '\n' (newline)
  console.log(x); // with auto '\n' (newline)
}


//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 t = next();
  var list = nextStrArray();
  for(var i = 0; i < list.length; i++){
  	if(list[i].indexOf(t[0]) != -1 || list[i].indexOf(t[1]) != -1){
      myout("YES");
      return;
    }
  }
  myout("NO");
}


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

readline.on('line', input => {
  let n = input;
  const div = [4, 7, 47, 74, 444, 447, 474, 744, 477, 747, 774, 777];

  console.log(div.some(lucky => n % lucky === 0) ? 'YES' : 'NO');
});


function solve(n, str) {
    str = str.toLowerCase();
    let m = {};
    for (let c = 'a'.charCodeAt(0); c <= 'z'.charCodeAt(0); c++) {
        m[c] = false;
    }
    str.split('').forEach(letter => {
        m[letter.charCodeAt(0)] = true;
    });
    for (var key in m) {
        if (m.hasOwnProperty(key) && m[key] === false) {
            return "NO\n";
        }
    }
    return "YES\n";
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    console.log(solve(lines[0], lines[1]));
})


const readline = require('readline');
const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout
})
let line
let c = 0
rl.on('line', (cmd) => {
	line = cmd
	rl.close()
})
rl.on('close', () => {
	process.stdout.write(test(line.split(" ")))
})
function test(list) {
	let cost = 0
	for (let i = 1; i <= list[2]; i++) {
		cost += i * list[0]
	}
	return cost - list[1] > 0 ? String(cost - list[1]) : "0"
}


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

isT = true;

readLine.on("line", line => {
    if (isT) {
        isT = false;
    } else {
        countPress(line);
    }
});

function countPress(num) {
    let str = num;
    num = parseInt(num);
    let count = str.length;
    let sum = 0;
    let flag = false;
    for(let i = 1; i <= num%10; i++) {
        for (let j = 1; j <= 4; j++) {
            if(i == num%10 && j == count) {
               //sum += count;
               sum += j;
               flag = true;
               break;
            }
            sum += j;
        }
        if (flag) {
            break;
        }
    }
    console.log(sum);
}


var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const [n, m, k] = rna();

		function check (n, m, k) {
			if (k < 0) return false;
			if (k > n*m/2) return false;
			if (k%2 == 0)  return true;
			else false;
		}

		let ans;
		if (n%2 == 0 && m%2 == 0)
			ans = check(n, m, k);
		else if (n%2 == 0) {
			ans = check(n, m - 1, k);
		} else {
			ans = check(n - 1, m, k - m/2);
		}

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


const stdin = process.openStdin();
stdin.addListener('data', text => {
  const numbers = text.toString().split(' ');
  console.log(Math.ceil(numbers[0] / numbers[2]) * Math.ceil(numbers[1] / numbers[2]));
  stdin.pause();
});


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

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    [n, h, m] = d.split(' ').map(Number);
    arr = new Array(n).fill(h);
    return;
  }

  const [l, r, x] = d.split(' ').map(Number);

  for (let i = l - 1; i <= r - 1; i++) {
    if (x < arr[i]) {
      arr[i] = x;
    }
  }

  c++;
});

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

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

  console.log(ans);
});


const readline = require('readline');

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

let days, toSF = toSea = 0;

rl.on('line', n => {
  if (!days) { days = n } else {
    n.toLowerCase().split('')
      .forEach((letter, i, arr) =>
          letter !== arr[i - 1] && i !== 0 && (letter === 'f' ? toSF++ : toSea++));
    console.log(toSF > toSea ? 'YES' : 'NO');
    rl.close();
  }
});


const state = { stdin: Buffer.alloc(0) };
const consume = (chunk) =>
  (state.stdin = Buffer.concat(
    [state.stdin, chunk],
    state.stdin.length + chunk.length
  ));
const commit = (answer) => process.stdout.write(answer);
const main = (args) => {
  let [n, m, a] = state.stdin
    .toString("utf8")
    .split(" ")
    .map((e) => parseInt(e));
  let d1 = Math.ceil(n / a);
  let d2 = Math.ceil(m / a);
  let ans = d1 * d2;

  commit(ans.toString());
};
process.stdin.on("data", consume).on("end", main);


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

rl.on('line', (d) => {
  const [n] = [d].map(BigInt);
  const total = n * (n + 1n) / 2n;

  console.log((total % 2n).toString());
});


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 str = readLine().split(" ");
  var firstName = str[0];
  var lastName = str[1];

  var first = firstName[0];

  for (var i = 1; i < 10; i++) {
    if (firstName[i] < lastName[0]) {
      first += firstName[i];
    } else {
      break;
    }
  }
  console.log(first + lastName[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));

  const people = {
    1: 'Sheldon',
    2: 'Leonard',
    3: 'Penny',
    4: 'Rajesh',
    5: 'Howard',
  };

  if (n <= 5) console.log(people[n]);
  else {
    let left = 5;
    let boundary = 15;
    let count = 2;

    while (true) {
      if (n >= left && n <= boundary)
        break;
      left = boundary;
      count = count * 2;
      boundary = count * 5 + left;
    }

    //console.log(`people = ${count}; left = ${left}; right = ${boundary}`);
    let s = 1;
    for (let i = left; i <= boundary; i += count) {
      if (i <= n && i+count >= n) {
        console.log(people[s]); break;
      }
      s += 1;
    }
  }
});


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

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

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

  while (t > 0) {
    for (let i = 1; i < queue.length; i += 1) {
      if (queue[i] === 'G' && queue[i-1] === 'B') {
        queue[i] = 'B'; queue[i-1] = 'G'; i += 1;
      }
    }
    t--;
  }

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


"use strict";
let input = [];
const readline=require('readline');
const RL=readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
RL.on('line', (line)=>{
  input.push(line.trim());
});
RL.on('close', ()=>{
  const vowels=['a', 'o', 'y', 'e', 'u', 'i'];
  const arr=input[0].toLowerCase().split('');
  let answer=arr.map((ch) => {
    if(vowels.includes(ch)){
      return "";
    }

    return "."+ch;
  });

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


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

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

const dominos = () =>{
    const [n, k] = input[0].split(' ').map(x => +x);
    let s = n * k;
    let q = Math.floor(s / 2);
    console.log(q);
};

readLine.on('close', dominos);


let data = '';
process.stdin.on('data', c => data += c);
const sol = () => {
    let num = Number(data.split(/\n/g)[0]);
    let result = [];
    let flag = true;
    while (num > 0 || flag) {
        let d = num%10;
        num = Math.trunc(num/10);
        result.push(((d >= 5)?'-O':'O-') +
                '|' +
                ['-OOOO', 'O-OOO', 'OO-OO', 'OOO-O', 'OOOO-'][d%5]);
        flag = false;
    }
    console.log(result.join('\n'));
};
process.stdin.on('end', sol);


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

  const arr = d.split(' ').map(Number);
  const sum = arr.reduce((a, b) => a + b, 0);
  let max = Math.max(...arr);
  let r = 0;

  for (let i = 0; i < arr.length; i++) {
    r += max - arr[i];
  }

  // while (r <= sum) {
  //   r += arr.length;
  //   max++;
  // }

  if (sum - r >= 0) {
    max += Math.floor((sum - r) / arr.length) + 1;
  }

  console.log(max);

  c++;
});


/* scheme2js generated file Fri, 16 Oct 2020 16:24:07 +0800 */
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
const print = console.log
const write = (...args) => {
    process.stdout.write(args.join(' '));
}
const lines = []
rl.on('line', line => {
    lines.push(line);
});
rl.on('close', main)
let rli = 0;
function readline() {
    return lines[rli++];
}

function main() {
var BGl_rze21ze2zzscm2js1008z00;
var BGl_mze22ze2zzscm2js1008z00;
var BGl_nze23ze2zzscm2js1008z00;
var num = readline().split(" ").map(x => parseInt(x));
BGl_nze23ze2zzscm2js1008z00 = num[0];
BGl_mze22ze2zzscm2js1008z00 = num[1];
BGl_rze21ze2zzscm2js1008z00 = num[2];
(print(((((parseInt((BGl_nze23ze2zzscm2js1008z00+BGl_rze21ze2zzscm2js1008z00-1)/BGl_rze21ze2zzscm2js1008z00)))*((parseInt((BGl_mze22ze2zzscm2js1008z00+BGl_rze21ze2zzscm2js1008z00-1)/BGl_rze21ze2zzscm2js1008z00)))))));
}


const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
function sort(array) {
    // use custom compare function that sorts numbers ascending
    alert(ary.sort(function(a, b) {
        return a - b;
    }));
}

var array =[];
var newarr = [];
rl.question(``, (count) => {
    var a = '';
    for (let index = 0; index < count.length; index++) {
       if(count[index]!='+'){
          a =a+count[index];
       }else{
           array.push(a);
           a='';
       }
       if(count.length-index == 1){
        array.push(a);
       }

    }
   array = array.sort(function(a, b) {
    return a - b;
  });
  console.log(array.join('+'));
    rl.close();
  })


let input = [];

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

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

RL.on('close', () => {
    let n = input[0];
    let count_v = 1;

    for(let i = 2; i < n/2+1; i++){
        if( (n-i) % i == 0){
            count_v ++;
        }
    }

    console.log(count_v);
});


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 ++) {
    doit(txt[i]);

}

function doit(str) {
    let tab =str.split("").filter(data=>{return data.length>0});
    let stab=[]
    tab.forEach(data => {
        if(data.charCodeAt()<97){
            stab.push("U");
        }else{
            stab.push("L")
        }
    });
    let r=stab.filter(data=>{return data=="L"}).length
    if(r==0 ||(r==1 && stab[0]=="L")){
        tab.forEach((data,index)=>{
            if(data.charCodeAt()<97){
                stab[index]=data.toLowerCase()
            }else{
                stab[index]=data.toUpperCase()
            }
        })
        console.log(stab.join(""));

    }else{
        console.log(str);

    }

}


const readline = require("readline");

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

let q = {};

rl.on("line", (input) => {
  for (c of input) {
    q[c] = true;
  }

  if (Object.keys(q).length % 2) {
    console.log("IGNORE HIM!");
  } else {
    console.log("CHAT WITH HER!");
  }
  rl.close();
});


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

const solution = (cardOnTable, cardsInHand) => {
  if (cardsInHand.indexOf(cardOnTable[0]) >= 0 || cardsInHand.indexOf(cardOnTable[1]) >= 0){
	return "YES";
  } else {
	return "NO";
  }
};


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

rl.on('line', (str) => {
    console.log(str.split('+').sort((a, b) => a - b).join('+'));
});


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

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

  const soroban = {
    0: 'O-|-OOOO',
    1: 'O-|O-OOO',
    2: 'O-|OO-OO',
    3: 'O-|OOO-O',
    4: 'O-|OOOO-',
    5: '-O|-OOOO',
    6: '-O|O-OOO',
    7: '-O|OO-OO',
    8: '-O|OOO-O',
    9: '-O|OOOO-',
  };

  if (n === 0) {
    console.log(soroban[0]);
    return;
  }

  while (n > 0) {
    const digit = n % 10;
    n = Math.floor(n / 10);

    console.log(soroban[digit]);
  }

});


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

let cMax = 5;
let mMax = 10;

rl.on('line', (d) => {
  if (c === 0) {
    cups = d.split(' ').map(Number).reduce((a, b) => a + b, 0);
  }

  if (c === 1) {
    medals = d.split(' ').map(Number).reduce((a, b) => a + b, 0);
  }

  if (c === 2) {
    n = +d;
  }

  c++;
});

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

  ans += Math.ceil(cups / cMax);
  ans += Math.ceil(medals / mMax);

  if (ans > n) {
    console.log('NO');
  }
  else {
    console.log('YES');
  }
});


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

  main();
});

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

function main() {
  const firstLine = readLine();
  const weight = parseInt(firstLine, 10);
  // const a = readLine().split(' ').map(aTemp => parseInt(aTemp, 10));

  console.log(watermelon(weight));
}

function watermelon(weight) {
  for (let i = 2; i <= weight / 2; i += 2) {
    if ((weight - i) % 2 === 0) {
      return "YES";
    }
  }
  return "NO";
}


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 arr = [];
  for (var k = 0; k < 5; k++) {
    var inp = readLine().split(" ").map(Number);
    arr.push(inp);
  }

  var m, n;
  for (var i = 0; i < 5; i++) {
    for (var j = 0; j < 5; j++) {
      if (arr[i][j] == 1) {
        m = i;
        n = j;
      }
    }
  }

  var sum;

  sum = Math.abs(m - 2) + Math.abs(n - 2);

  console.log(sum);
}


process.stdin.on('data', function(chunk){
	var lns = chunk.toString().replace(/\r/g, "").split(/\n/);
	var hs = '', gs = '', r = 0;
	for(var i = 0, l = lns.splice(0, 1)[0]; i<l; i ++) {
		ln = lns[i].split(' ').map(e=>"|" + e + "|");
		r += (hs.split(ln[1]).length - 1) + (gs.split(ln[0]).length - 1);
		hs += ln[0];
		gs += ln[1];
	}
	console.log(r);
});


const readline = require('readline');

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

var str;

function main() {
	rl.question('', (answer) => {
		if (answer.length) {
			str = answer;
			rl.close();
			solve();
		}
	});
}
function solve() {
	var a = [];
	for(var i=0; i<str.length; i+=2) a.push(str[i]);
	a.sort();
	var res = a[0];
	for(var i=1; i<a.length; i++) res += '+'+a[i];
	console.log(res);
}
main();


var stdin = process.stdin;
stdin.setEncoding( 'utf8' );
stdin.on( 'data', function( key ){
    const weight = parseInt(key);
    const available = (weight !== 2) && (weight % 2 === 0);
    process.stdout.write(available ? "YES" : "NO" );
});


function main() {
    // write code here:
    var arr = stdin[0].match(/[a]/gi);
    var sLen = stdin[0].length;
    var aLen = arr.length;
    console.log(aLen > sLen / 2 ? sLen : aLen*2-1);
}

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);


'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 input1 = readline().split(' ');
  let m = parseInt(input1[0]);
    let n = parseInt(input1[1]);

     maxNumDominoes(m, n)
};

function maxNumDominoes(n, m){

  console.log(Math.floor((n * m) / 2));
}


'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 lines = 5;

  let matrix = [];

  while (lines-- > 0) {
    let array = readline()
      .split(' ')
      .map((int) => parseInt(int));

    matrix.push(array);
  }

  let x;
  let y;

  for (let i = 0; i < 5; i++) {
    for (let j = 0; j < 5; j++) {
      if (matrix[i][j] === 1) {
        x = i + 1;
        y = j + 1;
      }
    }
  }

  console.log(Math.abs(3 - x) + Math.abs(3 - y));
}


process.stdin.resume();
process.stdin.setEncoding('utf8');
var input= '', readline, 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;
    readline = function(){return inputLineIndex>=input.length?undefined:input[inputLineIndex++]};
    process.exit(main() || 0);
});

function main()
{
    let a = readline();
    if(a > 2 && a % 2 === 0) console.log("YES");
    else console.log("NO")
    return 0;
}


const readline = require('readline');

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

rl.on('line', (input) => {
    rl.close();
    console.log(solve(input));
});

const solve = (word) => {
    let moves = 0;
    let currentChar = 'a';
    const alphapet = {
        a: 1,
        b: 2,
        c: 3,
        d: 4,
        e: 5,
        f: 6,
        g: 7,
        h: 8,
        i: 9,
        j: 10,
        k: 11,
        l: 12,
        m: 13,
        n: 14,
        o: 15,
        p: 16,
        q: 17,
        r: 18,
        s: 19,
        t: 20,
        u: 21,
        v: 22,
        w: 23,
        x: 24,
        y: 25,
        z: 26
    }

    for (let i = 0; i < word.length; i++) {
        let char = word[i];
        let clockWise = Math.abs(alphapet[currentChar] - alphapet[char]);
        let antiClockWise = 26 - clockWise;
        moves += clockWise < antiClockWise ? clockWise : antiClockWise;
        currentChar = char;
    }

    return moves;
}


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

var lines = {};
cs.on("line", (input) => {
  if (input == "") {
    cs.close();
  }
  lines[line_number] = input.split(" ");
  line_number += 1;
}).on("close", () => {
  main();
  process.exit();
});

function isOp(str) {
  return str.length === 1 && str.match(/[<=>]/);
}
function isChr(str) {
  return str.length === 1 && str.match(/[a-z]/i);
}
function isInt(str) {
  return str.length === 1 && !isNaN(str);
}

function print(str) {
  console.log(str);
}

function predict(test) {
  let op = "";
  let ops = [];
  let opVariables = [];
  let limits = [];
  for (let t of test) {
    // console.log(t);
    for (let i = 0; i < t.length; i++) {
      if (isOp(t[i])) {
        op = t[i];
        if (isOp(t[i + 1])) {
          op += t[i + 1];
          i += 1;
        }
        ops.push(op);
        op = "";
      } else if (isChr(t[i])) {
        // console.log(t[i])
        op = t[i];
        for (var j = i + 1; j < t.length; j++) {
          if (isChr(t[j]) || isInt(t[j])) {
            op += t[j];
            i = j;
          } else break;
        }
        opVariables.push(op);
        op = "";
      } else {
        if (i == 0 || (i > 0 && isOp(t[i - 1]))) {
          op = t[i];
          let j = i + 1;
          for (; j < t.length; j++) {
            if (isInt(t[j])) {
              op += t[j];
              i = j;
            } else break;
          }
          limits.push(op);
          op = "";
        }
      }
    }
  }

  let min = limits[0];
  let max = limits[1];

  let pvs = ops.map((o, i) => [o, opVariables[i]]);

  for (let pv of pvs) {
    if (pv[1] == undefined) {
      pv[1] = max;
    }
    // print(`${min} ${pv[0]} ${pv[1]} ?`)
    if (eval(`${min}${pv[0]}${pv[1]}`)) {
      // print(` ${min} ${pv[0]} ${pv[1]} true`)
      min = pv[1];
    } else {
      print("input error");
      process.exit();
    }
  }
}

var n;
function main() {
    let str1 = lines[0][0].toLowerCase();
    let str2 = lines[1][0].toLowerCase();
    if (str1 > str2)
        print(1)
    else if (str1 < str2)
        print(-1)
    else
        print(0)
}


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

// read each line
rl.on("line", (lineInput) => {
  let params = lineInput.split(" ");
  console.log(Math.floor((params[0] * params[1]) / 2));
});

// when all file readed
rl.on("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 readint() {
    let line = readline().split(' ').map(function(num) {
        return parseInt(num);
    });
    return line;
}

function readfloat() {
    let line = readline().split(' ').map(function(num) {
        return parseFloat(num);
    });
    return line;
}

function print(x) {
    console.log(x);
}

function write(x) {
    process.stdout.write(x);
}
function main() {
    let line = readline();
    let arr = [];
    for(let i = 0; i < line.length; i+=2) {
        arr.push(line[i]);
    }
    let len = arr.length;
    arr.sort((a, b) => (a - b));
    arr.forEach((v,i) => {
        if(i != len - 1) write(v +="+");
            else write(v);
    });
}


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

rl.question('',(val)=>{
  if(val>2 && val%2==0){
    console.log('YES');
  }else{
    console.log('NO');
  }
  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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function main(){
    var inp = readLine();
    var n = parseInt(inp.split(" ")[0]);
    var m = parseInt(inp.split(" ")[1]);
    var a = parseInt(inp.split(" ")[2]);
  var res = 0;
  res+= Math.ceil(n/a) * Math.ceil(m/a);

console.log(res);

}


const readline = require("readline");

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

rl.on("line", (input) => {
  const [m, n, a] = input.split(/\s+/).map((n) => parseInt(n));
  //
  const rows = Math.ceil(m / a);
  const columns = Math.ceil(n / a);
  const total = rows * columns;
  //
  console.log(total);
  process.exit();
  //
});


const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
 removeDups = (string) => {
    return string
      .split('')
      .filter((item, pos, self) =>{
        return self.indexOf(item) == pos;
      })
      .join('');
  }

let userName = " " ;
rl.on("line",(input)=>{
        userName = removeDups((input))
        // console.log(userName)
        if(userName.length % 2 == 0 )
        {
            console.log("CHAT WITH HER!") ;
            rl.close();
        }
        else
        {
            console.log("IGNORE HIM!" )
            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() {
	const str = readline();
	let result = 0;
	let diff = 0;

	diff = Math.abs('a'.charCodeAt() - str[0].charCodeAt());
	result += 26 - diff < diff ? 26 - diff : diff;
	for (let i = 0; i < str.length - 1; i++) {
		diff = Math.abs(str[i].charCodeAt() - str[i + 1].charCodeAt());
		result += 26 - diff < diff ? 26 - diff : diff;
	}

	console.log(result);
	return;
}


const readline = require('readline');

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

rl.on('line', function(line){
	let [a, b, c] = line.split(' ').map(i => parseInt(i));
	a = a % c !== 0 ? Math.floor(a / c) + 1 : a / c;
	b = b % c !== 0 ? Math.floor(b / c) + 1 : b / c;
	console.log(a * b);
	rl.close();
});


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

let stdin = '';

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

process.stdin.on('end', () => {
  const data = stdin.split('\n')[1];

  let counter = 0;
  let current;

  data.split('').forEach((value) => {
    if (value === current) counter++;
    else current = value;
  });

  process.stdout.write(`${counter}`);
});


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 = [...input[0]];
  if (parseInt(n) >= 0) console.log(n.join(''))
  else {
    let modify = [...n];
    modify.pop();
    let t = [...n];
    t.splice(n.length-2, 1);

    if (parseInt(modify.join('')) > parseInt(t.join(''))) {
      console.log(parseInt(modify.join('')) === 0 ? 0 : parseInt(modify.join('')))
    } else {
      console.log(parseInt(t.join('')) === 0 ? 0 : parseInt(t.join('')));
    }
  }
});


"use strict";
// NYAN NYAN
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄░░░░░░░░░
// ░░░░░░░░▄▀░░░░░░░░░░░░▄░░░░░░░▀▄░░░░░░░
// ░░░░░░░░█░░▄░░░░▄░░░░░░░░░░░░░░█░░░░░░░
// ░░░░░░░░█░░░░░░░░░░░░▄█▄▄░░▄░░░█░▄▄▄░░░
// ░▄▄▄▄▄░░█░░░░░░▀░░░░▀█░░▀▄░░░░░█▀▀░██░░
// ░██▄▀██▄█░░░▄░░░░░░░██░░░░▀▀▀▀▀░░░░██░░
// ░░▀██▄▀██░░░░░░░░▀░██▀░░░░░░░░░░░░░▀██░
// ░░░░▀████░▀░░░░▄░░░██░░░▄█░░░░▄░▄█░░██░
// ░░░░░░░▀█░░░░▄░░░░░██░░░░▄░░░▄░░▄░░░██░
// ░░░░░░░▄█▄░░░░░░░░░░░▀▄░░▀▀▀▀▀▀▀▀░░▄▀░░
// ░░░░░░█▀▀█████████▀▀▀▀████████████▀░░░░
// ░░░░░░████▀░░███▀░░░░░░▀███░░▀██▀░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
const CODEFORCES_NODE = "cf";
const CODEFORCES_V8 = "cf-v8";
const BEAKJOON = "bj";
const TEST = "test";
const PROGRAMMERS = "ps";
var SITE = CODEFORCES_NODE;
// var SITE = CODEFORCES_NODE;
// var SITE = PROGRAMMERS;
var DEBUG = false;
if (SITE == BEAKJOON) {
    if (!String.prototype.startsWith) {
        String.prototype.startsWith = function (search, pos) {
            return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
        };
    }
    if (!String.prototype.endsWith) {
        String.prototype.endsWith = function (search, this_len) {
            if (this_len === undefined || this_len > this.length) {
                this_len = this.length;
            }
            return this.substring(this_len - search.length, this_len) === search;
        };
    }
    if (!String.prototype.repeat) {
        String.prototype.repeat = function (count) {
            'use strict';
            if (this == null) {
                throw new TypeError('can\'t convert ' + this + ' to object');
            }
            var str = '' + this;
            count = +count;
            if (count != count) {
                count = 0;
            }
            if (count < 0) {
                throw new RangeError('repeat count must be non-negative');
            }
            if (count == Infinity) {
                throw new RangeError('repeat count must be less than infinity');
            }
            count = Math.floor(count);
            if (str.length == 0 || count == 0) {
                return '';
            }
            // Ensuring count is a 31-bit integer allows us to heavily optimize the
            // main part. But anyway, most current (August 2014) browsers can't handle
            // strings 1 << 28 chars or longer, so:
            if (str.length * count >= 1 << 28) {
                throw new RangeError('repeat count must not overflow maximum string size');
            }
            var maxCount = str.length * count;
            count = Math.floor(Math.log(count) / Math.log(2));
            while (count) {
                str += str;
                count--;
            }
            str += str.substring(0, maxCount - str.length);
            return str;
        };
    }
}
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ HELPER ALGORITHMS/POLYFILLS ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
function getCombinations2(n) {
    let ret = [];
    for (let start = 0; start < n; start++) {
        for (let k = start + 1; k < n; k++) {
            let s = new Set();
            s.add(start);
            s.add(k);
            ret.push(s);
        }
    }
    return ret;
}

function getSubbits(n) {
    let ret = [];
    for (var subset = n; subset; subset = (subset - 1) & n) {
        ret.push(subset);
    }
    return ret;
}
String.prototype.replaceAt = function (index, replacement) {
    return this.substr(0, index) + replacement + this.substr(index + replacement.length);
};
Function.prototype.repeat = function (times, callback = undefined) {
    for (let i = 0; i < times; i++) {
        this();
    }
    return callback ? callback() : null;
};
Array.prototype.getMaxConsecutiveSum = function (defaultValue = -Infinity) {
    const N = this.length;
    let maxsum = defaultValue;
    let cursum = defaultValue;
    let cur;
    for (var ii = 0; ii < N; ii++) {
        cur = this[ii];
        if (cursum + cur > 0) {
            if (cur > cursum + cur) {
                cursum = cur;
            } else
                cursum += cur;
        } else {
            cursum = cur;
            if (maxsum < cursum) {
                maxsum = cursum;
            }
        }
        if (maxsum < cursum) {
            maxsum = cursum;
        }
    }
    this.maxConsecutiveSum = maxsum;
    return maxsum;
};
try {
    require('manakin').global;
    // require ("babel-polyfill");
} catch (error) {}
try {
    process.argv.forEach(function (val, index, array) {
        if (val.startsWith("site")) {
            switch (val.split("=")[1]) {
                case "test":
                    // console.log('change site to test')
                    SITE = TEST;
                    break;
                case "cf-node":
                    // console.log('change site to cf')
                    SITE = CODEFORCES_NODE;
                    break;
                case "cf":
                    // console.log('change site to cf')
                    SITE = CODEFORCES_NODE;
                    break;
                case "cf-v8":
                    // console.log('change site to cf')
                    SITE = CODEFORCES_V8;
                    break;
                case "bj":
                    // console.log('change site to bj')
                    SITE = BEAKJOON;
                    break;
            }
        }
        if (val.startsWith("debug")) {
            switch (val.split("=")[1]) {
                case "true":
                    DEBUG = true;
                    break;
                case "false":
                    DEBUG = false;
                    break;
            }
        }
    });
} catch (error) {}
let inputFilePath = '';
switch (SITE) {
    case TEST:
        const config = require('config');
        var fs = require("fs");
        var path = require('path');
        inputFilePath = config.get('INPUTFILEPATH') || path.resolve(__dirname, "input.txt");
        break;
    default:
        inputFilePath = './input.txt';
        break;
}
const INPUTFILEPATH = inputFilePath;
// if (!String.prototype.endsWith) {
// 	String.prototype.endsWith = function(search, this_len) {
// 		if (this_len === undefined || this_len > this.length) {
// 			this_len = this.length;
// 		}
// 		return this.substring(this_len - search.length, this_len) === search;
// 	};
// }
// if (!Array.prototype.includes) {
//   Array.prototype.includes = function (target) {
//     return this.indexOf(target) !== -1
//   }
// }
if (!Array.prototype.sortNumber) {
    /**
     * @memberof Array
     * @summary sorts array by number
     */
    Array.prototype.sortNumber = function (order = 'asc') {
        return this.sort((a, b) => ((order == 'asc') ? 1 : -1) * (+a - +b));
    };
}
const newLine = '\n';
var ans;
var inputText = "";
var lineCount = 0;
var lines;
var input;
/**
 * @type {(trim?=true)=>string}
 */
var readline;
var getlines;
var lineOpen = false;
var readingLine = '';
var clockStart;
var clock;
/**
 * @type {typeof import('glob')}
 */
var glob;
var customFilesPattern = 'inputs/**/*.in';
var customFiles = [];
var print;
print = console.log;
var it;
var step;

function EnableLogging() {
    it = console.info;
    step = console.success;
}

function DisableLogging() {
    it = function it(params) {
        return 0;
    };
    step = it;
}

function RunCustomTests() {
    // glob = require('glob');
    // it(process.cwd());
    // it(process.cwd() + customFilesPattern);
    // glob(customFilesPattern, (er,files)=>{
    //   console.log('files count: ' + files.length);
    //   files.forEach(file=>{
    //     console.log(`custom test case files : ${file}`);
    //     customFiles.push(file);
    //   })
    // });
    // var path2 = process.cwd().replace(/\\/g, "/");
    // path = require('path');
    // glob("*.js", (er,files)=>{
    //   console.log('files count: ' + files.length);
    //   files.forEach(file=>{
    //     console.log(`custom test case files : ${file}`);
    //   })
    // });
    // customFiles.forEach(file=>{
    //   const filePath = process.cwd() + file;
    //   console.info(filePath);
    // })
}
if (DEBUG) {
    EnableLogging();
    clock = function (start) {
        if (!start)
            return process.hrtime();
        var end = process.hrtime(start);
        return Math.round((end[0] * 1000) + (end[1] / 1000000));
    };
} else {
    DisableLogging();
}
// prepares test data. to replace line input, assign arrays to lines variable.
function prepareTestData() {
    // it(lines);
    // lines = ['custom line 1', 'custom line 2'];
}
// executes exactly once for both test and run. execution time will be included to elapsed time.
const prepareSolve = () => {};

function power(x, y) {
    let ret = 1;
    while (y > 0) {
        if (y % 2) {
            ret *= x;
            ret %= P;
        }
        x *= x;
        x %= P;
        y /= 2;
    }
    return ret;
}

function createArray(lengths) {
    var arr = new Array(lengths || 0),
        i = lengths;
    if (arguments.length > 1) {
        var args = Array.prototype.slice.call(arguments, 1);
        while (i--)
            arr[lengths - 1 - i] = createArray.apply(this, args);
    }
    return arr;
}

function numericSortList(list) {
    list.sort((a, b) => a - b);
}

function getRectangleIntersection(r1, r2) {
    if (r1.x > r2.x + r2.w)
        return null;
    if (r1.x + r1.w < r2.x)
        return null;
    if (r1.y > r2.y + r2.h)
        return null;
    if (r1.y + r1.h < r2.y)
        return null;
    var rect = {};
    rect.x = Math.max(r1.x, r2.x);
    rect.y = Math.max(r1.y, r2.y);
    rect.w = Math.min(r1.x + r1.w, r2.x + r2.w) - rect.x;
    rect.h = Math.min(r1.y + r1.h, r2.y + r2.h) - rect.y;
    return rect;
}

function getRandomNumber(to, from) {
    if (from == undefined) {
        return Math.floor(Math.random() * to + 1);
    }
    return Math.floor(Math.random() * (to - from) + from);
}
/**
 * a queue that will be stop working someday.
 */
class TerminallyIllQueue {
    constructor() {
        this.data = {};
        this.head = 0;
        this.tail = 1;
    }
    length() {
        return this.tail - this.head - 1;
    }
    enqueue(v) {
        this.data[this.tail - 1] = v;
        this.tail++;
    }
    dequeue() {
        const v = this.data[this.head];
        this.head++;
        return v;
    }
}
/**
 * @template T
 * @type {TwoDimensionalMap<T>}
 */
class TwoDimensionalMap {
    constructor() {
        this.data = {};
    }
    /**
     * @memberof TwoDimensionalMap<T>
     * @public
     * @param {number} x
     * @param {number} y
     * @returns {T}
     */
    getPosition(x, y) {
        return this.data[`${x}.${y}`];
    }
    /**
     * @memberof TwoDimensionalMap<T>
     * @public
     * @param {number} x
     * @param {number} y
     * @param {T} value
     */
    setPosition(x, y, value) {
        this.data[`${x}.${y}`] = value;
    }
}
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ MAIN SOLVE FUNCTION ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
function solve() {
    const [h1,m1] = readline().split(':').map(x=>+x);
    const [h2,m2] = readline().split(':').map(x=>+x);
    const mm1 = h1*60 + m1;
    const mm2 = h2*60 + m2;
    const avgm = (mm1+mm2)/2;
    let h = (avgm - avgm%60)/60;
    // h =(h1+h2)/2;
    if(h<10) h = '0'+h;
    let m = avgm%60;
    // m =  (m1+m2)/2;
    if(m<10) m = '0'+m;
    print(`${h}:${m}`);
}
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
function resetRead() {
    lineCount = 0;
}

function checkMemoryUsage() {
    it(process.memoryUsage());
}

function readOne(separator = ' ') {
    if (lineOpen && readingLine != null) {
        // if(lineOpen){
        // it(readingLine);
        let splitPos = readingLine.search(separator);
        let ret = readingLine.slice(0, splitPos);
        if (splitPos == -1) {
            // it('close');
            ret = readingLine;
            readingLine = '';
            lineOpen = false;
        }
        readingLine = readingLine.substr(splitPos + 1);
        // it(ret, readingLine, splitPos);
        if (ret == '' || ret == separator) {
            return readOne(separator);
        } else {
            return ret;
        }
    } else {
        readingLine = readline();
        lineOpen = true;
        if (readingLine == null)
            return '';
        return readOne(separator);
    }
}

function ri() {
    return +readOne();
}

function ria() {
    return readInts();
}
/**
 * @return {string}
 */
function rs() {
    return readOne();
}
/**
 * @return {string[]}
 */
function rsa() {
    return readline().split(' ');
}
/**
 * @returns {number[]}
 */
function readInts() {
    try {
        lineOpen = false;
        return readline()
            .split(" ")
            .map(x => parseInt(x));
    } catch (error) {
        console.error(error);
        return null;
    }
}
let inputListener;
let readlines;
switch (SITE) {
    case TEST:
        var fs = require("fs");
        var path = require('path');
        // input = fs.createReadStream(path.resolve(__dirname, "input.txt"), {
        //   encoding: "utf8"
        // });
        input = fs.createReadStream(INPUTFILEPATH, {
            encoding: "utf8"
        });
        inputListener = (line) => {
            console.log(line);
            if (line.startsWith('end')) {
                console.log('end');
                closing();
            }
            if (!line) {
                closing();
            }
            lineCount++;
            inputText += line + "\r\n";
        };
        readlines = () => {
            const readline = require("readline");
            const rl = readline.createInterface({
                input,
                output: process.stdout,
                terminal: false
            });
            rl.on("line", inputListener);
            rl.on('close', closing);
        };
        getlines = function* (inputText) {
            var lines = inputText.split(/\r?\n/);
            for (let line of lines) {
                yield line + newLine;
            }
        };
        readline = function (trim = true) {
            const lineval = lines.next().value;
            return trim ? lineval.trim() : lineval;
        };
        readlines();
        break;
    case CODEFORCES_NODE:
        input = process.stdin;
        inputListener = (line) => {
            if (!line) {
                closing();
            }
            lineCount++;
            inputText += line + "\r\n";
        };
        readlines = () => {
            const readline = require("readline");
            const rl = readline.createInterface({
                input,
                output: process.stdout,
                terminal: false
            });
            rl.on("line", inputListener);
            rl.on('close', closing);
        };
        getlines = function* (inputText) {
            var lines = inputText.split(/\r?\n/);
            for (let line of lines) {
                yield line + newLine;
            }
        };
        readline = function (trim = true) {
            const lineval = lines.next().value;
            return trim ? lineval.trim() : lineval;
        };
        readlines();
        break;
    case BEAKJOON:
        var fs = require('fs');
        if (DEBUG) {
            // input = fs.readFileSync('./input.txt').toString();
            inputText = fs.readFileSync(INPUTFILEPATH).toString();
        } else {
            inputText = fs.readFileSync('/dev/stdin').toString();
        }
        readline = function (trim = true) {
            lineCount++;
            let line = lines[lineCount - 1];
            if (line)
                return trim ? lines[lineCount - 1].trim() : lines[lineCount - 1];
            else
                return null;
        };
        getlines = function (inputText) {
            lineCount = 0;
            return inputText.split(/\r?\n/);
        };
        // lines = getlines(input);
        closing();
        break;
    case PROGRAMMERS:
        //자체 함수를 실행할 것이므로 아무것도 하지 않는다.
    default:
        break;
}

function closing() {
    if (DEBUG) {
        DisableLogging();
        const prepareClock = clock();
        lines = getlines(inputText);
        prepareSolve();
        const prepareClockElapsedTime = clock(prepareClock);
        EnableLogging();
        prepareTestData();
        solve();
        console.warn('done. running custom tests');
        RunCustomTests();
        resetRead();
        console.warn('performance check');
        DisableLogging();
        clockStart = clock();
        // lines = getlines(inputText);
        solve();
        console.warn(`${clock(clockStart) + prepareClockElapsedTime} ms`);
        EnableLogging();
        process.exit();
    } else {
        lines = getlines(inputText);
        prepareSolve();
        solve();
        process.exit();
    }
}


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, k] = readLine().split(' ');
  const arr = readLine().split(' ').map(num => Number(num));
  console.log(arr.filter(a => a > 0 && a >= arr[k - 1]).length);
}


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() {
	let [a, b] = readLine()
		.split(' ')
		.map(x => parseInt(x));
	let s = a;
	let hours = 0;

	while (Math.floor(a / b) > 0) {
		hours += Math.floor(a / b);
		a = Math.floor(a / b) + (a % b);
	}

	console.log(Math.round(s + hours));
}