// Sample code to perform I/O:

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

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

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

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

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

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

// Write your code here
function nameLookUp(str) {

    let n = +str.trim();
    let count = 0;
    let inc = 0;
    while (count <= n) {
        inc++;
        count += (inc * (inc + 1)) / 2;
    }
    return (inc - 1).toString();
}


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

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
	if(N % 2 == 0){
		myout(N / 2 + 1);
	}else{
		myout(Math.ceil(N / 2));
	}
}


const readline = require('readline');

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

const solve = (input) => {

  splitWatermelon = (weight) => {
    for (let w1 = 1; w1 < weight; w1++) {
      let w2 = weight - w1;

      if (w1 % 2 === 0 && w2 % 2 === 0 ) {
        return true;
      }

    }

    return false;
  }

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

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


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 str1 = readLine().toLowerCase();
  var str2 = readLine().toLowerCase();
  var result = str1.localeCompare(str2);
  console.log(result);
}


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

let c = 0;
let x1, y1, x2, y2;

rl.on("line", (d) => {
  if (c === 0) {
    [x1, y1] = d.split(" ").map(Number);
    c++;
    return;
  }

  [x2, y2] = d.split(" ").map(Number);
  const ans = Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2));
  console.log(ans);
  c++;
});


// Sample code to perform I/O:

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

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

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

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

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

// Write your code here
function nameLookUp(str) {

    let inputs = +str.trim();
    let bills = [1, 5, 10, 20, 100];
    let billLength = bills.length;
    let moves = 0;
    while (inputs) {
        let diff = inputs - bills[billLength - 1];
        if (diff >= 0) {
            moves++;
            inputs = diff;
        }

        for (let index = billLength - 1; index >= 0; index--) {
            let diff = inputs - bills[index];
            if (diff >= 0) {
                inputs = diff;
                moves++;
                break;
            }

        }
    }

    return moves.toString();
}


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 k = readLine() >> 0,
		l = readLine() >> 0,
		m = readLine() >> 0,
		n = readLine() >> 0,
		d = readLine() >> 0;

	let hit = 0;
	for (let i = 1; i <= d; ++i)
		if (i % k === 0 || i % l === 0 || i % m === 0 || i % n === 0) hit++;

	console.log(hit);
}


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 solve() {
    let l1 = readLine();
    let l2 = readLine();
    let s1 = l1.toLowerCase().split();
    let s2 = l2.toLowerCase().split();
    let l = l1.length;
    for (var i = 0; i < l; i++) {
        if (s1[i] > s2[i])
            return 1;
        else if (s1[i] < s2[i])
            return -1
    }
    return 0;
}

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


var input = null;
//input = ['2'];
function main(input) {
    var w = parseInt(input[0]);
    if (w == 2)
        solution('NO');
    for (var i = 2; i < 50; i += 2) {
        if (w % 2 == 0)
            solution('YES');
    }
    solution('NO');
}
///////////////////////////////////////////////////////////////////////////////////////
if (!input) {
    var input_1 = '';
    process.stdin.on('data', function (char) { return input_1 += char; });
    process.stdin.on('end', function () {
        var EOL = require('os').EOL;
        var inputs = input_1.split(EOL).slice(0, -1);
        main(inputs);
    });
}
else
    main(input);
function solution(data) {
    console.log(data);
    process.exit(0);
}


// https://codeforces.com/problemset/problem/977/B
// Big O:
// Time complexity: O(n)
// Space complexity:

const readline = require("readline");

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

let stringLength;
rl.on('line', (input) => {
    if (stringLength) {
        console.log(findMostCommonGram(input, stringLength));
        rl.close();
    } else {
        stringLength = input;
    }
});

// Problem
function findMostCommonGram(string, stringLength) {
    let mostCommonGram = "";
    let mostCommonGramOccurrences = 0;
    const gramOccurrences = {};

    for (let i = 0; i < stringLength - 1; i++) {
        const twogram = string[i] + string[i + 1];
        const occurrences = gramOccurrences[twogram] ? gramOccurrences[twogram] : 0;
        const currentOcurrences = occurrences + 1;
        if (currentOcurrences > mostCommonGramOccurrences) {
            mostCommonGram = twogram;
            mostCommonGramOccurrences = currentOcurrences;
        }

        gramOccurrences[twogram] = currentOcurrences;
    }

    return mostCommonGram;
}


const readline = require('readline');

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

let n = 0
rl.on('line', (l) => {
  n = parseInt(l)
  let d = [100, 20, 10, 5, 1]
  let count = 0

  d.some((x) => {
    //if (n / x === 0) return true;
    count += Math.floor(n / x);
    n = n % x;
  })

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


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 str1 = readLine().toLowerCase();
	const str2 = readLine().toLowerCase();

	let diff = 0;

	for (let i = 0, l = str1.length; i < l; ++i) {
		if (str1.charCodeAt(i) === str2.charCodeAt(i)) {
			continue;
		} else {
			diff = str1.charCodeAt(i) - str2.charCodeAt(i);
			break;
		}
	}

	const res = diff < 0 ? -1 : diff > 0 ? 1 : 0;
	console.log(res);
}


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

// single line input
readline.on('line', line => {
readline.close(), line = line.split(" ").map(item => parseInt(item))
console.log(theaterSquare(line[0], line[1], line[2]))
});

function theaterSquare(n, m, a) {
    let x = Math.ceil(n/a), y = Math.ceil(m/a)
    return x * y
}


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

readline.question("", (weight) => {
    weight!=2?weight%2==0?console.log("YES"):console.log("NO"):console.log("NO");
    readline.close()
})


var readline = (()=>{
    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++];
    }
    return readline;
})()

function main() {
	console.log(readline().match(/(.)\1*/g).filter(str=>str.length%2===0).length);

}


const readline = require('readline');

let inputs = [];

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

// Read Inputs
rl.on('line', inputLine => {
    let nums = inputLine.split(' ').map(num => parseInt(num));
    let n = nums[0];
    let m = nums[1];
    let a = nums[2];
    let b = nums[3];

    if (n === 1) {
        if (a < b)
            return console.log(a)
        else
            return console.log(b)
    } else if (n % m === 0) {
        if (a < b) {
            return console.log(n * a)
        } else {
            return console.log(Math.ceil((n / m)) * b)
        }
    } else {
        if (m > n)
            return console.log(b)
        else if ( a < b) {
            return console.log((Math.floor((n / m)) * b) + (n % m) * a)
        } else {
            return console.log((Math.floor((n / m)) * b) + b)
        }

    }

    return console.log(n)

});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    const x = readline();
    var line2 = readline();

    // console log function here
    console.log(removeAdjacent(x, line2));
}

// function here

