const readline = require('readline')

async function algo() {
  const table = await line()
  const cards = await line()
  console.log(cards.includes(table[0]) || cards.includes(table[1]) ? 'YES' : 'NO')
}

// read the input
const _lines = []
let _lineIndex = 0
let _ended = false
const _rl = readline.createInterface(process.stdin)
_rl.on('line', line => _lines.push(line))
_rl.on('end', () => (ended = true))
const wait = ms => new Promise(resolve => setTimeout(resolve, ms))
const line = async () => {
  while (!_ended && _lines.length <= _lineIndex) await wait(10)
  const result = _lines[_lineIndex].trim()
  _lines[_lineIndex] = null
  _lineIndex++
  return result
}
const words = async () => (await line()).split(' ')
const chars = async () => (await line()).split('')
const int = async () => parseInt(await line())
const ints = async () => (await words()).map(x => parseInt(x))
const big = async () => BigInt(await line())
const bigs = async () => (await words()).map(x => BigInt(x))

algo()


//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 N = nextInt();
  var list = new Array(N);
  for(var i = 0; i < N; i++){
    list[i] = new Array(N).fill(0);
    if(i == 0){
      list[i] = new Array(N).fill(1);
    }
    list[i][0] = 1;
  }
  for(var i = 1; i < N; i++){
    for(var j = 1; j < N; j++){
      list[i][j] = list[i][j - 1] + list[i - 1][j];
    }
  }
  myout(list[N - 1][N - 1]);
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  process.stdout.write(main(inputString));
  process.exit();
});

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

const main = ([inputString]) => {
  return parseInt(inputString) % 2 === 0 && parseInt(inputString) > 2
    ? 'YES'
    : 'NO';
};


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

   [n, k] = data[0].split(" ").map(x => parseInt(x));
   // console.log(n);
   // console.log(k);
   a = data[1].split(" ").map(x => parseInt(x));
   cutoff = a[k-1];

   count = 0;
   for (let i = a.length-1; i >= 0; i--) {
      if (a[i] > 0 && a[i] >= cutoff) {
         break;
      } else {
         count++;
      }
   }

   console.log(a.length - count);

}


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

  const chars = [...d];
  chars.sort();
  const alpha = 'abcdefghijklmnopqrstuvwxyz';

  let ans = -1;
  const str = [chars[0]];

  for (let i = 0; i < n; i++) {
    let prev = str[str.length - 1];
    let distance = Math.abs(alpha.indexOf(prev) - alpha.indexOf(chars[i]));

    if (distance < 2) {
      continue;
    }

    str.push(chars[i]);

    if (str.length === k) {
      break;
    }
  }

  if (str.length >= k) {
    ans = 0;
    for (let i = 0; i < k; i++) {
      ans += alpha.indexOf(str[i]) + 1;
    }
  }

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


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:a, 1:b, 2:c} = {...input[0].split(' ')};
    a = parseInt(a); b = parseInt(b); c = parseInt(c);

    if(Math.abs(a - b) <= 1) {
        console.log(a + b + (c*2));
    } else {
        console.log(a + b + (c*2) - Math.abs(a-b) + 1);
    }
});


const readline = require('readline');

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

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


require('readline').createInterface({
    input: process.stdin,
}).on('line', (line) => {
    const nums = line.trim().split(' ').map(s => parseInt(s))
    let Limak = nums[0];
    let Bob = nums[1];

    let years = 0;

    while(Limak <= Bob){
        Limak *= 3;
        Bob *= 2
        years++;
    }

    process.stdout.write(years + '\n');
    process.exit();
})


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

let inputLength = 0
let input = ''
const aphabets = 'abcdefghijklmnopqrstuvwxyz';
process.stdin.on("data", function(chunk) {
    input += chunk
})

process.stdin.on("end", function(){
    let sentence = input.split('\n').slice(1).join("")

let result = "YES"

for(let i = 0;i <aphabets.length; i++){
	 if(sentence.toLowerCase().includes(aphabets[i])){
     	result = "YES"

     } else {
       result = "NO"
       break
     }
}

console.log(result);
})


//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  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 N = nextInt();
  var s = next();
  var output = 0;
  for(var i = 0; i < N - 1; i++){
    if(s[i] == s[i + 1]){
      output++;
    }
  }
  myout(output);
}


const readline = require('readline');

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

let line = scanner.on('line', (line) => {
    main(line);
    scanner.close();
});

function main(line) {
    var x = parseInt(line);
    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");
    }
}


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 s = readLine().split('');
	let l = 0,
		u = 0;
	s.forEach(c => (c.charCodeAt(0) >= 65 && c.charCodeAt(0) < 97 ? u++ : l++));
	if (l >= u) console.log(s.join('').toLowerCase());
	else console.log(s.join('').toUpperCase());
}


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

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

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

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

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

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

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

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

var m;
var n;
function main() {
    m = parseInt(lines[0][0], 10)
    n = parseInt(lines[0][1], 10)

    predict(["1<=m<=n<=16"])
    number = Math.floor((m*n)/2)
    print(number)
}


'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 inp = readline().split(" ");

  let n = Number(inp[0]) || 0;
  let k = Number(inp[1]) || 0;

  let out = 0;
  if (n >= k) {
    let scores = readline().split(" ");
    for (let i = 0; i < scores.length; i++) {
      if (Number(scores[i]) >= Number(scores[k-1])) {

        if (Number(scores[i])> 0)
          out++
      } else {
        break;
      }
    }
  }
  console.log(out)

}


const input = [];

function splbsi(line) {
  return line.split(" ").map((x) => parseInt(x));
}

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

readLine.on("line", (line) => {
  input.push(line);
});

readLine.on("close", () => {
  const str = input[0].toLowerCase();
  const bad = new Set(); bad.add('a').add('o').add('y').add('e').add('u').add('i');

  const res = [];
  for (const char of str.split('')) {
    if (!bad.has(char)) res.push(`.${char}`);
  }

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


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

rl.on('line', (d) => {
  const matrix = new Array(+d).fill(1).map(x => new Array(+d).fill(1));
  let ans = 0;

  for (let i = 0; i < matrix.length; i++) {
    for (let j = 0; j < matrix[i].length; j++) {
      let v = 0;
      if (Number.isInteger(matrix[i][j - 1])) {
        v += matrix[i][j - 1];
      }

      if (matrix[i - 1] && Number.isInteger(matrix[i - 1][j])) {
        v += matrix[i - 1][j]
      }

      matrix[i][j] = Math.max(1, v);
      ans += matrix[i][j];
    }
  }

  console.log(matrix[matrix.length - 1][matrix.length - 1]);
});


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

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

readline.on('close', () => {
    let [word] = input;
    let l = (word.match(/[a-z]/g) || []).length;
    if (l >= word.length / 2) console.log(word.toLowerCase());
    else console.log(word.toUpperCase());
});


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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

const main=()=>{
	let t=readLine().split("WUB")
	let newString=''
	t.forEach(char=>{
		if(char!='')
			newString+=char+' '
	})
console.log(newString)
}


// https://codeforces.com/problemset/problem/977/B
// Big O:
// Time complexity:
// 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
});

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

var sumInBase = function (num, base) {
    ans = 0;
    while (num != 0) {
        ans += num % base;
       // num /= base;
       num=parseInt(num/base);
    }
    return ans;
}

rl.on('line', (input) => {
    var ans = 0;
    var N = parseInt(input);
    for (base = 2; base < N; base++)
        ans += sumInBase(N, base);
    var temp = GCD(ans, N - 2);

    console.log("%d/%d", ans / temp, (N - 2) / temp);
    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++];
}

var dp = {};

function fibonacci(n) {
	if (n === 0) return 0;
	if (n === 1) return 1;

	if (dp[n] !== undefined) return dp[n];
	let result = fibonacci(n - 1) + fibonacci(n - 2);
	return (dp[n] = result);
}

function main() {
	let n = readLine().split('');
	let f = true;
	for (let i = 0, l = n.length; i < l; ) {
		if (n[i] === '1' && n[i + 1] === '4' && n[i + 2] === '4') {
			i += 3;
		} else if (n[i] === '1' && n[i + 1] === '4') {
			i += 2;
		} else if (n[i] === '1') {
			i++;
		} else {
			f = false;
			break;
		}
	}
	f ? console.log('YES') : console.log('NO');
}


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

//Don't have to see. end------------------------------------------
function Main(){
	var one = nextIntArray();
	var W = one[0];
	var H = one[1];
	var K = one[2];
	var output = 0;
	for(var i = 0; i < K; i++){
		output += 2 * (W - 4 * i) + 2 * (H - 2 - 4 * i);
	}
	myout(output);
}


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

  var arr = readLine().split(" ").map(Number);

  var count = 0;
  for (var m = 0; m < n; m++) {
    if (arr[k - 1] <= arr[m] && arr[m] > 0) {
      count++;
    }
  }
  console.log(count);
}


// Problem #    : 4A
// Created on   : 2019-01-15 00:36:24
process.stdin.resume();
process.stdin.setEncoding("utf8");

var input = "",
  readline,
  print;

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

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

function main() {
  // Your code here
  let l = readline();
  let n = Number(l);
  if (n > 2 && n % 2 == 0) {
    print("YES");
  } else {
    print("NO");
  }

  return 0;
}


const readline = require('readline');

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

function f(n) {
  let res = n;
  let i = 2;
  while(n > 1) {
    if(n % i === 0) {
      res += ` ${n / i}`;
      n /= i;
      i = 2;
    } else {
      i++;
    }
  }
  return res;
}

rl.question('', str => {
  console.log(f(str));

  rl.close();
  process.stdin.destroy();
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

process.stdin.on('end', _ => {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function main() {
    let arr = readLine().split(' ').map(value => parseInt(value));
    let newArr = [...new Set(arr)];
    console.log(arr.length - newArr.length);
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

    // main();
});

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

    main();
});

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

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

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

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

function main() {
  let year = readline().trim().split('').filter(i => i).map(i => parseInt(i));
  const Year1 = [...year].join('') * 1;
  const getNextYear = (y,x, list) => {
    for(let i = y[x]; i<=9; i++) {
      if(!list.includes(i)){
        y[x] = i;
        if(x<3){
          let yy = getNextYear(y,x+1,[...list, i]);
          if(yy) {
            return yy;
          }else{
            y[x+1] = 0;
          }
        }else if(y.join('') * 1 > Year1){
          return y.join('') * 1;
        }
      }else{
        for(let k = x; k <= 3; k++){
          y[k] = 0;
        }
      }
    }
  }
  console.log(getNextYear(year,0,[]));
}


const readline = require('readline');

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

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

    if (x + y == z || x + z == y || y + z == x)
        return 'S';

    return 'I'
}

/*
input = "1 2 3 4"
while(true){
    string input = Console.ReadLine();
}
*/
rl.on('line', (input) => {
    let temp = input.split(' ').map(item => parseInt(item));
    let a = temp[0], b = temp[1], c = temp[2], d = temp[3];
    if (check(a, b, c) == 'T' || check(a, b, d) == 'T' || check(a, d, c) == 'T' || check(b, d, c) == 'T')
        console.log("TRIANGLE");
    else if (check(a, b, c) == 'S' || check(a, b, d) == 'S' || check(a, d, c) == 'S' || check(b, d, c) == 'S')
        console.log("SEGMENT");
    else
        console.log("IMPOSSIBLE");

    rl.close();
});

/**
 *
 a b c d

(a b c)
(a b d)
(a d c)
(d b c)
 */


// 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 ff, finishers, k, n, passing;
  [n, k] = readline().split(' ');
  finishers = readline().split(' ');
  passing = parseInt(finishers[k - 1]);
  ff = finishers.filter(function(f) {
    return f > 0 && f >= passing;
  });
  return print(ff.length);
};

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

//# sourceMappingURL=ith-place-finishers.js.map


"use strict";

// const fs = require('fs');

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

let inputString = "";
let currentLine = 0;

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

process.stdin.on("end", (_) => {
  inputString = inputString
    .replace(/\s*$/, "")
    .split("\n")
    .map((str) => str.replace(/\s*$/, ""));

  main();
});

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