function removeAdjacent(l, s) {

	let sArr = Array.from(s);

	// create a dictionary where every letter in associated the its positions in the string,
	// and a linkde list where every element has a reference in the dictionary near the position here stored

	let sll = {value:s[0], prev: null, next: null};
	let lettersDict = {[s[0]]: [{position: 0, elem: sll}]};
	let start = sll;
	let currElemLinkedList = sll;

	for (let i = 1; i < l; i++) {
		let curr = s[i];

		currElemLinkedList.next = {value:curr, prev: currElemLinkedList, next: null};
		if (curr in lettersDict) {
			lettersDict[curr].push({position: i, elem: currElemLinkedList.next});
		}
		else {
			lettersDict[curr] = [{position: i, elem: currElemLinkedList.next}];
		}

		currElemLinkedList = currElemLinkedList.next;
	}

	let end = currElemLinkedList;

	// order the keys of the dictionary by ascii value
	const keys = Object.keys(lettersDict);
	keys.sort((a, b) => {
		return b.charCodeAt(0) - a.charCodeAt(0)
	});

	// for every entry in keys check the string for adjacents
	return keys.reduce((acc, curr) => {
		let nEliminated = 0;

		for (let i = 0; i < lettersDict[curr].length; i++) {
			let elem = lettersDict[curr][i].elem;
			if (elem) {
				let position = lettersDict[curr][i].position;

				let leftComparable = elem.prev && elem.prev.value;
				let rightComparable = elem.next && elem.next.value;

				if ((leftComparable && (leftComparable.charCodeAt(0) - elem.value.charCodeAt(0) == -1)) ||
					(rightComparable && (rightComparable.charCodeAt(0) - elem.value.charCodeAt(0) == -1))) {
					nEliminated++;

					lettersDict[curr][i].elem = null;
					if (leftComparable === elem.value) {
						i -= 2
					}
					let prev = elem.prev;
					let next = elem.next;
					if (prev) {
						prev.next = next;
					}
					if (next) {
						next.prev = prev;
					}

				}

			}
		}

		return acc + nEliminated;
	}, 0)
}


let input = [];

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

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

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

    if(code.length == 1){
        console.log(code.charAt(0)); process.exit();
    }

    let answer = ''
    let j = 0;
    for(let i = 0; i < n; i++, j+=i){
        answer += code.charAt(j);
    }
    console.log(answer);
});


const readline = require('readline');

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

let data = [];
rl.on('line', (input) => {
   data.push(input);
});

rl.on('close', () => {
   solve(data);
});

function solve(data) {

   s1 = data[0];
   s2 = data[1];

   console.log(compare(s1, s2));

}

function compare(s1, s2) {
   for (let i = 0; i < s1.length; i++) {
      s1c = s1[i].toLowerCase().charCodeAt(0);
      s2c = s2[i].toLowerCase().charCodeAt(0);
      if (s1c > s2c) {
         return 1;
      } else if (s1c < s2c) {
         return -1;
      }
   }
   return 0;
}


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

const lines = [];

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

const processAngles = (n, angles) => {
  for (let i = 0; i < 2 ** (n - 1); i += 1) {
    const bitbask = i.toString(2).padStart(angles.length, '0');
    const rotation = angles.reduce((acc, angle, idx) => {
      if (bitbask[idx] === '0') {
        return acc + angle;
      }

      return acc - angle;
    }, 0);

    if (rotation % 360 === 0) {
      return 'YES';
    }
  }

  return 'NO';
};

readline.on('close', () => {
  const [n, ...angles] = lines;

  console.log(processAngles(n, angles));
});


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));
    process.exit();
});

function findTheNumberOfLinesForLady(forTheNumberOfSquaress) {
    let a = Math.sqrt(forTheNumberOfSquaress);
    let b = Math.trunc(a);
    if (a == b) return (a + a);
    if (b * (b + 1) >= forTheNumberOfSquaress) return b + b + 1;
    return b + b + 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() {
	const [m, n] = readLine()
		.split(' ')
		.map(x => x >> 0);

	console.log(Math.floor((m * n) / 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 divideEvenWatermelon(weight) {
    if ((weight < 1 && weight > 100 ) || (weight % 2 !== 0)) return 'NO';
    if (weight === 2) return 'NO';
    let evenWeights = [];
    for (let i = 0; i < weight; i++) {
        if (i % 2 === 0 && i > 0) {
            evenWeights.push(i);
        }
    }
    for (let i = 0; i < evenWeights.length; i++) {
        for (let j = 0; j < evenWeights.length; j++) {
            if (evenWeights[i] + evenWeights[j] === weight) return 'YES';
        }
    }
}

function main() {
    const x = +(readline());
    console.log(divideEvenWatermelon(x));
}


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

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

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

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

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

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

  console.log(max);

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


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

rl.on('line', (line) => {
    const [length, index] = line.split(' ').map(Number);
    const half = length % 2 === 0 ? length / 2 : parseInt(length / 2) + 1;
    if (index > half) {
        // console.log(`(${index} - ${half}) * 2 `);
        console.log((index - half) * 2)
    } else {
        console.log((index * 2) - 1)
    }
});


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

process.stdin.on("data", function(chunk) {
  main(chunk.toString().split("\n"));
});

function main(stdIn = []) {
  let [num, k] = stdIn[0].split(" ");
  while (k > 0) {
    const dec = num % 10 > k ? k : num % 10;
    k = num % 10 == 0 ? k - 1 : k - dec;
    num = num % 10 == 0 ? num / 10 : num - dec;
  }
  console.log(num);
}


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 arr = [];
	for (i = 0; i < 5; i++) {
		arr[i] = readLine()
			.split(' ')
			.map(x => x >> 0);
	}

	let cord = [];
	let brk = false;

	for (let i = 0; i < 5; i++) {
		for (let j = 0; j < 5; j++) {
			if (arr[i][j] === 1) {
				cord.push(i, j);
				brk = true;
				break;
			}
		}
		if (brk) break;
	}

	const moves = Math.abs(2 - cord[0]) + Math.abs(2 - cord[1]);
	console.log(moves);
}


//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 s = next().toLowerCase();
  var s = myconv(s, 0);
  var output = "";
  var b = "aiueoy";
  for(var i = 0; i < s.length; i++){
    if(b.indexOf(s[i]) == -1){
      output += "." + s[i];
    }
  }
  myout(myconv(output, 0));
}


const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let input = [];
rl.on('line', (inputString) => {
    input = input.concat(inputString.split(' '));
    if (input.length == 6) {
        let [w, h, u1, d1, u2, d2] = input.map(v => parseInt(v));
        for (; h >= 0; h--) {
            w += h;
            if (h == d1) w -= u1;
            if (h == d2) w -= u2;
            w = Math.max(w, 0);
        }
        console.log(w);
        process.exit();
    }
});


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

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

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

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

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

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

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

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

function main() {
	let n = readLine() >> 0;
	let f = readLine()
		.split(' ')
		.map(x => x >> 0);

	let s = f.reduce((a, c) => a + c);
	let c = 0;
	let i = 1;
	while (i <= 5) {
		if ((s + i) % (n + 1) !== 1) c++;
		i++;
	}
	console.log(c);
}


process.stdin.setEncoding('utf8');

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

    if (input !== null) {
        let xss = 0;

        for (let i = 0; i < input.length; i++) {
            if (input[i] == 'x') {
                if (input.substring(i).startsWith('x'.repeat(3))) {
                    xss++;
                }
            }
        }

        process.stdout.write(`${xss}\n`);
        process.exit(0);
    }
});


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 t = Number(readLine())
    for (let _i = 0; _i < t; _i++) {
        const [n, k, l] = readLine().split(/\s/).map(Number)
        const ds = readLine().split(/\s/).map(Number)
        let result = true
        for (let i = 0; i < n; i++) {
          const d = ds[i]
          let tide = l - d
          if (tide < 0) {
            result = false
            break
          }
          if (tide >= k) {
            continue
          }
          let increasing = tide === 0
          let iDiff = 1
          while(i + iDiff < n) {
            tide = increasing ? tide + 1 : tide - 1
            if (tide === 0) {
              increasing = true
            }
            const _d = ds[i + iDiff]
            if (_d <= l - k) {
              break
            }
            if (_d + tide > l) {
              tide = l - _d
              if (increasing || tide < 0) {
                result = false
                break
              }
              if (tide === 0) {
                increasing = true
              }
            }
            iDiff++
          }
          if (!result) {
            break
          }
          i = i + iDiff
        }
      console.log(result ? 'Yes' : 'No')
    }
}


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

// read each line
rl.on("line", (lineInput) => {
  if (lineInput % 2 == 0 && lineInput != 2) {
    console.log("Yes");
  } else console.log("NO");
});

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

minClicks(n, m);
}

function minClicks(n, m) {
  let queue = [n];
  let distance = new Map();
  distance.set(n, 0);
  // BFS
  while (queue[0] != m) {
    let cur = queue.shift();

    let curDist = distance.get(cur) + 1;
    if (!distance.get(cur - 1) && cur > 0 ) {
      distance.set(cur - 1, curDist);
      queue.push(cur - 1);
    }
    if (!distance.get(cur * 2) && cur < 10000) {
      distance.set(cur * 2, curDist);
      queue.push(cur * 2);
    }
  }
  console.log(distance.get(m));
}


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

rl.on('line', (line) => {
    const [n, m, a] = line.split(' ').map(i => parseInt(i));

    let x;
    if (a >= n) {
        x = 1;
    } else {
        x = Math.floor(n / a) + (n % a ? 1 : 0);
    }

    let y;
    if (a >= m) {
        y = 1;
    } else {
        y = Math.floor(m / a) + (m % a ? 1 : 0);
    }

    console.log(x * y);
});


"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() {
    var x = readLine();
    x = parseInt(x);
    var arr = [4,7,47,74,44,444,447,474,477,777,774,744];
    var flag = false;
    for(var i = 0; i < arr.length; i++) {
        if(x % arr[i] === 0) {
            flag = true;
        }
    }
    if(flag === true) {
        console.log("YES\n");
    } else {
        console.log("NO\n");
    }
}


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

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

readLine.on('close', () => {
  let [bear1, bear2] = input[0].split(' ')
  bear1 = parseInt(bear1)
  bear2 = parseInt(bear2)
  let [DelimiterBear1, DelimiterBear2] = '3 2'.split(' ')
  DelimiterBear1 = parseInt(DelimiterBear1)
  DelimiterBear2 = parseInt(DelimiterBear2)
  let count = 0
  while (bear1 <= bear2) {
    bear1 = bear1 * DelimiterBear1
    bear2 = bear2 * DelimiterBear2
    count++
  }
  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 s = next();
  var used = new Set();
  for(var i = 0; i < s.length; i++){
    used.add(s[i]);
  }
  myout((used.size % 2 == 0) ? "CHAT WITH HER!" : "IGNORE HIM!");
}


//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[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 w = nextInt();

  for(var i = 1; i < w; i++){
      if(i % 2 == 0 && (w - i) % 2 == 0){
          myout("YES");
          return;
      }
  }
  myout("NO");

}


// Generated by CoffeeScript 2.5.1
var lines, mainAux, print, readline, rl, rli, 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++];
};

mainAux = function() {
  var args, weight;
  args = readline();
  weight = args;
  if (weight < 4) {
    return print('NO');
  }
  if ((weight - 2) % 2 === 0) {
    return print('YES');
  } else {
    return print('NO');
  }
};

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

//# sourceMappingURL=watermelon.js.map


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

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const n = parseInt(arr.shift())
  if(n  == 1){
    console.log('Ehab')
  }

  else if(n % 2 == 0){
    console.log('Mahmoud')
  }
  else {
    console.log('Ehab')
  }
})


// https://codeforces.com/problemset/problem/4/A

function main(weight) {
  process.stdout.write(weight > 2 && weight % 2 === 0 ? 'YES' : 'NO')
}

// Handle standard input
process.stdin.resume()
process.stdin.setEncoding('utf-8')

let inputString = ''

process.stdin.on('data', (inputStdin) => inputString += inputStdin)
process.stdin.on('end', () => main(+inputString.trim()))


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

    let third = y - x;
    let fourth = third - y;
    let fifth = fourth - third;
    let sixth = fifth - fourth;
    if (n % 6 === 1) {
        if (Math.sign(x) !== -1) {
            console.log(x % 1000000007);
        } else {
            console.log(((x % 1000000007) + 1000000007) % 1000000007);
        }
    } else if (n % 6 === 2) {
        if (Math.sign(y) !== -1) {
            console.log(y % 1000000007);
        } else {
            console.log(((y % 1000000007) + 1000000007) % 1000000007);
        }
    } else if (n % 6 === 3) {
        if (Math.sign(third) !== -1) {
            console.log(third % 1000000007);
        } else {
            console.log(((third % 1000000007) + 1000000007) % 1000000007);
        }
    } else if (n % 6 === 4) {
        if (Math.sign(fourth) !== -1) {
            console.log(fourth % 1000000007);
        } else {
            console.log(((fourth % 1000000007) + 1000000007) % 1000000007);
        }
    } else if (n % 6 === 5) {
        if (Math.sign(fifth) !== -1) {
            console.log(fifth % 1000000007);
        } else {
            console.log(((fifth % 1000000007) + 1000000007) % 1000000007);
        }
    } else if (n % 6 === 0) {
        if (Math.sign(sixth) !== -1) {
            console.log(sixth % 1000000007);
        } else if (Math.sign(sixth) === -1) {
            console.log(((sixth % 1000000007) + 1000000007) % 1000000007);
        }
    }
}


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 len = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  let [completed, i, sum] = [false, 0, 0];

  while (!completed) {
    i = i % arr.length;
    sum += arr[i];
    if (sum >= len) {
      console.log(i + 1);
      completed = true;
    }
    i++;
  }
}


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

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var max = Math.max(one[0], one[1]);
  var min = Math.min(one[0], one[1]);
  var ok = min;
  max -= min;
  var ng = Math.floor(max / 2);
  myout(ok + " " + ng);
}


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let input = '';
process.stdin.on('data', (line) => {
    input += line;
});
process.stdin.on('end', () => {
    const lines = input.split('\n');
    const k = BigInt(lines.shift());
    const occur = Array(10).fill(1n);
    let count = 1n;
    let index = 0;
    while (count < k) {
        occur[index]++;
        count = occur.reduce((acc, value) => acc * value, 1n);
        index++;
        if (index === 10) {
            index = 0;
        }
    }
    const word = "codeforces";
    const ans = occur
        .map((value, index) => word[index].repeat(Number(value)))
        .join('');
    console.log(ans);
});
// input helper
function lineToNumArray(line) {
    return line.split(' ').map(element => parseInt(element, 10));
}


const input = [];

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

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

RL.on('close', () => {
  const str = input[0];
  let nowPos = 0, answer = 0;

  for (let i = 0; i < str.length; i += 1) {
    let pos = parseInt(str.charCodeAt(i), 10) - 97;
    if (pos !== nowPos) {
      let left  = Math.abs(pos - nowPos);
      let right = 26 - nowPos + pos;
      if (pos > nowPos) {
        right = 26 - pos + nowPos;
      }

      answer += Math.min(left, right)
    }

    nowPos = pos;
  }

  console.log(answer);
});


'use strict'

const B = '127'
const S = '32767'
const I = '2147483647'
const L = '9223372036854775807'

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  ipt = ipt.trim()
  console.log(
    fit(ipt, B) && 'byte'
    || fit (ipt, S) && 'short'
    || fit (ipt, I) && 'int'
    || fit (ipt, L) && 'long'
    || 'BigInteger'
  )

  function fit (a, b) {
    if (a.length < b.length) return true
    if (a.length > b.length) return false
    for (let i = 0; i < a.length; i += 5) {
      const ap = +a.slice(i, i + 5)
      const bp = +b.slice(i, i + 5)
      if (ap < bp) return true
      if (ap > bp) return false
    }
    return true
  }
})