function main() {
  let s1 = readLine().toLowerCase();
  let s2 = readLine().toLowerCase();
  // let ans1 = s1.split("").reduce((sum, value) => {
  //   return sum + value.charCodeAt(0);
  // }, 0);

  // let ans2 = s2.split("").reduce((sum, value) => {
  //   return sum + value.charCodeAt(0);
  // }, 0);

  if (s1 < s2) {
    console.log(-1);
  }
  if (s1 > s2) {
    console.log(1);
  }
  if (s1 == s2) {
    console.log(0);
  }
}


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

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

  const arr = d.split(' ').map(Number);
  let idx = 1;
  let ans = Infinity;

  while (idx < arr.length - 1) {
    let height = -Infinity;

    for (let i = 0; i < arr.length - 1; i++) {
      if (idx === i) {
        continue;
      }

      const nextItem = i + 1 === idx ? i + 2 : i + 1;
      height = Math.max(height, arr[nextItem] - arr[i]);
    }

    ans = Math.min(ans, height);
    idx++;
  }

  console.log(ans);

  c++;
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    const weights = readline().split(' ').map(x => parseInt(x))
    let year = 0;
    while (weights[0] <= weights[1]){
        weights[0] *=3;
        weights[1] *=2;
        year ++;
    }
    console.log(year)
}


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

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

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

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

function 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 l;
function main() {
  let s = lines[0][0].split('+')
  l = s.length
  predict(["1<=l<=100"])

    // print(s)
//   let cur = s[0]
    for (let i = 0; i < l; i++) {
        for(let j = i; j < l; j++) {
            if (s[i] > s[j+1]) {
                //   s[j+2] = [s[j], (s[j] = s[j+2])][0];
                [s[i],s[j+1]] = [s[j+1],s[i]]
            }

        }
    }
    print(s.join('+'))
}


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

const input = [];
readLine.on('line', line => input.push(line));
const numbers = () => {
    let ar1 = [];
    let ar2 = [];
    for (const x of input[0]) {
        ar1.push(+x);
    }
    for (const y of input[1]) {
        ar2.push(+y);
    }
    let newString = '';
    for (let i = 0; i < ar1.length; i++) {
        if (ar1[i] === ar2[i]) {
            newString += 0;
        }
        else {
            newString += 1;
        }
    }
    console.log(newString);
};

readLine.on('close', numbers);


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

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  if((one[0] + one[1] == one[2] + one[3]) ||
    (one[0] + one[2] == one[1] + one[3]) ||
    (one[0] + one[3] == one[2] + one[1])){
    myout("YES");
  }else if((one[0] == one[1] + one[2] + one[3]) ||
          (one[1] == one[0] + one[2] + one[3]) ||
          (one[2] == one[1] + one[0] + one[3]) ||
          (one[3] == one[1] + one[2] + one[0])){
    myout("YES");
  }else{
    myout("NO");
  }
}


process.stdin.on('data', (n) => {
  if (n > 3 && n % 2 === 0) console.log('YES');
  else console.log('NO');
});


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

let ans = 0;

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

  if (n % 2 === 0) {
    ans = n / 2;
  }
  else {
    ans = - Math.ceil(n / 2);
  }

  console.log(ans);
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

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

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

function main() {
  let list = readline().split('+').map(i => parseInt(i));
  list.sort();
  console.log(list.join('+'));
}


const triangle = 'TRIANGLE';
const segment = 'SEGMENT';
const impossible = 'IMPOSSIBLE';

function triangle_segment_impossible(a, b, c) {
  if (a <= b) {
    if (b <= c) {
      const t = a + b;
      return (t > c) ? triangle : ((t === c) ? segment : impossible);
    }
  }
  throw Error('check failed: a <= b <= c');
};

function solve(a, b, c, d) {
  const e = triangle_segment_impossible(a, b, c);
  const f = triangle_segment_impossible(b, c, d);
  const g = triangle_segment_impossible(a, c, d);
  const h = triangle_segment_impossible(a, b, d);
  if ((e === triangle) ||
      (f === triangle) ||
      (g === triangle) ||
      (h === triangle)) {
    return triangle;
  } else if ((e === segment) ||
             (f === segment) ||
             (g === segment) ||
             (h === segment)) {
    return segment;
  } else {
    return impossible;
  }
};

function compare(x, y) {
  return (x < y) ? (- 1) : ((x > y) ? 1 : 0);
};

function main(lines) {
  const [line] = lines;
  let t = line.trim();
  const xs = t.split(/\s+/).map(Number);
  xs.sort(compare);
  const [a, b, c, d] = xs;
  const result = solve(a, b, c, d);
  console.log(result);
};

async function processLinesFromStream(rs, pf) {
  const content = [];
  rs.setEncoding("utf-8");
  for await (let chunk of rs) {
    content.push(chunk);
  }
  const lines = content.join('').split(/\n/);
  const result = pf(lines);
  return result;
};

processLinesFromStream(process.stdin, main);


const stdin = process.stdin;
stdin.setEncoding( 'utf8' );
stdin.on( 'data', function( rawInput ){
    const inputLines = rawInput.split('\n');
    const input = parseInt(inputLines[0]);
    console.log(solve(input) ? "YES" : "NO");
});

function solve(totalWeight) {
    if (totalWeight < 4) {
        return false;
    }
    return totalWeight % 2 === 0;
}


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

rl.on('line', (d) => {
  const [a, b] = d.split(' ').map(Number);
  let playerA = 0;
  let playerB = 0;
  let draw = 0;

  for (let i = 1; i <= 6; i++) {
    if (Math.abs(a - i) < Math.abs(b - i)) {
      playerA++;
    }
    else if (Math.abs(a - i) > Math.abs(b - i)) {
      playerB++;
    }
    else {
      draw++;
    }
  }

  console.log(playerA, draw, playerB);
});


'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 weight = readline();
    const output = (weight > 2 && weight % 2  === 0) ? "YES" : "NO";
    console.log(output);
}


const readline = require('readline')

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

const mat = []
rl.on('line', line => {
  mat.push(line.split(' ').map(v => parseInt(v, 10)))
})

rl.on('close', () => {
 let pos
 mat.forEach((r, i) => r.forEach((v, j) => { if (v == 1) pos = [i,j] }))

 console.log(Math.abs(pos[0]-2)+Math.abs(pos[1]-2))
})


'use strict';

function solve(n, m) {
  const target = 10n ** (n - 1n);
  const queue = [[BigInt(m), 0]],
        cache = new Set();
  for (let [num, step] of queue) {
    const st = [];
    let tmp = num;
    while (num) {
      let cur = num % 10n;
      num = num / 10n;
      if (cur < 2n || st[cur]) continue;
      st[cur] = 1;
      let next = tmp * cur;
      if (cache.has(next)) continue;
      if (next >= target) {
        return step + 1;
      }
      cache.add(next);
      queue.push([next, step + 1]);
    }
  }
  return -1;
}