const readline = require('readline');

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

function is_unique(str) {
    var obj = {};
    for(var z=0; z < str.length; z++) {
        var ch = str[z];
        if(obj[ch]) return false; else obj[ch] = true;
    }
    return true;
}

rl.question('', (inputLine) => {
    let obj = {};
    let distinct = 1;
    let loopIndex = parseInt(inputLine) + 1;

    for(let i = loopIndex; i <= 10000; i++) {
        let year = i + '';
        // console.log(year);
        if(is_unique(year)){
            console.log(year);
            break;
        }
    }

    rl.close();
});


const readline = require('readline');

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

var inp = [];
var ninp = 0;

function main() {
	rl.question('', (answer) => {
		if (answer.length) {
			inp.push(answer);

			ninp++;
			if(ninp == 2){ rl.close(); solve(); }
			else main();
		}
	});
}
function solve() {
	var n = inp[0]*1;
	var s = inp[1];
	var cont1=0, cont2=0;
	var a = ['R','B'];
	for(var i=0; i<s.length; i++){
		if(s[i] == a[0]){
			cont1++;
		} else a[0] = s[i];
		if(s[i] == a[1]){
			cont2++;
		} else a[1] = s[i];
	}
	if(cont1 > cont2) cont1 = cont2;
	console.log(cont1);
}
main();


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

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

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

  let sum = 0;
  let days = 0;
  while (k > 0 && days < n) {
    sum += arr[days];
    let maxCandies = Math.min(8, sum);

    k -= maxCandies;
    sum -= maxCandies;
    days++;
  }

  if (k > 0) {
    console.log(-1);
  }
  else {
    console.log(days);
  }

  c++;
});


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

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

  const arr = [0, ...d.split(' ').map(Number)];
  let ans = 0;
  let L = m - 1;
  let R = m + 1;
  while (L > 0 || R < arr.length) {
    if (arr[L] !== 0 && arr[L] <= k) {
      ans = 10 * Math.abs(m - L);
      break;
    }

    if (arr[R] !== 0 && arr[R] <= k) {
      ans = 10 * Math.abs(m - R);
      break;
    }

    L--;
    R++;
  }

  console.log(ans);

  c++;
});


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, m] = input[0].split(" ").map(x => parseInt(x));
  if (n < m) { console.log('-1'); return }

  //console.log(`n = ${n}; m = ${m}; n/m = ${n/m}`);
  console.log(Math.ceil(n/2/m) * m);
});


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

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

  let ans = 0;
  let counter = 0;

  for (let i = 0; i < str.length; i++) {
    if (str[i] === 'x') {
      counter++;
    }
    else {
      counter = 0;
    }
    if (counter >= 3) {
      ans++;
    }
  }

  console.log(ans);

  c++;
});


// https://codeforces.com/problemset/problem/977/A
// Big O:
// n: iterations, m: length of the string
// Time complexity: O(n*m) => O(n)
// Space complexity: O(n*m) => O(n)

const readline = require("readline");

function substract(number, iterations) {

    let result = number;
    while (iterations > 0) {
        const lastDigit = getLastDigit(result);
        if (lastDigit == 0) {
            result = removeLastDigit(result);
        } else {
            result -= 1;
        }

        iterations--;
    }

    return result;
}

function getLastDigit(number) {
    const { numberAsString, numberLength } = getNumberStringValues(number);
    const lastDigit = numberAsString.charAt(numberLength - 1);
    return parseInt(lastDigit);
}

function removeLastDigit(number) {
    const { numberAsString, numberLength } = getNumberStringValues(number);
    const numberWithoutLastDigit = numberAsString.slice(0, numberLength - 1);
    return parseInt(numberWithoutLastDigit);
}

function getNumberStringValues(number) {
    const numberAsString = number.toString();
    const numberLength = numberAsString.length;
    return { numberAsString, numberLength }
}

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

rl.question("", function (line) {
    const input = line.split(" ");
    const number = parseInt(input[0]);
    const iterations = parseInt(input[1]);
    console.log(substract(number, iterations));

    rl.close();
});


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

rl.on('line', (d) => {
  let [l, r, a] = d.split(' ').map(Number);
  let ans = 0;

  while (l < r && a !== 0) {
    l++;
    a--;
  }

  while (r < l && a !== 0) {
    r++;
    a--;
  }

  ans += Math.min(l, r) * 2;
  ans += Math.floor(a / 2) * 2;

  console.log(ans);
});


var t = readline();

for (var i = 0; i < t; i++) {
  var n = readline();
  var a = new Set();

  for(var j = 1; j * j <= n; j++) {
    a.add(j * j);
  }

  for(var j = 1; j * j * j <= n; j++) {
    a.add(j * j * j);
  }
  print(a.size);
}


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

//Don't have to see. end------------------------------------------
function Main(){
	var one = nextIntArray();
	var N = one[0];
	var K = one[1];
	var reqR = 2 * N;
	var reqG = 5 * N;
	var reqB = 8 * N;
	var output = 0;
	output += Math.ceil(reqR / K);
	output += Math.ceil(reqG / K);
	output += Math.ceil(reqB / K);
	myout(output);
}


let readline  = require('readline');
let intInput = readline.createInterface({
	input: process.stdin,
	output: process.stdout
});
let input;
intInput.on('line', (line) => {
	input = line.split(" ")
});
intInput.on('close', () => {
	let num = Number(input[0]);
	let k = Number(input[1]);
	for (let i = 0; i < k; i++) {
		let numToStr = num.toString();
		if (numToStr[numToStr.length - 1] == 0) {
			numToStr = numToStr.slice(0, numToStr.length - 1);
			num = Number(numToStr);
		} else {
			num = num - 1
		}
	}
	console.log(num)
})


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

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  const n = parseInt(arr)
  const sq = Math.sqrt(n)
  let k = 0
  for(let i = 1; i <= sq; i++) {
    if(n % i == 0) {
      if(n / i == i) k ++
      else k +=2
    }
  }
  console.log(k)

})


var readline = require("readline");
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
rl.on("line", function(line){
    var k = line.split(' ')[0];
    var n = line.split(' ')[1];
    var w = line.split(' ')[2];
    var price = 0;
    for(var i= 1; i<= w; i++){
        price += k * i;

    }
    if ((price - n) > 0 ){
        console.log(price-n);
    } else {
        console.log(0);
    }
});


//Lights Out

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

let inp = '';

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

process.stdin.on('end', () => {
    const m = inp.split(EOL).map(c => c.split(' ').map(r => +r));

    let res = [[1, 1, 1], [1, 1, 1], [1, 1, 1]];
    for(let i = 0; i < 3; i++)  {
    	for(let j = 0; j < 3; j++)  {
    		if(i != 0)  {
				res[i][j] += m[i - 1][j];
    		}
    		if(j != 0)  {
    			res[i][j] += m[i][j - 1];
    		}
    		if(i != 2)  {
    			res[i][j] += m[i + 1][j];
    		}
    		if(j != 2)  {
    			res[i][j] += m[i][j + 1];
    		}
    		res[i][j] = (res[i][j] + m[i][j]) % 2;
    	}
    }

    for(let i = 0; i < 3; i++)  {
    	for(let j = 0; j < 3; j++)  {
    		process.stdout.write(res[i][j] + '');
    	}
    	process.stdout.write(EOL);
    }
    return;
});


// Sample code to perform I/O:

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

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

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

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

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

// Write your code here
function nameLookUp(str) {
    let year = +str.trim() + 1;
    while (true) {
        let yearStr = String(year);
        let uniqueLength = [...new Set(yearStr)].length;
        if (uniqueLength === yearStr.length) {
            break;
        }
        year++;
    }

    return year.toString();
}


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

rl.on('line', (str) => {
  if (str.length >= 5 && /[a-z]/.test(str) && /[A-Z]/.test(str) && /[0-9]/.test(str)) {
    console.log('Correct');
  }
  else {
    console.log('Too weak');
  }
});


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 isInt(str) {
  return str.length === 1 && str.match(/[0-9*]/);
}

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

function exit(status = 0) {
  process.exit(status);
}

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

var k,n,w
function main() {
  [k,n,w] = lines[0].map(x => parseInt(x,10))
//   print(w)
  predict(["1<=k<=1000"])
  predict(["1<=w<=1000"])
  predict(["0<=n<=10**9"])

  let s = 0
  for(let i=1; i<=w; i++) {
    s += k*i
  }

  print(s-n>0?s-n:0)
}


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

function main() {
    let n = parseInt(readLine());
    let fingersArray = readLine().split(' ').map(Number);
    let sum = 0;
    for (let i = 0; i < fingersArray.length; i++) {
        sum = sum + fingersArray[i];
    }
    let ways = 0;
    for (let i = 1; i <= 5; i++) {
        if ((sum + i) % (n + 1) !== 1) {
            ways++;
        }
    }
    console.log(ways);
}


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 n = +readLine();

  function isDistinctDigits(year) {
    var arr = ("" + year).split("");
    if (
      arr[0] !== arr[1] &&
      arr[0] !== arr[2] &&
      arr[0] !== arr[3] &&
      arr[1] !== arr[2] &&
      arr[1] !== arr[3] &&
      arr[2] !== arr[3]
    ) {
      return true;
    } else {
      return false;
    }
  }

  for (var i = n + 1; i <= Infinity; i++) {
    if (isDistinctDigits(i)) {
      console.log(i);
      break;
    }
  }
}


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 [n, m] = readLine().split(" ").map(Number);

  var res = 1;
  for (var i = 1; i <= Math.min(n, m); i++) {
    res *= i;
  }
  console.log(res);
}


const readline = require('readline');

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

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

function da (n) {
    if (n == 2) return "NO"
    return n % 2 ? "NO" : "YES"
}


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

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

let capsLock = (input) => {
	if (checkStr(input.substring(1))) {
		let firstChar = input.charAt(0);
		checkStr(firstChar) ? (firstChar = firstChar.toLowerCase()) : (firstChar = firstChar.toUpperCase());
		console.log(firstChar + '' + input.substring(1).toLowerCase());
	} else {
		console.log(input);
	}
};

let checkStr = (str) => {
	return str === str.toUpperCase();
};


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

function test(t, k,min = 0, max = 100) {
//   console.log(`t=${t}, k=${k}`)
  if ((t < min || t > max) || (k < min || k > max) || t<k) {
    console.log("input error");
    process.exit();
  }
}

var argc = 0;
var n,k
readline.on("line", (input) => {
  if (argc == 0) {
    // test(input);
    [n,k] = input.split(' ').map(i => parseInt(i, 10));
    test(n,k,min=1,max=50)
    // console.log(k)
  } else {
    // this my code belong place
   a = input.split(' ').map(i => parseInt(i,10))
   ak = a.reduce(function(x,y){ return (y >= a[k-1] && y !== 0 && 1)+x },0)
//    console.log(n)
  }

  if (argc == 1)
  {
    // console.log(ak)
    console.log(ak)
    readline.close();
  }
  else argc += 1;
});


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

const gcd = (a, b) => {
  while (b !== 0n) {
    let temp = b;
    b = a % b;
    a = temp;
  }

  return a;
};

rl.on('line', (d) => {
  let [a, b] = d.split(' ').map(BigInt);

  if (a === b) {
    console.log(a.toString());
  }
  else {
    console.log(1);
  }
});


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

let stdinInput = '';

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

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
    data = data.split(/\r?\n/);
    const testCases = data[0] * 1;

    solve(data[1], testCases)
}

function solve(line, length) {
    let map = {}
    let i;
    for(i = 0; i < length - 1; i++) {
        let twogram = line.substring(i, i + 2)
        map[twogram] = twogram in map ? map[twogram] + 1 : 1
    }

    let maxtg = ""
    let curMax = 0
    let keys = Object.keys(map)
    keys.forEach( key =>
        {
            if (map[key] > curMax) {
                curMax = map[key]
                maxtg = key
            }
        }
    )
    console.log(maxtg)
}


const readline = require('readline');

const INPUT = 'test.in';
const LOCAL = process.env.ENABLE_LOCAL_ENV === 'true';
const log = (...args) => {
    LOCAL && console.log(...args)
};
let rl;
let lineNr = 0;

/**
 * MAIN
 */
(async () => {
    const promises = await setup(INPUT);
    await Promise.all(promises);
})();

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

    rl.on('line', (line) => {
        promises.push(work(line, lineNr));
        lineNr++;
    });

    rl.on('error', (err) => {
        log('Error:', err);
    });

    return new Promise(res => {
        rl.on('close', () => {
            res(promises)
            log('Done!');
        });
    });
}

async function work(line, lineNr) {
    const solutionForLine = await solve(line.trim());
    const responseLine = `${solutionForLine}\n`;
    process.stdout.write(responseLine);
}

/**
 *
 * Solution goes below
 *
 */
function solve(line) {
    const w = parseInt(line);
    let i = 1;
    while(Math.pow(2, i) <= Math.ceil(w / 2)) {
        const rem = w - Math.pow(2, i);
        if (rem % 2 === 0) return 'YES';
        i++;
    }
    return 'NO';
}


//nodejs v4.2.6
process.stdin.resume();
	process.stdin.setEncoding('utf8');
	//Taking a usr input
	process.stdin.on('data', function (text) {
			//Printing out user input
				if(text==2){
					console.log('NO')
				}else
				if(text%2 == 0){
					console.log('YES');
				}else{
					console.log('NO')
				}
	});


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

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

readLine.on('close', () => {
  let [first, second] = input
  let [people, seconds] = first.split(' ')
  let arrOrder = second.split('')
  for (let a = 0; a < seconds; a++) {
    for (let b = 0; b < people; b++) {
      const el = arrOrder[b]
      if (el === 'G') {
        arrOrder[b] = el
      } else if (el === 'B') {
        const checkNext = arrOrder[b + 1]
        if (checkNext === 'G') {
          arrOrder[b] = 'G'
          arrOrder[b + 1] = 'BG'
        } else {
          arrOrder[b] = el
        }
      } else {
        arrOrder[b] = 'B'
      }
    }
  }
  console.log(arrOrder.toString().replace(/(\,)/g,''))
});


const input = [];

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

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