async function main(read) {
  try {
    let res = [];
    const [n, m] = (await read()).split(' ').map(BigInt);
    res.push(solve(n, m));
    console.log(res.join('\n'));
  } catch (error) {
    console.log(error);
  }
}

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


'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
let n;
let m;
let k;
function solve() {
    let meven = (m % 2) == 0;
    let neven = (n % 2) == 0;
    let keven = (k % 2) == 0;
    if (meven && neven) {
        // necessary and sufficient that there are pairs of horiz to create 4x4 blocks
        return keven;
    }
    else if (meven) {
        // need at least one row of horiz, and remainder are even
        let rem = k - Math.trunc(m / 2);
        let remeven = (rem % 2) == 0;
        return k * 2 >= m && remeven;
    }
    else {
        let lim = (m - 1) * n;
        let used = k * 2;
        if (used > lim) {
            return false;
        }
        return keven;
    }
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        m = nextInt();
        k = nextInt();
        if (solve()) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
}


const readline = require('readline')

class ReadStream {
    lines = []

    currPromise = undefined

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

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

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

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

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

        })
        return this.currPromise
    }

    nextN(n) {
        return [...new Array(n)].map(_ => this.next())
    }

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

const cin = new ReadStream()

async function main() {
    const [n, k] = (await cin.next()).split(' ').map(Number)
    const items = (await cin.next()).split(' ').filter((item, i, items) => {
        return Number(item) >= Number(items[k - 1]) && Number(item) > 0
    })

    console.log(items.length)
}

main()


process.stdin.on('data', input => {
    let res = 'NO';

    if (input == 2) {
        res = 'NO';
    } else if (input % 2 == 0) {
        res = 'YES';
    }

    console.log(res);

    return res;
});


const readline = require('readline');

let inputs = [];

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

// Read Inputs
rl.on('line', lineInput => {
    inputs.push(lineInput)
})

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

    let arr = inputs[0].split(' ').map(num => parseInt(num));
    let m = arr[0];
    let n = arr[1];
    let step = 0;

    while (n != 0 && m != 0) {
        step++;
        n--;
        m--;
    }

    if (step != 0 && step % 2 == 0)
        return console.log("Malvika")

    console.log("Akshat")

})


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(" ");
  const minus = m % 2 !== 0 && n % 2 !== 0 ? 1 : 0;
  console.log((m * n - minus) / 2);
}


//Soft Drinking

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

let inp = '';

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

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

    let n = +lines[0];
    let k = +lines[1];
    let l = +lines[2];
    let c = +lines[3];
    let d = +lines[4];
    let p = +lines[5];
    let nl = +lines[6];
    let np = +lines[7];

    process.stdout.write(Math.min(~~((k * l) / (n * nl)), ~~((c * d) / n), ~~(p / (n * np))) + '');

    return;
});


const input = [];

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

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

RL.on('close', () => {
  const situation = input[0];
  let maxOne = 0, nowOne = 0,
      maxTwo = 0, nowTwo = 0;

  for (let i = 0; i < situation.length; i += 1) {
    if (situation[i] === '1') {
      nowTwo = 0;
      nowOne += 1;
      if (maxOne < nowOne) maxOne = nowOne;
    } else {
      nowOne = 0;
      nowTwo += 1;
      if (maxTwo < nowTwo) maxTwo = nowTwo;
    }
  }
  console.log(maxOne >= 7 || maxTwo >= 7 ? "YES" : "NO");
});


"use strict";
var input = '';
var inputResolve;
var inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => {
    inputResolve();
});
(async () => {
    // var time = Date.now();
    await inputPromise;
    var inputs = input.split(/\r?\n/);
    var [n, h] = inputs[0].split(' ').map(v => +v);
    var f = [];
    for (let i = 0; i <= n; i++) {
        f[i] = [];
        for (let j = 0; j <= n; j++)
            f[i][j] = BigInt(0);
    }
    f[0][0] = BigInt(1);
    f[1][1] = BigInt(1);
    for (let i = 2; i <= n; i++) {
        for (let j = 1; j <= i; j++) {
            for (let z = 1; z <= i; z++) {
                for (let j2 = 0; j2 <= j - 1; j2++) {
                    if (j2 < j - 1)
                        f[i][j] = f[i][j] + f[z - 1][j2] * f[i - z][j - 1];
                    else
                        f[i][j] = f[i][j] + f[z - 1][j - 1] * f[i - z].slice(0, j).sum();
                }
            }
        }
    }
    console.log(f[n].slice(h).sum().toString());
})();
Object.defineProperty(Object.prototype, '$k', {
    value: function () { return Object.keys(this); }
});
Object.defineProperty(Object.prototype, '$v', {
    value: function () { return Object.values(this); }
});
Object.defineProperty(Object.prototype, '$kv', {
    value: function () { return Object.entries(this); }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), BigInt(0)); };
Array.prototype.uniq = function (fn) {
    var set = new Set();
    return this.filter(v => {
        var newValue = !set.has(fn ? fn(v) : v);
        set.add(fn ? fn(v) : v);
        return newValue;
    });
};
Array.prototype.toObj = function (fn) {
    return this.map(v => fn(v)).reduce((p, v) => {
        p[v[0]] = v[1];
        return p;
    }, {});
};


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

let l = 0;
let cups = []
let medals = []

rl.on('line', (input) => {
    if (l === 0) {
        cups = input.split(' ').map(function (item) {
            return parseInt(item, 10);
        });
    } else if (l === 1) {
        medals = input.split(' ').map(function (item) {
            return parseInt(item, 10);
        });
    } else {
        function add(a, b) {
            return a + b;
        }
        rl.close();
        let shelfs = parseInt(input)
        var cupsSum = cups.reduce(add, 0);
        var medalsSum = medals.reduce(add, 0);
        shelfs-=Math.ceil(cupsSum/5)
        shelfs-=Math.ceil(medalsSum/10)
        if(shelfs>=0){
            console.log("YES")
            return 0
        }
        console.log("NO")

        return 0;
    }
    l++
});


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

const gcd = (a, b) => {
  if (b === 0) {
    return a;
  }

  return gcd(b, a % b);
}

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

  while (n > 0) {
    ans = ans === 0 ? 1 : 0;

    if (ans === 0) {
      const r = gcd(a, n);
      n -= r;
    }
    else {
      const r = gcd(b, n);
      n -= r;
    }
  }

  console.log(ans);
});