RL.on('close', () => {
  const [m, n] = input.pop().split(' ').map(x => parseInt(x));
  let [min, max] = [Math.min(m, n), Math.max(m, n)];

  if (min % 2 === 0) {
    console.log( max * (min/2) );
  } else {
    if (min === 1) {
      console.log(parseInt(max/2));
    } else {
      console.log( (max * ((min-1)/2)) + parseInt(max/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++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const x = readline().split(" ");

  horseshoeOnTheOtherHoof(x);
}

function horseshoeOnTheOtherHoof(colors) {
  console.log(4 - new Set(colors).size);

}


// problem name: Routine Problem
// problem link: https://codeforces.com/problemset/problem/337/B
// contest link: https://codeforces.com/contest/337
// author: reyad
// time: (?)

'use strict';

function gcd(a, b) {
	while(b != 0) {
		let t = b;
		b = a % b;
		a = t;
	}
	return a;
}

function main() {
	let a = nextInt();
	let b = nextInt();
	let c = nextInt();
	let d = nextInt();

	if(c * b > a * d) {
		let x = b * c - d * a;
		let y = b * c;
		let g = gcd(x, y);
		console.log((x / g) + '/' + (y / g));
	}
	else {
		let x = d * a - b * c;
		let y = d * a;
		let g = gcd(x, y);
		console.log((x / g) + '/' + (y / g));
	}
}

// reader and main caller

let readline = require('readline');

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

let inputBuf = [];
let inputBufCnt = 0;
let tk = []
let tkCnt = 0;

function nextLine() {
	return inputBuf[inputBufCnt++];
}
function next() {
	if(tkCnt == tk.length) {
		tk = inputBuf[inputBufCnt++].split(' ');
		tkCnt = 0;
	}
	return tk[tkCnt++];
}
function nextInt() {
	return parseInt(next());
}
function nextDouble() {
	return parseFloat(next());
}

rl.on('line', (line) => {
	inputBuf.push(line);
}).on('close', () => {
	main();
});


const readline = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
})
readline.question("",ans=>{
    if(ans.match(/[HQ9]/g))
        console.log("YES")
    else
        console.log("NO")
    readline.close()
})

/* ahsgdiojidqh iuwhu
Hqweuyquir
ljhfasQkajshd
osaufHlaksjd
Qaslkdhjasd */


let standard_input = process.stdin;

standard_input.setEncoding('utf-8');

let x = 0;
let k = 0;

standard_input.on('data', data =>{

let data_found = data.split(" ")
let x = parseInt(data_found[0]);
let k = parseInt(data_found[1]);

for(var i = 0;i < k;i++)
{
    if(x % 10 == 0)
    {
       x = x / 10;
    }
    else
    {
        x = x-1;
    }

}

console.log(x)

});


//Beautiful Year

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

let inp = '';

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

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

    let dist = (i) => {
    	return (i + '').length == (new Set((i + '').split(''))).size;
    };

    for(var i = n + 1; !dist(i); i++)  {}

   	process.stdout.write(i + '');

    return;
});


function main() {
    // write code here:
    var answer;
    if(/^S(.*)F$/g.test(stdin[1])){
        answer='YES';
    }else{
        answer='NO';
    }
    console.log(answer);
}

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


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

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

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

  nums.sort((a, b) => a - b);
  if (k === 0) { console.log(0); return; }

  let sum = 0; let c = 0;
  for (let i = nums.length-1; i >= 0; i -= 1) {
    sum += nums[i];
    if (sum >= k) {
      console.log(c+1); return;
    }

    c += 1;
  }

  console.log(-1);
});


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() + 1;
  let count = 0;
  const sum = readLine()
    .split(" ")
    .reduce((sum, n) => sum + +n, 0);

  for (let i = 1; i <= 5; i++) {
    if ((sum + i) % len !== 1) count++;
  }
  console.log(count);
}


'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 N=parseInt(readLine());
    let marks=readLine().trim().split(' ').map(x=>{return +(x);});
    marks.sort((a,b)=>a-b);
    let sum=marks.reduce((a,b)=>a+b);
    //console.log(marks);
    for(let i=0;i<N;++i)
    {
        if(sum/N>=4.5)
        {
            console.log(i);
            return;
        }
        sum=sum-marks[i]+5;
    }
    if(sum/N>=4.5)
    {
        console.log(N);
    }
}


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

const input = [];
readLine.on('line', line => input.push(line));
const bananas = () => {
    const [k, n, w] = input[0].split(' ').map(x => +x);
    let q = 0;
    for (let i = 1; i <= w; i++) {
        q += i*k;
    }
    console.log(q <= n ? 0 :  q - n );
};

readLine.on('close', bananas);


function printAnswer([l1, l2]) {
  const [x, y, z] = l1.split(' ').map(Number);
  const [a, b, c] = l2.split(' ').map(Number);
  const ans = solve(x, y, z, a, b, c);
  console.log(['YES', 'NO'][ans]);
}

function solve(x, y, z, a, b, c) {
  if (x > a || x + y > a + b || x + y + z > a + b + c) {
    return 1;
  } else {
    return 0;
  }
}

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


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

readline.on('line',main);

function main(line) {
    const letters = ["A", "O", "Y", "E", "U", "I"];
    let mas = line
        .split('')
        .filter(letter => letters.indexOf(letter.toUpperCase()) === -1);
    let newMas = [];
    for (let i = 0; i < mas.length; i++){
        newMas.push('.');
        newMas.push(mas[i].toString().toLowerCase());
    }
    console.log(newMas.join(''));
}


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

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

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

process.stdin.on('end', function () {
    input_stdin_array = input_stdin.split("\n");
    main();
});

function readLine() {
    return input_stdin_array[input_currentline++];
}

function solveMeFirst(a, b, c) {
  // Hint: Type return a+b below
    var ret = 0;
    ret = Math.ceil(a/c)*Math.ceil(b/c);
    return ret;
}

function main() {
    var a, b;
    var c, d, e;
    e = readLine();
    d = e.toString().split(' ');
    a = parseInt(d[0]); b = parseInt(d[1]); c = parseInt(d[2]);

    var res = solveMeFirst(a, b, c);
    console.log(res);
}


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

process.stdin.on("end", function () {
   processData(_input);
});

function processData(input) {
    const values = input.split('\n')
    if (values && values.length > 0 && values[0]%2 === 0) {
        const temp = Math.floor(values[0]/2)
        if (temp%2 === 0) {
                        console.log("YES")

        } else {
            let eneteredValue = parseInt(values[0])
            for(let i=2;i<eneteredValue;i=i+2) {
                if ((eneteredValue - i)%2 === 0) {
                                                                console.log("YES")

                    return

                }

            }
                    console.log("NO")

        }

    } else {
            console.log("NO")
    }
}


let input = [];

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

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

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

    if(m >= n && k >= n)
        console.log('Yes');
    else
        console.log('No');
});


const readline = require('readline');

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

var check = function (str) {
  let len = str.length;
  if (len == 0 || len > 16)
    return false;

  for (let i = 0; i < len; i++) {
    if (!((str[i] >= '0' && str[i] <= '9') ||
      (str[i] >= 'a' && str[i] <= 'z') ||
      (str[i] >= 'A' && str[i] <= 'Z') ||
      str[i] == '_'))
      return false;
     }
     return true;
}
/*

  input = "something@ipsu.edu.tetu.com/pageone"

  hostName = "ipsu.edu.tetu.com";

  arr[] = {"ipsu", "edu", "tetu", "com"}

*/
var checkHost = function(hostName){
  let len = hostName.length;
  if(len==0 || len>32)
    return false;

  let arr = hostName.split('.');
  for(let i=0; i<arr.length; i++){
       if(!check(arr[i]))
          return false;
  }
  return true;
}

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

  let AtIndex = input.indexOf('@');
  let isUser = false, isHost = false, isResource = false;
  if (AtIndex != -1) {
    let userName = input.substring(0, AtIndex);
    isUser=check(userName);

    let slashIndex = input.indexOf('/');
    let hostName = slashIndex != -1 ? input.substring(AtIndex+1, slashIndex) : input.substring(AtIndex+1);
    isHost=checkHost(hostName);

    if(slashIndex == -1)
           isResource=true;
    else{
      let resource = input.substring(slashIndex+1);
      isResource=check(resource);
    }
  }
   /*
  if(isUser && isHost && isResource)
         console.log("YES");
  else
         console.log("NO");
         */
  console.log((isUser && isHost && isResource) ? "YES" : "NO");
  rl.close();
});


let input = [];

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

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

RL.on('close', () => {
    let {0:n, 1:m} = {...input[0].split(' ')};
    n = parseInt(n); m = parseInt(m);
    let nums = []; input[1].split(' ').forEach(i => nums.push(parseInt(i)));
    let y = new Set(); input[2].split(' ').forEach(i => y.add(parseInt(i)));

    let answer = '';
    for(let i of nums) {
        if(y.has(i)) {
            answer += `${i} `;
        }
    }
    console.log(answer);

});


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);
  arr.sort((a, b) => a - b);
  let ans = Math.max(0, arr[arr.length - 1] - 25);

  console.log(ans);

  c++;
});


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

function main() {
    let word = readLine().toLowerCase();
    let wordArray = word.split('');
    for (let i = 0; i < wordArray.length; i++) {
        if (
            wordArray[i] === 'a' ||
            wordArray[i] === 'e' ||
            wordArray[i] === 'i' ||
            wordArray[i] === 'o' ||
            wordArray[i] === 'u' ||
            wordArray[i] === 'y'
        ) {
            // wordArray.splice(i, 1);
            delete wordArray[i];
        }
    }
    let next = wordArray.join('');
    let nextArray = next.split('');
    for (let i = 0; i < nextArray.length; i++) {
        nextArray[i] = '.' + nextArray[i];
        // console.log(next);
    }
    // console.log(nextArray);
    let final = nextArray.join('');
    console.log(final);
}


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 [n, m] = readLine()
		.split(' ')
		.map(x => x >> 0);

	let arr = readLine()
		.split(' ')
		.map(x => x >> 0);

	arr.sort((a, b) => a - b);
	let d = [];
	for (let i = 0; i <= m - n; i++) {
		d.push(arr[i + n - 1] - arr[i]);
	}
	console.log(Math.min(...d));
}


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++;
    [n, k] = d.split(' ').map(Number);
    return;
  }

  const str = d;
  let idxG = str.indexOf('G');
  let idxT = str.indexOf('T');
  let ans = 'NO';

  for (let i = idxG; i <= idxT; i += k) {
    if (str[i] === '#') {
      break;
    }

    if (str[i] === 'T') {
      ans = 'YES';
    }
  }

  for (let i = idxG; i >= idxT; i -= k) {
    if (str[i] === '#') {
      break;
    }

    if (str[i] === 'T') {
      ans = 'YES';
    }
  }

  console.log(ans);

  c++;
});


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


function main() {
    // write code here:
    var arr=stdin[0].split(' ').map(a => Number(a));
    var num=Math.ceil(arr[0]/arr[2])*Math.ceil(arr[1]/arr[2]);
    console.log(num);
}

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


const readline = require('readline');

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

let data = [];
rl.on('line', (input) => {
   data.push(input);
});

rl.on('close', () => {
   solve(data);
});

function solve(data) {

   let row, col;
   for (let i = 0; i < data.length; i++) {
      line = data[i].split(" ");
      for (let j = 0; j < line.length; j++) {
         if (line[j] === "1") {
            row = i + 1;
            col = j + 1;
         }
      }
   }

   console.log(Math.abs((3-row)) + Math.abs((3-col)));

}


const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const [x, y] = ipt.split(EOL).slice(0, -1)[0].split(' ').map(v => parseInt(v))

  const P = [2]
  o: for (let i = 3; i <= y; i++) {
    for (let j = 0; j < P.length; j++) {
      if (!(i % P[j])) continue o
    }
    P.push(i)
  }

  const i = P.indexOf(x)
  console.log(P[i + 1] == y ? 'YES' : 'NO')
})


const readline = require('readline')
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
})
let input = []
rl.on('line', line => {
  input = line.split(' ').map(x => parseInt(x))
  const output = solution(input[0], input[1])
  console.log(output)
})
rl.on('close', () => {

})

const solution = function(n, k){
  let res = n;
  const getLastDigit = function(d){
    let last = d%10;
    return +last;
  };

  for (let i = 0; i < k; i++){
    let lastDigit = getLastDigit(res);

    if (lastDigit !== 0) {
      res--;
    } else {
      res = res/10;
    }
  }
  return res;
}


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

rl.on('line', (d) => {
  let [k, r] = d.split(' ').map(Number);
  // let ans = 0;
  // let coin = 10;
  // let c = 1;
  // let v = k;

  // while (true) {
  //   if (v % coin === 0 || v % coin === r) {
  //     break;
  //   }
  //   else {
  //     ans++;
  //     v = k * c;
  //     c++;
  //   }
  // }

  let ans = 1;
  while(true) {
    if (ans*k % 10 === 0 || ans*k % 10 === r) {
      console.log(ans);
      break;
    }

    ans++;
  }

  // console.log(Math.max(1, ans));
});


//96A
const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
rl.question('', (answer) => {
    rl.close()
    let team1 = 0
    let team2 = 0
    let array = answer.split("")
    let i = 1
    array.forEach(function(player) {

        if (player == 0) {
            team2 = 0
            team1++
            if (team1 == 7) {
                if (!i == 0) {
                    console.log("YES")
                    i = 0

                }
            }
        } else {
            team2 ++
            team1 = 0
            if (team2 == 7) {
                if (!i == 0) {
                    console.log("YES")
                    i = 0
                }

            }
        }
    })
    if (!i == 0) {
        console.log("NO")
    }

});


// 131A - cAPS lOCK
// http://codeforces.com/problemset/problem/131/A

function main() {
    let s = read();
    let ans = s;
    if (s.length === 1 || s.substring(1, s.length) === s.substring(1, s.length).toUpperCase()) {
        ans = "";
        for (let i = 0; i < s.length; i++) {
            if (s[i] === s[i].toUpperCase()) {
                ans += s[i].toLowerCase();
            } else {
                ans += s[i].toUpperCase();
            }
        }
    }
    writeline(ans);
    return 0;
}

var input = "";
var read;
var writeline = (x) => process.stdout.write(x + "\n");
var write = (x) => process.stdout.write(x);
process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on("data", (chunk) => input += chunk);
process.stdin.on("end", () => {
    input = input.trim().split(/\s+/);
    read = () => input.shift();
    process.exit(main() || 0);
});


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

function eatMoreTimka(tim, oleg){
    let year = 0;
    while (tim <= oleg){
        tim *= 3;
        oleg *= 2;
        year++;
    }
    //console.log(`Tim will be bigger than Oleg after ${year} years!\n${tim} versus ${oleg}`)
    return(year);
}

rl.on('line', (line) => {
        [tim, oleg] = line.split(' ', 2).map(Number);
        console.log(eatMoreTimka(tim, oleg));
        process.exit(0);
});


const readline = require('readline');

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

rl.on('line', (firstLine) => {
  rl.on('line', (secondLine) => {
    let output;
    if(firstLine.toLowerCase() < secondLine.toLowerCase()) {
        output = -1
    } else if(firstLine.toLowerCase() == secondLine.toLowerCase()){
        output = 0
    } else if(firstLine.toLowerCase() > secondLine.toLowerCase()){
        output = 1
    }
    console.log(output);
    rl.close();
  });
});


const readline = require('readline');

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

rl.on('line', function(line){
    console.log(solve(line))
  })

function solve(line){
    var cnt = 0;
    for(var i = 0; i < line.length; i++)
        if(line[i] == '7' || line[i] == '4')
            cnt++
    if(cnt == 7 || cnt == 4)
        return 'YES'
    else
        return 'NO'
}