const input = [];

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

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

RL.on('close', () => {
  let [n, m] = input[0].split(' ').map(x => parseInt(x));
  let winAkshat = false;
  while (n > 0 && m > 0) {
    n -= 1; m -=1;
    winAkshat = !winAkshat;
  }

  console.log( winAkshat ? 'Akshat' : 'Malvika')
});


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

rl.on('line', (d) => {
  const arr = d.split(' ').map(Number);
  let ans = 'NO';

  for (let i = 0; i < 2**arr.length; i++) {
    const str = i.toString(2).padStart(4, 0);
    let sum1 = 0;
    let sum2 = 0;

    for (let j = 0; j < str.length; j++) {
      if (str[j] === '1') {
        sum1 += arr[j];
      }
      else {
        sum2 += arr[j];
      }
    }

    if (sum1 === sum2) {
      ans = 'YES';
      break;
    }
  }

  console.log(ans);
});


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

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = nextIntArray();
  list.sort(function(a,b){
  	return a - b;
  });
  var output = 0;
  for(var i = 0; i < N; i += 2){
    output += list[i + 1] - list[i];
  }
  myout(output);
}


const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
rl.on('line', (input) => {
    if (input%2 === 0 && input>= 4) {console.log ("YES")}
    else console.log ("NO")
}

)


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  var strArr = readLine().split(" ").map(Number);
  var a = strArr[0];
  var b = strArr[1];
  var count = 0;
  for (let i = 0; i < i + 1; i++) {
    a = a * 3;
    b = b * 2;
    if (a > b) {
      count = i + 1;
      break;
    }
  }
  console.log(count);
}


function main() {
    // write code here:
    console.log(Math.floor(stdin[0].split(' ').reduce((acc, cur) => acc * cur, 1) / 2))
}

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 [n] = input[0].split(' ').map(x => parseInt(x));
  let answer = 1;

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

  console.log(answer)
});


//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 u = s.toUpperCase();
  var ucount = 0;
  var l = s.toLowerCase();
  var lcount = 0;
  for(var i = 0; i < s.length; i++){
    if(s[i] != u[i] && s[i] == l[i]){
      ucount++;
    }
    if(s[i] == u[i] && s[i] != l[i]){
      lcount++;
    }
  }
  if(lcount > ucount){
    myout(u);
  }else{
    myout(l);
  }
}


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

function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

function Main() {
    var t = nextInt();
    if (t % 2 === 0) {
        if (t / 2 === 1) {
            console.log("NO");
        } else {
            console.log("YES");
        }

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


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

rl.on('line', (d) => {
  const [n, m] = d.split(' ').map(Number);
  let ans = m;
  let iter = 1;

  while (ans >= iter) {
    ans -= iter;
    iter++;

    if (iter > n) {
      iter = 1;
    }
  }

  console.log(ans);

  c++;
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readLine() {
    return inputString[currentLine++];
}
function main(){
    let a = readLine();
    let b = readLine();
    a=a.split("");
    a=a.reverse("");
    a=a.join("");
    if(a==b){
        console.log("YES");
    }
    else{
        console.log("NO");
    }

}


"use strict";
let input = [];
const readline=require('readline');
const RL=readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
RL.on('line', (line)=>{
  input.push(line.trim());
});
RL.on('close', ()=>{
  const str1=input[0].toLowerCase();
  const str2=input[1].toLowerCase();
  let answer=undefined;
  if(str1==str2){
    answer=0;
  } else if(str1<str2){
    answer=-1;
  } else{
    answer=1;
  }

  console.log(answer);
});


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

let input = [];
rl.on('line', function(line) {
	input.push(line);
	if (input.length === 2) {
		nextRound(input);
		rl.close();
	}
});

let nextRound = (array) => {
	let kth = array[1].split(' ')[array[0].split(' ')[1] * 1 - 1];
	let result = array[1].split(' ').filter((el) => {
		return el * 1 >= kth && el * 1 > 0;
	});
	console.log(result.length);
};


const readline = require('readline');

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

rl.on('line', line => {
  let arrinput = line.split(' ');
  let number = arrinput[0];
  let k = arrinput[1];
  for (let i = 0; i < k; i++) {
    number = number % 10 == 0 ? number / 10 : number - 1;
  }
  console.log(number);
}).on('close', () => {
  process.exit(0);
});


let readline  = require('readline');
let intInput = readline.createInterface({
	input: process.stdin,
	output: process.stdout
});
let arr = [];
let result;

intInput.on('line', (line) => {
	arr.push(line)
});

intInput.on('close', () => {
	let table = arr[0].split("");
	let my = arr[1].split(" ").join("").split("");
	for (let i = 0; i < my.length; i++) {
		result = 'NO'
		if (my[i] == table[0] || my[i] == table[1]) {
			result = 'YES'
			break
		}
	}
	console.log(result);
})


const readline = require('readline');

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

rl.on('line', function (line1) {
    let cardOnTable = line1;
    rl.on('line', function (line2) {
        let cardsInHand = line2.split(" ");
        doIt(cardOnTable, cardsInHand)
        rl.close();
    });
});

function doIt(cardOnTable, cardsInHand) {
    const splitedCardOnTable = splitCard(cardOnTable);

    let ret = 'NO';
    for (let i = 0 ;i < cardsInHand.length; i++) {
        const splited = splitCard(cardsInHand[i]);
        if (splited[0] === splitedCardOnTable[0] || splited[1] === splitedCardOnTable[1]) {
            ret ='YES';
            break;
        }
    }

    console.log(ret);

    function splitCard(card) {
        const rank = card.substring(0,1);
        const suit = card.substring(1,2);
        return [rank, suit];
    };
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

process.stdin.on('end', _ => {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function main() {
    let n = parseInt(readLine());
    let arr = [];
    for (var i = 0; i < n; i++) {
        arr.push([]);
    }
    for (var i = 0; i < n; i++) {
        arr[0].push(1);
        if (i + 1 < n) arr[i + 1].push(1);
    }
    for (var i = 1; i < n; i++) {
        for (var j = 1; j < n; j++) {
            arr[i].push(arr[i - 1][j] + arr[i][j - 1]);
        }
    }
    console.log(arr[n - 1][n - 1]);
}

// arr = [
//     [1, 1, 1, 1],
//     [1, 2, 3, 4],
//     [1, 3, 6, 10],
//     [1, 4, 10, 20],
// ]


///////////////////////////////// pre-define /////////////////////////////////////
const pr = console.log;
const err = console.error;
const mi = Math.min;
const mx = Math.max;
const abs = Math.abs;
const fl = Math.floor;
const ce = Math.ceil;
const sq = Math.sqrt;
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const powmod = (a, b, mod) => {
    let r = 1n;
    while (b > 0n) {
        if (b % 2n == 1) r = r * a % mod;
        b >>= 1n;
        a = a * a % mod;
    }
    return r;
};
const counter = (a_or_s) => {
    let map = new Map();
    for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1);
    return map;
};
///////////////////////////////////////////////////////////////////////////////////

const MOD = BigInt(1e9 + 7);
const solve = (n, k) => {
    pr(powmod(n, k, MOD).toString());
};

const main = () => {
    const { performance } = require('perf_hooks');
    let t_begin = performance.now();
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
        let t_end = performance.now();
        err("Run Time: " + (t_end - t_begin) / 10 + "ms");
    });
};

main()


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

rl.on('line', (d) => {
  const n = parseInt(d);
  const isMonth = d.split(' ').reverse()[0] === 'month';
  const isWeek = d.split(' ').reverse()[0] === 'week';

  if (isWeek) {
    if (n === 5 || n === 6) {
      console.log(53);
    }
    else {
      console.log(52);
    }
  }
  else {
    if (n <= 29) {
      console.log(12);
    }
    else if (n <= 30) {
      console.log(11);
    }
    else {
      console.log(7);
    }
  }

  c++;
});


let fs = require('fs');

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

txt.forEach(data => {
    let info = data.split(" ");
    doit(info[0] * 1, info[1] * 1, info[2] * 1);
});

function doit(k, n, w) {
    let r=0;
    for (let index = 1; index <= w; index++) {
        r+=index;
    }
    r*=k;
    if(r<n){
        console.log(0);
    }else{
        console.log(r-n);
    }
}


'use strict'
const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
});
var kilos;
rl.question('', (kilos) => {
  if((kilos%2==0) && (kilos>=4)){
  console.log("YES")
  }else{
  console.log("NO")
  }
});


// 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 upperCaseCount = inputs.replace(/[a-z]/g, '').length;
    let lowerCaseCount = inputs.replace(/[A-Z]/g, '').length;
    if (upperCaseCount == lowerCaseCount || lowerCaseCount > upperCaseCount) {
        inputs = inputs.toLowerCase();
    }
    else if (upperCaseCount > lowerCaseCount) {
        inputs = inputs.toUpperCase();
    }
    return inputs.toString();
}


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

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

  c++;
});

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

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

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


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  process.stdout.write(String(main(inputString)));
  process.exit();
});

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