const stdin = process.openStdin();

process.stdin.on('data', function (chunk) {
  lines = chunk.toString().split('\n');
  lines.map((line, i) => processLine(line, i));
});

let meta;
let scores;
let output = 0;
function processLine(text, i) {
  if (i === 0) {
    meta = text.toString().trim().split(' ');
  } else if (i === 1) {
    scores = text.toString().trim().split(' ').map(each => parseInt(each, 10));
    const border = scores[meta[1] - 1];
    scores.forEach(score => {
      if (score && score >= border) {
        output += 1;
      }
    })
    console.log(output);
  }
}


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

    function foo (length, minCount, maxCount) {

        function generateGrowArray(n) {
            return [...Array(n)].reduce(acc => {
                acc.push((acc[acc.length - 1]) * 2 || 1);
                return acc;
            }, []);
        }

        function getMinArray(length, minCount) {
            let growArray = generateGrowArray(minCount);

            let lineArray = new Array(length - minCount).fill(1);
            return lineArray.concat(growArray);
        }

        function getMaxArray(length, maxCount) {
            let growArray = generateGrowArray(maxCount);

            let lineArray = new Array(length - maxCount).fill(growArray[growArray.length - 1]);
            return growArray.concat(lineArray);
        }

        function getSum(array) {
            return array.reduce((a, b) => a + b);
        }

        let minArray = getMinArray(length, minCount);
        //console.log(minArray);
        let maxArray = getMaxArray(length, maxCount);
        //console.log(maxArray);
        return [getSum(minArray), getSum(maxArray)].join(" ");
    }

    let data = lines[0].split(" ").map(Number);
    let result = foo(...data);

    console.log(result);
})


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

let stdinInput = '';

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

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
  data = data.split(' ');
  const count = Math.floor(data[0] * data[1] / 2);
  process.stdout.write(count + '');
}


let 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]; let count = 0; let nowPos = 0;
    for(let i = 0; i < n.length; i += 1){
        const pos = parseInt(n.charCodeAt(i), 10)-97;
        let tmpCount = 0;
        if(nowPos !== pos) {
            if(nowPos > pos) {
                const right = nowPos - pos;
                const left  = 26-nowPos + pos;

                if(right > left)
                    count += left;
                else
                    count += right;
            } else {
                const right = pos - nowPos;
                const left  = nowPos + 26 - pos;

                if(right > left)
                    count += left;
                else
                    count += right;
            }
        }
        nowPos = pos;
    }
    console.log(count);
});


const mainFunction = (lines) => {
    let k, a, b;
    [k, a, b] = lines[0].split(" ").map(Number)
    let c = Math.floor(a / k),
        d = Math.floor(b / k),
        cc = a % k,
        dd = b % k
    console.log((cc && !d) || (dd && !c) ? -1 : c + d)
}

const { EOL } = require('os'),
    fs = require("fs");
if (__filename.substr(9, 4) != "azer") {
    let yourInput = ''
    process.stdin.on('data', i => yourInput += i)
    process.stdin.on('end', () => mainFunction(yourInput.split(EOL)))
} else {
    mainFunction(fs.readFileSync('input.txt', 'utf8').split(EOL))
}


//nodejs v4.2.6
process.stdin.resume();
	process.stdin.setEncoding('utf8');
	//Taking a usr input
	process.stdin.on('data', function (text) {
			//Printing out user input
			var input = parseInt(text)
				if(input===2){
					console.log('NO')
				}else
				if(input%2 === 0){
					console.log('YES');
				}else{
					console.log('NO')
				}
	});


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;

  for (let i = 0; i < data.length - 1; i++)
    if (data[i] === data[i + 1]) counter++;

  process.stdout.write(String(counter));
});


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

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var a = one[0];
  var b = one[1];
  var c = one[2];
  var output = c * 2 + Math.min(b, a) * 2;
  if(b != a){
    output++;
  }
  myout(output);
}


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

readline.question("", (weights) => {
    weights=weights.split(" ");
    w1=weights[0];
    w2=weights[1];
    let year=0;
    while(true)
    {
        year++;
        w1*=3;
        w2*=2;
        // console.log(`${year}=> w1:${w1},w2:${w2}`)
        if(w1>w2){
            break;
        }

    }
    console.log(year)
    readline.close()
})


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 [a, b] = readLine().split(' ').map(num => Number(num));
  console.log(Math.floor(Math.log(b / a) / Math.log(3 / 2)) + 1);
}


let z = '';
process.stdin.on('data', c => z += c);
process.stdin.on('end', () => {
    const {
        EOL
    } = require('os');
    let input = z.split(EOL)[0]

    let aCount = input.match(/[a]/g).length;
    let othersCount = input.length-aCount;
    if (aCount > othersCount) {
        console.log(input.length);
        return 0;
    }
    console.log(input.length-(othersCount-aCount+1));

});


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

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

  for (let i = 0; i < str.length - 2; i++) {
    for (let j = i + 1; j < str.length - 1; j++) {
      for (let k = j + 1; k < str.length; k++) {
        const val = str[i] + str[j] + str[k];

        if (val === 'QAQ') {
          ans++;
        }
      }
    }
  }

  console.log(ans);
});


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

const MOD = 998244353;

function main () {
	const n = rn();

	const dp = Array(n + 1).fill(0);
	for (let i = 1; i <= n; i++) {
		for (let j = i; j <= n; j += i) {
			dp[j]++;
		}
	}

	for (let i = 1, psm = 0; i <= n ; i++) {
		dp[i] += psm;
		psm = (psm + dp[i]) % MOD;
	}

	console.log(dp[n]);
}


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 [m, n, a] = readLine().split(" ").map(Number);

  var numberOfn, numberOfm;

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

  // if (m % a) {
  //   numberOfm = Math.floor(m / a + 1);
  // } else {
  //   numberOfm = Math.floor(m / a);
  // }
  var sum = Math.ceil(n / a) * Math.ceil(m / a);

  console.log(sum);
}


process.stdin.on('data', (n) =>
  process.stdout.write(n < 4 || n % 2 ? 'NO' : 'YES')
);


// Sample code to perform I/O:

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

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

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

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

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

// Write your code here
function nameLookUp(str) {
    let values = str.trim().split(' ');
    let subtractTo = +values[0];

    for (let i = 0; i < +values[1]; i++) {
        let remainder = subtractTo % 10;
        if (remainder === 0) {
            subtractTo /= 10;
        }
        else {
            subtractTo -= 1;
        }
    }

    return subtractTo.toString();
}


"use strict";
async function read(stream) {
    const chunks = [];
    for await (const chunk of stream) chunks.push(chunk);
    return Buffer.concat(chunks).toString('utf8');
}
function comp(s,t){
    for(let i = 0; i < s.length; ++i){
        if(s[i] != t[i]){
            if(s[i] < t[i])
                return -1;
            else
                return 1;
        }
    }
    return 0;
}
const input = read(process.stdin);
input.then(
    lines => {
        lines = lines.split('\n')
        let s = lines[0].toLowerCase()
        let t = lines[1].toLowerCase()
        console.log(comp(s,t))
    }
)


if (process.argv[2] === "test") {
  solve(["3 7"]);
} else {
  let i = "";
  process.stdin.on("data", (c) => (i += c));
  process.stdin.on("end", () => {
    const { EOL } = require("os");
    const lines = i.split(EOL);

    solve(lines);
  });
}

function solve(lines) {
  const [m, n] = lines[0].split(" ");
  console.log(Math.floor((m * n) / 2));
}