const main = inputArray => {
  const [
    numberOfParticipants,
    numberOfAdvancingScores,
  ] = inputArray[0].split(' ');
  const participantScores = inputArray[1].split(' ');
  const filter0s = score => score !== '0';
  if (numberOfAdvancingScores === numberOfParticipants)
    return participantScores.filter(filter0s).length;

  const winners = participantScores.slice(0, numberOfAdvancingScores);
  const lastWinningScore = winners[winners.length - 1];
  if (lastWinningScore === '0') return winners.filter(filter0s).length;

  if (participantScores[numberOfAdvancingScores] !== lastWinningScore)
    return winners.length;

  for (let i = winners.length; i < participantScores.length; i += 1) {
    if (participantScores[i] === lastWinningScore) {
      winners.push(lastWinningScore);
    } else {
      break;
    }
  }

  return winners.length;
};


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

let inputString = '';
let currentLine = 0;

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

process.stdin.on('end', _ => {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function main() {
  let count = parseInt( readLine().split(' '))

  let s = 0;
  while(count >= 1){
      s += count % 2;

      count /= 2
     count = Math.floor(count)

  }

  console.log(s)

}


const standardTileArea = 2;

process.stdin.on('data', input => {
  const inputSize = input.toString().split(' ');

  const tiles = (Number(inputSize[0]) * Number(inputSize[1])) / standardTileArea;
  console.log(Math.floor(tiles));
});


const readline = require('readline');

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

let currLine = 0;
let n, k, arr;

rl.on('line', (line) => {
    if (currLine === 0) {
        let temp = line.split(" ");
        n = +temp[0];
        k = +temp[1];
        ++currLine;
    } else {
        arr = line.split(" ");
        let count = k;
        let num = arr[--k];
        if (+num === 0) {
            count = 0;
            let tempnum = 0;
            while (tempnum < k && +arr[tempnum] != 0) {
                ++tempnum;
                ++count;
            }
            console.log(count);
            rl.close();
            return;
        }
        while (k < n && arr[++k] === num){
            ++count;
        }
        console.log(count);
        rl.close();
        return;
    }
});


const CODEFORCES_NODE = "cf";
const CODEFORCES_V8 = "cf-v8";
const BEAKJOON = "bj";
const TEST = "test";
var SITE = CODEFORCES_NODE;
process.argv.forEach(function(val, index, array) {
  // console.log(index + ': ' + val);
  if (val.startsWith("site")) {
    switch (val.split("=")[1]) {
      case "test":
        // console.log('change site to test')
        SITE = TEST;
        break;
      case "cf-node":
        // console.log('change site to cf')
        SITE = CODEFORCES_NODE;
        break;
      case "cf":
        // console.log('change site to cf')
        SITE = CODEFORCES_NODE;
        break;
      case "cf-v8":
        // console.log('change site to cf')
        SITE = CODEFORCES_V8;
        break;
      case "bj":
        // console.log('change site to bj')
        SITE = BEAKJOON;
        break;
    }
  }
});

const DEBUG = SITE == "test";
const newLine = '\n';
if(CODEFORCES_NODE){  //NODE doesn't have readline so make it
  var readline;
  var print;
  print = console.log;
  var it;
}
var ans;
var text = "";
var lineCount = 0;
var lines;
function solve() {
  const [n,b] = readInts();
  const arr = readInts();
  it(n, b);
  it(arr);
  //먼저 홀짝 쌍을 전부 세면서 동시에 cost도 셀 수 있나?
  //그렇다면 각 cuttable point에 대해 세자!
  var countingGroup = false;
  var balance = 0;
  var cutpoints = [];
  for (let i = 0; i < arr.length; i++) {
    const el = arr[i];
    if(el % 2 == 0)
      balance += 1;
    else
      balance -= 1;
    if(!countingGroup){
      //balance는 당연히 안맞을 것.
      it('counting started', i);
      countingGroup = true;
    }
    else if(countingGroup && balance == 0){
      if(i+1 == arr.length){
        break;
      }
      countingGroup = false;
      cutpoints.push({'pos': i+1, 'price': Math.abs(arr[i+1] - arr[i])});
      it('counting stopped', i);
    }
  }
  it(cutpoints);
  cutpoints.sort((x,y)=>{
    return x.price - y.price;
  });
  if(cutpoints.length == 0){
    print(0);
    return;
  }
  const prices = cutpoints.map((x)=>{return x.price;});
  it(prices);
  var cost = 0;
  var cur = 0;
  while (cost < b) {
    cost += prices[cur];
    cur++;
    if(cost > b){
      cur-=1;
      break;
    }
    if(cur == prices.length){
      break;
    }
  }
  print(cur);
}
function* getlines(text) {
  var lines = text.split(/\r?\n/);
  for (let line of lines) {
    yield line + newLine;
  }
}
function readline() {
  return lines.next().value.trim();
}
function readInts() {
  return readline()
    .split(" ")
    .map(function(x) {
      return parseInt(x);
    });
}
var input;
if (DEBUG) {
  var fs = require("fs");
  input = fs.createReadStream("input.txt", {encoding:"utf8"});
  it = print;
  // lines = getlines(fs.readFileSync("input.txt", "utf8"));
  // let data = "";
  // data += readline().toString();

  // data += readline().toString();
  // require("fs").writeFile("output.txt", data, "utf8", function(err) {
  //   console.log("비동기적 파일 쓰기 완료");
  // });
  // console.log(process.stdin);
}
else {
  input = process.stdin;
  it = function it(params) {
    return 0;
  }
}
if (CODEFORCES_NODE) {
  function inputListener(line) {
    if (!line) {
      closing();
    }
    lineCount++;
    text += line + "\r\n";
  }
  function closing(){
    lines = getlines(text);
    solve();
    process.exit();
  }
  function readlines() {
    const readline = require("readline");
    const rl = readline.createInterface({
      input,
      output: process.stdout,
      terminal: false
    });
    rl.on("line", inputListener);
    rl.on('close', closing);
  }
  readlines();
}
// console.log('hallo!!!')


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  var strArr = readLine().split(" ").map(Number);
  var k = strArr[0];
  var n = strArr[1];
  var w = strArr[2];
  var result = k;
  for (let i = 1; i < w; i++) {
    result += k + k * i;
  }
  if (result > n) {
    console.log(result - n);
  } else {
    console.log(0);
  }
}


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

var arr = [];
//rl.prompt();

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

    arr = line.split(' ').map(function (x) { return parseInt(x, 10) });

    var n = arr[0];
    var m = arr[1];
    var a = arr[2];

    var x = n % a == 0 ? n / a : Math.floor(n / a) + 1;
    var y = m % a == 0 ? m / a : Math.floor(m / a) + 1;

    console.log(x * y);

    rl.close();

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

    process.exit(0);
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

function main() {
  var song = readline();

  song = song.split('WUB').join(' ');

  console.log(song);
}


// Alternative
// https://www.npmjs.com/package/competitive-programming-js
"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 input() { return inputString[currentLine++]; }
const println = (x = "") => process.stdout.write(String(x) + "\n");
const print = x => { process.stdout.write(String(x)); }
// >>>>>>>>>>>>> Main starts here <<<<<<<<<<<<<<

const createArray = n => {
    let ar = new Array(n).fill(0);
    println(ar);
    ar = ar.map(v => new Array(n).fill(0));
    return ar;
}

function main() {
    let n = parseInt(input());

    let ar = new Array(100).fill(0).map(v => new Array(n).fill(0));
    let val = input().split(' ').map(v => parseInt(v));

    for (let i = 0; i < n; ++i) {
        for (let j = 0; j < val[i]; ++j) {
            ar[j][i] = 1;
        }
    }
    // println(ar.join('\n'));
    // println("-----------");
    for (let i = n-2; i >= 0; --i) {
        for (let j = 0; j < 100; ++j) {
            if (ar[j][i] === 1 && ar[j][i+1] === 0) {
                let pos = i + 1;
                while (pos < n && ar[j][pos] === 0) {
                    pos += 1;
                }
                pos -= 1;
                ar[j][pos] = 1;
                ar[j][i] = 0;
            }
        }
        // println(ar.join('\n'));
        // println("-----------");
    }

    let ans = new Array(n).fill(parseInt(0));

    for (let i = 0; i < n; ++i) {
        for (let j = 0; j < 100; ++j) {
            ans[i] += ar[j][i];
        }
    }

    ans.forEach(v => print(v + " "));
    println();

}


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

rl.on('line', line => {
	const [n, m] = line.split(' ').map(i => parseInt(i));
	console.log(Math.floor(n * m / 2));
	rl.close();
});


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

    this.solveCase = function() {
        var res , i , j , fl , cn , temp , lim , mask , mi , ma , tot ;
        res = 0 ;
        lim = ( 1 << this.n ) ;
        for( i = 0 ; i < lim ; i++ ) {
        	mask = i ;
        	tot = 0 ;
        	mi = 1000000000000 ;
        	ma = -1 ;
        	for( j = 0 ; j < this.n ; j++ ) {
        		if( ( mask & ( 1 << j ) ) != 0 ) {
        			mi = Math.min( mi , this.arr[ j ] ) ;
        			ma = Math.max( ma , this.arr[ j ] ) ;
        			tot += this.arr[ j ] ;
        		}
        	}
        	if( tot >= this.l && tot <= this.r && ma - mi >= this.x ) {
        		res++ ;
        	}
        }
        print( res );
    };

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

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
            this.l = irObj.nextInt();
            this.r = irObj.nextInt();
            this.x = irObj.nextInt();
            this.arr = [] ;
            for( i = 0 ; i < this.n ; i++ ) {
                this.arr.push( irObj.nextInt() ) ;
            }
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

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

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

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

    this.init();
}

function InputReader() {
    var self = this ;
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;
    this.callBackFunction = null ;
    this.parentContext = null ;

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

    this.readAllLinesFromRhino = function() {
        var brObj , line ;
        importPackage( java.io ) ;
        importPackage( java.lang ) ;
        brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;
        this.allLines = [] ;
        while( true ) {
            line = brObj.readLine() ;
            if( line == null ) {
                break;
            }
            this.allLines.push( line ) ;
        }
    };

    this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {
        self.chunkData += chunk ;
    };

    this.readEndFromNodeJsJudgeServer = function() {
        self.parseRawData( self.chunkData ) ;
        self.parentContext.runCases() ;
    };

    this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {
        this.parentContext = parentContext ;
        process.stdin.resume() ;
        process.stdin.setEncoding( 'utf8' ) ;
        this.chunkData = '' ;
        process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;
        process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;
    };

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

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

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

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

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

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

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

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

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

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

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

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

    this.runCases = function() {
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.detectEnvironmentType = function() {
        var environmentType = null ;
        try {
            if( importPackage != null ) {
                environmentType = 'rhino' ;
            }
        }
        catch( ex1 ) {
            try {
                //for nodejs local server check
                if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {
                    environmentType = 'local-node-js' ;
                }
            }
            catch( ex2 ) {
                try {
                    if( readline == null || typeof( readline ) != 'function' ) {
                        environmentType = 'server-node-js' ;
                    }
                    else {
                        try {
                            if( Map != null ) {
                                environmentType = 'spider-monkey' ;
                            }
                            else {
                                environmentType = 'javascript-v8' ;
                            }
                        }
                        catch( ex3 ) {
                            environmentType = 'javascript-v8' ;
                        }
                    }
                }
                catch( ex3 ) {
                    environmentType = 'server-node-js' ;
                }
            }
        }
        return environmentType ;
    };

    this.configureStreamsAndReadInput = function() {
        var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;
        isNodeJsJudgeServer = false ;
        environmentType = this.detectEnvironmentType() ;
        if( environmentType == 'local-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
            this.runCases() ;
        }
        else if( environmentType == 'server-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;
        }
        else if( environmentType == 'javascript-v8' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
        else if( environmentType == 'rhino' ) {
            this.irObj.readAllLinesFromRhino();
            this.runCases() ;
        }
        else if( environmentType == 'spider-monkey' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
    };

    this.configureStreamsAndReadInput();
}

new CodeExecutioner();


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

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

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

  console.log(n);
});


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 count_F = 0, count_S = 0;
    let start = (input[1][0] === 'S') ? 1 : 0;

    [...input[1]].forEach( (s) => {
        if(s === 'F' && start === 1){
            count_F++; start = 0;
        }
        else if(s === 'S' && start === 0){
            count_S++; start = 1;
        }
    });

    if(count_F > count_S)
        console.log('YES');
    else
        console.log("NO");
});


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

rl.on('line', (d) => {
  const [n, l, r] = d.split(' ').map(Number);
  const minArr = new Array(n).fill(1);
  const maxArr = new Array(n).fill(1);

  let count = 2;
  let idx = 0;
  for (let i = 1; i < l; i++) {
    minArr[idx] = count;
    idx++;
    count *= 2;
  }

  count = 2;
  idx = 0;
  for (let i = 1; i < r; i++) {
    idx = i;
    maxArr[i] = count;
    count *= 2;
  }

  count /= 2;
  for (let i = idx; i < maxArr.length; i++) {
    maxArr[i] = count;
  }

  const minSum = minArr.reduce((a, b) => a + b, 0);
  const maxSum = maxArr.reduce((a, b) => a + b, 0);

  console.log(minSum, maxSum);

  c++;
});


const fs = require("fs");

const input = fs.readFileSync(0, "utf8").trim().split("\n");

const testCases = [];

function parseInput() {
  let index = 0;

  // T = parseInt(input[0]);

  // for (let i = 0; i < T; i++) {
  //   index++;
  const [n, m] = input[index].split(" ").map((item) => BigInt(item));
  const testCase = {
    n,
    m,
  };
  testCases.push(testCase);
  // }
}

function solution(testCase) {
  const { n, m } = testCase;

  const modulo = 998244353n;

  let result = 0n;
  let toRemove = m;
  const primes = [];
  let primeProd = 1n;

  let exp = m;
  for (let l = 2n; l <= n; l++) {
    exp = (exp * m) % modulo;
    result = (result + exp) % modulo;
  }

  for (let l = 2n; l <= n; l++) {
    if (!primes.find((p) => l % p == 0)) {
      primes.push(l);
      primeProd *= l;
    }
    if (toRemove) {
      toRemove *= m / primeProd;
    }
    if (toRemove == 0) break;
    result = (result - toRemove) % modulo;
  }

  console.log(((result + modulo) % modulo).toString());
}

parseInput();

testCases.forEach(solution);


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

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

  const arr = d.split(' ').map(Number);
  const idx1 = arr.indexOf(1);
  const idx2 = arr.indexOf(arr.length);
  const min = Math.min(idx1, idx2);
  const max = Math.max(idx1, idx2);
  const ans = Math.max(max - 0, arr.length - min - 1);

  console.log(ans);

  c++;
});


//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 count = 0;
  for(var i = 0; i < s.length; i++){
    if(s[i] == "7" || s[i] == "4"){
      count++;
    }
  }
  if(count == 7 || count == 4){
    myout("YES");
  }else{
    myout("NO");
  }
}


const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
rl.question("", function (str) {
      var res = (str.replace(/[^A-Z]/g, "").length);
      var reslow = (str.replace(/[^a-z]/g, "").length);
      if (reslow >= res) {
        var up = str.replace(str, str.toLowerCase());
        console.log(up);
      } else {
        var low = str.replace(str, str.toUpperCase());
        console.log(low);
      }
      rl.close();
    }
);


//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 N = nextInt();
  if(N % 2 == 0){
    myout("Mahmoud");
  }else{
    myout("Ehab");
  }
}


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

process.stdin.on('data', (input) => {
  let result = '';

  for (const c of input.trim())
    if (!c.match(/(a|o|y|e|u|i)/i)) result += `.${c.toLowerCase()}`;

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


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

let currentLine = 0
let inputString = ''

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

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

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

function main() {
    const str = readLine().trim();
    const n = parseInt(str)
    let m = parseInt(str[str.length - 1]);
    // console.log(n, m)
    if (m % 2 === 0) {
        console.log(n / 2)
    } else if (m % 2 !== 0) {
        console.log(-(n + 1) / 2)
    }
}