// NYAN NYAN
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄░░░░░░░░░
// ░░░░░░░░▄▀░░░░░░░░░░░░▄░░░░░░░▀▄░░░░░░░
// ░░░░░░░░█░░▄░░░░▄░░░░░░░░░░░░░░█░░░░░░░
// ░░░░░░░░█░░░░░░░░░░░░▄█▄▄░░▄░░░█░▄▄▄░░░
// ░▄▄▄▄▄░░█░░░░░░▀░░░░▀█░░▀▄░░░░░█▀▀░██░░
// ░██▄▀██▄█░░░▄░░░░░░░██░░░░▀▀▀▀▀░░░░██░░
// ░░▀██▄▀██░░░░░░░░▀░██▀░░░░░░░░░░░░░▀██░
// ░░░░▀████░▀░░░░▄░░░██░░░▄█░░░░▄░▄█░░██░
// ░░░░░░░▀█░░░░▄░░░░░██░░░░▄░░░▄░░▄░░░██░
// ░░░░░░░▄█▄░░░░░░░░░░░▀▄░░▀▀▀▀▀▀▀▀░░▄▀░░
// ░░░░░░█▀▀█████████▀▀▀▀████████████▀░░░░
// ░░░░░░████▀░░███▀░░░░░░▀███░░▀██▀░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

// 백준의 노드 버전이 너무 낮아 babel 사용.
// 풀이는 solve() 함수에 있음.

const CODEFORCES_NODE = "cf";
const CODEFORCES_V8 = "cf-v8";
const BEAKJOON = "bj";
const TEST = "test";
// var SITE = BEAKJOON;
var SITE = CODEFORCES_NODE;
var DEBUG = false;

if(SITE == BEAKJOON){
  if (!String.prototype.startsWith) {
    String.prototype.startsWith = function(search, pos) {
      return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
    };
  }
  if (!String.prototype.endsWith) {
    String.prototype.endsWith = function(search, this_len) {
      if (this_len === undefined || this_len > this.length) {
        this_len = this.length;
      }
      return this.substring(this_len - search.length, this_len) === search;
    };
  }
  if (!String.prototype.repeat) {
    String.prototype.repeat = function(count) {
      'use strict';
      if (this == null) {
        throw new TypeError('can\'t convert ' + this + ' to object');
      }
      var str = '' + this;
      count = +count;
      if (count != count) {
        count = 0;
      }
      if (count < 0) {
        throw new RangeError('repeat count must be non-negative');
      }
      if (count == Infinity) {
        throw new RangeError('repeat count must be less than infinity');
      }
      count = Math.floor(count);
      if (str.length == 0 || count == 0) {
        return '';
      }
      // Ensuring count is a 31-bit integer allows us to heavily optimize the
      // main part. But anyway, most current (August 2014) browsers can't handle
      // strings 1 << 28 chars or longer, so:
      if (str.length * count >= 1 << 28) {
        throw new RangeError('repeat count must not overflow maximum string size');
      }
      var maxCount = str.length * count;
      count = Math.floor(Math.log(count) / Math.log(2));
      while (count) {
         str += str;
         count--;
      }
      str += str.substring(0, maxCount - str.length);
      return str;
    }
  }
}

String.prototype.replaceAt=function(index, replacement) {
  return this.substr(0, index) + replacement+ this.substr(index + replacement.length);
}

Function.prototype.repeat = function(times){
  for(let i = 0; i < times; i++){
    this();
  }
}

Array.prototype.getMaxConsecutiveSum = function(defaultValue = -Infinity){
  const N = this.length;
  let maxsum = defaultValue;
  let cursum = defaultValue;
  let cur;
  for(var ii = 0; ii < N; ii++){
    cur = this[ii];
    if(cursum + cur > 0){
      if(cur > cursum + cur){
        cursum = cur;
      } else cursum += cur;
    } else {
      cursum = cur;
      if(maxsum < cursum){
        maxsum = cursum;
      }
    }
    if(maxsum < cursum){
      maxsum = cursum;
    }
  }
  this.maxConsecutiveSum = maxsum;
  return maxsum;
}

try {
  require('manakin').global;
  // require ("babel-polyfill");
} catch (error) {

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

let inputFilePath = '';
switch(SITE){
  case TEST:
    const config = require('config');
    var fs = require("fs");
    var path = require('path');
    inputFilePath = config.get('INPUTFILEPATH') || path.resolve(__dirname, "input.txt");
    break;
  default:
    inputFilePath = './input.txt';
    break;
}
const INPUTFILEPATH = inputFilePath;

// if (!String.prototype.endsWith) {
// 	String.prototype.endsWith = function(search, this_len) {
// 		if (this_len === undefined || this_len > this.length) {
// 			this_len = this.length;
// 		}
// 		return this.substring(this_len - search.length, this_len) === search;
// 	};
// }
// if (!Array.prototype.includes) {
//   Array.prototype.includes = function (target) {
//     return this.indexOf(target) !== -1
//   }
// }

const newLine = '\n';
var ans;
var inputText = "";
var lineCount = 0;
var lines;
var input;
var readline;
var getlines;
var lineOpen = false;
var readingLine = '';

var clockStart;
var clock;

var print;
print = console.log;
var it;
var step;
function EnableLogging(){
  it = console.info;
  step = console.success;
}
function DisableLogging(){
  it = function it(params) {
    return 0;
  }
  step = it;
}
if (DEBUG) {
  EnableLogging();
  clock = function(start) {
    if ( !start ) return process.hrtime();
    var end = process.hrtime(start);
    return Math.round((end[0]*1000) + (end[1]/1000000));
  }
} else {
  DisableLogging();
}

// prepares test data. to replace line input, assign arrays to lines variable.
function prepareTestData() {
  // it(lines);

  // lines = ['custom line 1', 'custom line 2'];
}

// executes exactly once for both test and run. execution time will be included to elapsed time.
const prepareSolve = () => {

}

function power(x, y) {    //분할 정복을 이용하여 x^y 구하기
  let ret = 1;
  while (y > 0) {
    if (y % 2) {
        ret *= x;
        ret %= P;
    }
    x *= x;
    x %= P;
    y /= 2;
  }
  return ret;
}

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

// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ MAIN SOLVE FUNCTION ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

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

function solve(){
  const [n, k] = readInts();

  var ans = [0,0,0];

  var r = n * 2;
  var g = n * 5;
  var b = b * 8;

  var rn = k * ans[0];  // k * ans[0] > n * 2
  var gn = k * ans[1];
  var bn = k * ans[2];

  ans[0] = Math.ceil(n * 2 / k);
  ans[1] = Math.ceil(n * 5 / k);
  ans[2] = Math.ceil(n * 8 / k);
  it(ans);
  print(ans.reduce((a,b)=>a+b));
}

// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

function resetRead(){
  lineCount = 0;
}

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

function readOne(separator=' ') {
  if(lineOpen && readingLine != null){
  // if(lineOpen){
    // it(readingLine);
    let splitPos = readingLine.search(separator)

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

function readInts() {
  try {
    lineOpen = false;
    return readline()
      .split(" ")
      .map(x => parseInt(x));
  } catch (error) {
    console.error(error);
    return null;
  }
}

switch (SITE) {
  case TEST:
    var fs = require("fs");
    var path = require('path');
    // input = fs.createReadStream(path.resolve(__dirname, "input.txt"), {
    //   encoding: "utf8"
    // });
    input = fs.createReadStream(INPUTFILEPATH, {
      encoding: "utf8"
    });

    function inputListener(line) {
      console.log(line);
      if(line.startsWith('end')){
        console.log('end');
        closing();
      }
      if (!line) {
        closing();
      }
      lineCount++;
      inputText += line + "\r\n";
    }

    function readlines() {
      const readline = require("readline");
      const rl = readline.createInterface({
        input,
        output: process.stdout,
        terminal: false
      });
      rl.on("line", inputListener);
      rl.on('close', closing);
    }

    getlines = function* (inputText) {
      var lines = inputText.split(/\r?\n/);
      for (let line of lines) {
        yield line + newLine;
      }
    }

    readline = function () {
      return lines.next().value.trim();
    }

    readlines();

    break;

  case CODEFORCES_NODE:
    input = process.stdin;

    function inputListener(line) {
      if (!line) {
        closing();
      }
      lineCount++;
      inputText += line + "\r\n";
    }

    function readlines() {
      const readline = require("readline");
      const rl = readline.createInterface({
        input,
        output: process.stdout,
        terminal: false
      });
      rl.on("line", inputListener);
      rl.on('close', closing);
    }

    getlines = function* (inputText) {
      var lines = inputText.split(/\r?\n/);
      for (let line of lines) {
        yield line + newLine;
      }
    }

    readline = function () {
      return lines.next().value.trim();
    }

    readlines();

    break;
  case BEAKJOON:
    var fs = require('fs');
    if (DEBUG) {
      // input = fs.readFileSync('./input.txt').toString();
      inputText = fs.readFileSync(INPUTFILEPATH).toString();

    } else {
      inputText = fs.readFileSync('/dev/stdin').toString();
    }

    readline = function () {
      lineCount++;
      let line = lines[lineCount - 1];
      if (line)
        return lines[lineCount - 1].trim();
      else return null;
    }

    getlines = function (inputText) {
      lineCount = 0;
      return inputText.split(/\r?\n/);
    }

    // lines = getlines(input);
    closing();
    break;
  default:
    break;
}

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


function main(stdin) {
  const horseshoes = stdin.split(" ").map(v => parseInt(v));
  console.log(horseshoes.sort().reduce((ac, val, i, arr) => arr[i - 1] === val ? ac + 1 : ac, 0));
}

main(
  require("fs")
    .readFileSync(0, "utf-8")
    .trim()
);


//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 s = next();
  var output = 0;
  for(var i = 0; i < s.length - 2; i++){
  	if(s[i] == "Q"){
  		for(var j = i + 1; j < s.length - 1; j++){
  			if(s[j] == "A"){
  				for(var k = j + 1; k < s.length; k++){
  					if(s[k] == "Q"){
  						output++;
  					}
  				}
  			}
  		}
  	}
  }
  myout(output);
}


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

(function init() {
  var string = '';

  process.stdin.setEncoding('utf8');

  process.stdin.on('readable', function () {
    string += process.stdin.read();
  });

  process.stdin.once('end', function () {
    // main(new Input(string));
    var myArgs = string.split(' ');
const n = parseInt(myArgs[0], 10);
const k = parseInt(myArgs[1], 10);
process.stdout.write(solve(n,k) + '');
  });
}());


const readline = require('readline');

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

rl.question('', (w) => {
  main(w);
  rl.close();
});

function main(watermelon) {
  watermelon = parseInt(watermelon);
  let numbersPar = fragWatermelon(watermelon);
  let totalNumbers = numbersPar.length;
  if (numbersPar.length >= 1 && (numbersPar[0] + numbersPar[totalNumbers-1]) === watermelon){
    console.log('YES')
  } else {
    console.log('NO')
  }
}

function fragWatermelon(watermelon) {
  let numbersPar = [];
  for(let i = 1; i < watermelon; i++){
    if ((i%2) === 0){
      numbersPar.push(i)
    }
  }
  return numbersPar;
}


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

// End of interface

const solution = function(a, b){
	let i = 0;
	while (a <= b) {
		a = a * 3;
		b = b * 2;
		i++;
	}
	return i;
};


function solve() {
    let input = readline().split(' ').map(Number),
            n = input[0],
            k = input[1];
    for (;k--;) {
        if (n % 10) {
            n--;
        } else {
            n /= 10;
        }
    }
    print(n);
}

if (typeof readline !== 'function') {
    let input = [],
            i = 0;
    function print() {
        console.log.apply(null, arguments);
    }
    function readline() {
        return input[i++];
    };

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

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

    RL.on('close', solve);
} else {
    solve();
}


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

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


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

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

  if (n === 2) {
    console.log(2);
  }
  else {
    console.log(1);
  }
});


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

intInput.on('line', (line) => {
	mat.push(line.split(" "))
});
intInput.on('close', () => {
	let iOne, jOne;
	outer: for (let i = 0; i < mat.length; i++) {
		let row = mat[i];
		inner: for (let j = 0; j < row.length; j++) {
			if (Number(row[j]) == 1) {
				iOne = i;
				jOne = j;
				break inner;
				break outer
			}
		}
	}
	result = Math.abs(iOne - 2);
	result += Math.abs(jOne - 2)
	console.log(result);
})


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

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


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 testCases = readline();
  // let isPalindrome = true;

  for (let i = 0; i < testCases; i++) {
    let n = Number(readline());
    console.log(2 ** n - 1);
    // console.log(Number(n) - 1);
  }
  // return isPalindrome ? k : 2 * k;
}


const readline = require('readline');

let inputs = [];
const chars = [
    'a', 'b', 'c', 'd',
    'e', 'f', 'g', 'h',
    'i', 'j', 'k', 'l',
    'm', 'n', 'o', 'p',
    'q', 'r', 's', 't',
    'u', 'v', 'w', 'x',
    'y', 'z'
];

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

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

// Excute algorithm
rl.on('close', () => {
    let firstWord = inputs[0];
    let secondWord = inputs[1];

    recognize(firstWord, secondWord)

})

/*
 ****************************
 * Devide & Conquer functions
 ****************************
 */

// Recognize which one's order is greater than the other
function recognize(fWord, sWord) {

    for (let i = 0; i < fWord.length; i++) {
        const char1 = fWord[i].toLowerCase();
        const char2 = sWord[i].toLowerCase();

        if (chars.indexOf(char1) > chars.indexOf(char2))
            return console.log(1);
        else if (chars.indexOf(char1) < chars.indexOf(char2))
            return console.log(-1);
    }

    return console.log(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 output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        let f = readline().split(' ').map(Number);
        let s = readline().split(' ').map(Number);

        let result = 2;
        if (f[0] === 0 && f[1] === 0 && s[0] === 0 && s[1] === 0) {
            result = 0;
        } else if (f[0] + f[1] + s[0] + s[1] === 4) {
            result = 2;
        } else {
            result = 1;
        }

        output(result);
    }
}


const readline = require('readline');

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

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

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

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

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

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

const lines = [];
async function work(line, lineNr) {
    lines.push(line);
    if (lines.length === 8) {
        const solutionForLine = await solve(lines);
        const responseLine = `${solutionForLine}\n`;
        process.stdout.write(responseLine);
    }
}

/**
 *
 * Solution goes below
 *
 */
function solve(input) {
    const arr = input.map(row => row.trim().split(''));
    let counter = 0;
    const row = arr.find(r => r.some(i => i === 'W'));
    // console.log(row);
    if (row) row.forEach(i => i === 'B' && counter++);
    // console.log(counter);
    counter += arr.filter(row => row.every(i => i === 'B')).length;
    // console.log(arr);
    // console.log(arr.filter(row => row.every(i => i === 'B')))
    return counter;
}


const readline = require("readline")

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let word;
let currentChar = "a".charCodeAt(0)
let rotations = 0;

rl.on("line", (input) => {
    if (!word) {
        word = input.split(" ").toString();
        //  console.log(word.charCodeAt(0), currentChar)
    }
    if (word) {
        for (let index = 0; index < word.length; index++) {
            // if (word.charCodeAt(index) == currentChar) {
            //     rotations += 0
            //     continue;
            // }
            let temp = Math.abs((word.charCodeAt(index) - currentChar))
            // console.log("Temp=>", temp, "CurrentChar =>", currentChar, "\n")
            if (temp > 13) {
                rotations += (25 - (temp - 1))
                currentChar = word.charCodeAt(index)
            }
            if (temp <= 13) {
                currentChar = word.charCodeAt(index)
                rotations += temp
            }

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

    }
})


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

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

readline.on('close', () => {
    const n = Number(input[0]);
    const left = [], right = [];
    for (let i = 1; i <= n; i++) {
        let [l, r] = input[i].split(' ');
        left.push(l); right.push(r);
    }
    let c = 0;
    for (let i = 0; i < left.length; i++) {
        for (let j = 0; j < right.length; j++) {
            if (j === i) continue;
            if (left[i] === right[j]) c++;
        }
    }
    console.log(c);
});


const readline = require('readline');

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

let x = 0
let y = 0

rl.question('',data=>{
    let data_found = data.split(" ");
    x = parseInt(data_found[0]);
    y = parseInt(data_found[1]);

    let count = 1;

    for(var i = 0;true;i++)
    {
        x = x * 3;
        y = y * 2;

        if(x > y)
        {
            console.log(count);
            return;
        }
        else
        {
            count++;
        }
    }

})


const readline = require('readline');

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

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

var hasExactlyTwoPrimeDivs = function (n) {
    let counter = 0, limit = parseInt(n / 2);
    for (let i = 2; i <= limit; i++)
        counter += (n % i == 0 && isPrime(i));

    return counter == 2;
}

rl.on('line', function (input) {
    let n = parseInt(input), ans = 0;
    for (let i = 6; i <= n; i++)
        ans += hasExactlyTwoPrimeDivs(i);
    console.log(ans);
    rl.close();

});


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

function main() {
    let nums = readLine().split(' ').map(Number);
    let [studentNums, seconds] = nums;
    let studentOrder = readLine().split('');
    for (let i = 0; i < seconds; i++) {
        for (let j = 0; j < studentNums - 1; j++) {
            if (studentOrder[j] === 'B' && studentOrder[j + 1] === 'G') {
                studentOrder[j] = 'G';
                studentOrder[j + 1] = 'B';
                j++;
            }
        }
    }
    console.log(studentOrder.join(''));
}


'use strict';

var fs = require('fs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(read) {
  const [rn, rb, rns, re, rbs] = convertInput(read);
  const [n, m] = rns();
  let pre = 1,
      M = mod(m),
      res = 0,
      ans = M,
      ans1 = M;
  const p = getPrimes(n + 10);
  for (let i = 2; i <= n; i++) {
    if (pre <= m && p[i]) pre = pre * i;
    if (pre > m) {
      ans = 0;
    } else {
      ans = mul(ans, Math.floor(m / pre));
    }
    ans1 = mul(ans1, M);
    res = mod(res + ans1 - ans);
  }
  return res;
}
function getPrimes(n) {
  const nums = new Array(n + 1).fill(1);
  nums[0] = nums[1] = 0;
  const primes = [];
  for (let i = 2; i <= n; i++) {
    if (nums[i]) primes.push(i);
    for (let j = 0; primes[j] <= n / i; j++) {
      nums[primes[j] * i] = 0;
      if (i % primes[j] === 0) break;
    }
  }
  return nums;
}
const MOD = 998244353;
function mod(num) {
  if (num >= MOD) return num % MOD;else if (num < 0) return (num % MOD + MOD) % MOD;
  return num;
}
function mul(...args) {
  if (args.length === 0) throw new Error('参数不能为空');
  if (args.length === 1) return args[0];
  const [a, b] = args;
  if (args.length > 2) return mul(mul(a, b), ...args.slice(2));
  return (Math.floor(a / 65536) * b % MOD * 65536 + (a & 65535) * b) % MOD;
}
function convertInput(read) {
  const rn = () => Number(read());
  const rb = () => BigInt(read());
  const rns = () => read().split(/\s+/).map(Number);
  const re = () => read().split(/\s+/).map(s => Number(s) - 1);
  const rbs = () => read().split(/\s+/).map(BigInt);
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  try {
    let t = 1;
    let res = new Array(t);
    let limit = 0;
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < limit) ; else {
        res[i] = s;
      }
    }
    if (t >= limit) {
      return res.join('\n');
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split(/\r?\n/);
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(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 [k, n, w] = readLine().split(" ").map(Number);

  var totalPrice = 0;

  for (var i = 1; i <= w; i++) {
    totalPrice += k * i;
  }
  var borrow = totalPrice - n;
  if (borrow > 0) {
    console.log(borrow);
  } else {
    console.log(0);
  }
}


function main() {
    const n = +stdin[0];
    console.log(n * 3 / 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');

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

rl.on('line', n => {
  const a = Array.from(n).filter(letter => letter === 'a').length;
  console.log((a > (n.length / 2)) ? n.length : (a + (a - 1)));
  rl.close();
});


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 point = Infinity;

    for (let i = 0; i <= 2; i++) {
        if (point + i > arr[i]) {
            point = arr[i] - i;
        }
    }

    console.log(point * 3 + 3);
});


// Nothing special here, just self-made reading api
class Reader{constructor(a,b){this.stream=a,this.stream.setEncoding("utf8"),this.bufSize=b||1024,this.buf="",this.streamEnded=!1}onReadable(a){return()=>{for(let b;-1===(b=this.buf.indexOf("\n"));){if(0===this.stream.readableLength)return this.stream.read(),void this.stream.once("readable",this.onReadable(a));this.buf+=this.stream.read(Math.min(this.bufSize,this.stream.readableLength))}this.stream.removeAllListeners("end"),this.readline().then(a)}}onEnd(a){return()=>{this.streamEnded=!0,this.readline().then(a)}}readline(){return new Promise(a=>{const b=this.buf.indexOf("\n");if(-1===b&&!this.streamEnded)this.stream.once("readable",this.onReadable(a)),this.stream.once("end",this.onEnd(a));else{let c;this.streamEnded?(c=this.buf,this.buf=""):(c=this.buf.substring(0,b),this.buf=this.buf.substring(b+1)),a(c)}})}}(async()=>{const a=new Reader(process.stdin);await solution(a.readline.bind(a),console.log.bind(this))})();

async function solution(rl, wl) {
    let [n, k] = (await rl()).split(' ').map(Number);

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

    wl(n);
}


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

const input = [];

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

readLine.on("line", (line) => input.push(line));
readLine.on("close", () => {
  const square = splitAndParseInt(input[0])
  console.log(Math.floor((square[0]*square[1])/2))
});


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

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

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

  console.log( Math.ceil(x/5) );
});


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 2 * a;
    if (b * (b + 1) >= forTheNumberOfSquaress) return 2 * b + 1;
    return 2 * b + 2;
}


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

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

function main() {
	const exp = readLine().split('+').sort().join('+');
	console.log(exp);
}


//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 L = one[0];
	var R = one[1];
	var C = one[2];
	if(Math.abs(L - R) >= C){
		myout((Math.min(Math.max(L, R), Math.min(L, R) + C)) * 2);
	}else{
		var diff = Math.abs(L - R);
		if(L > R){
			R += diff;
		}else{
			L += diff;
		}
		C -= diff;
		myout((Math.floor(C / 2) + L) * 2);
	}
}


var readline = require("readline");

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var l = 0;
var r = 0;
rl.on("line", function(line){
    l++;
    if(line.indexOf("1") != -1){
         r = Math.abs(l-3) + Math.abs(line.split(" ").indexOf('1') - 2);
    }
    if (l == 5) {
        console.log(r);
        process.exit(0);
    }
});


const readline = require("readline");

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

rl.question('', (usrIn) => {
    [ lim, bob] = usrIn.split(' ');
    lim = parseInt(lim);
    bob = parseInt(bob);
    let count = 0
    while(true) {
        if(lim <= bob) {
            lim *= 3;
            bob *=2;
            count++;
        } else {
            break;
        }
    }
    console.log(count);
    rl.close();
});


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

readline.on('line', input => {
  let n = input;
  const seq = ['Sheldon', 'Leonard', 'Penny', 'Rajesh', 'Howard'];

  while (n > 5) {
    n = Math.floor(n / 2) - 2;
  }

  console.log(seq[n - 1]);
});


const readline = require('readline');

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

let end = 0;
rl.on('line', (input) => {
    x = input.split(' ').map((item) => {return parseInt(item)});
    while (x[1] > 0){
        let lastDigit = x[0]%10;
        if (lastDigit != 0)x[0]--;
        if (lastDigit == 0)x[0]= parseInt(x[0] / 10);
        x[1]--;
    }
    console.log(x[0]);
    rl.close();
})


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

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

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const n = parseInt(arr[0])
  const a = arr[1]
  const map = {}
  for(let i = 1; i < n; i ++) {
    var key = a[i - 1] + a[i]
    if(!map[key]) map[key] = 1
    else map[key] = map[key] + 1
  }

  var max = 0
  var maxK = ''
  for(let i in map) {
    if(map[i] > max) {
      max = map[i]
      maxK = i
    }
  }
  console.log(maxK)

})


let fs=require("fs")

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

txt.forEach(element => {
    football(element)
});

function football(str){
    let tab=str.split("+").filter(data=>{return data.length>0}).map(data=>{return data*1}).sort((a,b)=>{return a-b}).join("+")
    console.log(tab);
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
        findTheTotalPlacedDominoes(readline());
}

function findTheTotalPlacedDominoes(matrix) {

    const matrixArr = matrix.split(' ');

    const canvasX = matrixArr[0];
    const canvasY = matrixArr[1];

    const result = Math.floor(canvasX * canvasY / 2);

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

}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let stickLength;
let lines=0;
rl.on('line', (input,index) => {
    let res=input.split(" ");

        stickLength=Number(res[0]);

    lines++;
}).on('close', () => {
    getRectangleStick(stickLength);
});

function getRectangleStick(stickLength) {
    if(stickLength<=2000000000 && stickLength%2 === 0){
        if(stickLength%4===0){
            console.log(Math.trunc((stickLength-1)/4));
        }else{
            console.log(Math.trunc(stickLength/4));
        }
    }else{
        console.log(0);
    }
}


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 n = parseInt(readLine());
    if (n % 2 === 0) {
        console.log(n / 2)
    } else if (n % 2 !== 0) {
        console.log((-(n + 1) )/ 2)
    }
}


function pagesPrinter (string) {
    let [n, p, k] = string.split(' ');
    n = parseInt(n)
    p = parseInt(p)
    k = parseInt(k)
    let result = [];
    if ((p - k) > 1) result.push('<<');

    for (let i = (p - k); i < p; i++) {
        if (i >= 1) result.push(i);
    }

    result.push('(' + p + ')');

    for (let i = (p + 1); i <= (p + k); i++) {
        if (i <= n) result.push(i);
    }

    if ((p + k) < n) result.push('>>');

    return result.join(' ');
}

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

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


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

function solution(input){
    if(input === "2"){
        return "NO"
    }
    return input % 2 === 0 ? "YES" : "NO"
}

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


const readline = require('readline')

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

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

function solve(a, b) {
 if (a == b) { console.log(0); return; }

 const m = {}
 if (b > a) {
  const t = a; a = b; b = t;
 }
 const ma = { [a]: 0 }
 const mb = { [b]: 0 }

 const qa = [[a, 0]]
 const qb = [[b, 0]]

 let min = Infinity;
 while (true) {
  if (qa.length) {
  const [aa, sa] = qa.shift()

  for (const d of [2,3,5]) {
   if (aa%d == 0) {
     const r = aa/d
     if (mb[r] != undefined) { min = Math.min(mb[r]+sa+1, min); }
     if (!ma[r]) { qa.push([r, sa+1]) }
     ma[r] = ma[r] || (sa+1);
   }
  }
 }

 if (qb.length) {

  const [bb, sb] = qb.shift()
  for (const d of [2,3,5]) {
   if (bb%d == 0) {
     const r = bb/d
     if (ma[r] != undefined) { min = Math.min(ma[r]+sb+1, min); }
     if (!mb[r]) { qb.push([r, sb+1]) }
     mb[r] = mb[r] || (sb+1);
   }
  }
 }

 if (isFinite(min)) { console.log(min); return; }

  if (!qa.length && !qb.length) { console.log(-1); return; }

 }
}


'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 output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        let x = Number(readline());
        let arr = readline().split(' ').map(Number);

        let result = 'YES';

        let first = arr[x - 1];
        let second = first ? arr[first - 1] : 0;

        if (first === 0) {
            result = 'NO';
        } else if (second === 0) {
            result = 'NO';
        }

        output(result);
    }
}


/**
 * Problem - http://codeforces.com/contest/989/problem/A
 */

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

var input_stdin = ''
var input_stdin_array = ''
var input_currentline = 0

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

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

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

function main() {
  let input = readLine()
  process.stdout.write(doAppearInSomeCell(input))
  process.exit()
}

function doAppearInSomeCell(input) {
    if (input.length < 3) {
        return 'No'
    }

    let set = ['ABC', 'ACB', 'BAC', 'BCA', 'CAB', 'CBA']

    for (let i = 0 ; i < input.length ; i++) {
        let k = input.substring(i, i + 3)
        if (k.length === 3 && set.indexOf(k) !== -1) {
            return 'Yes'
        }
    }

    return 'No'
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    const number = readline();
   (number !=2 && number % 2 == 0) ? process.stdout.write("YES") : process.stdout.write("NO");
}


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

rl.on('line', (data) => {
  arr.push(+data);
});

rl.on('close', () => {
  const [a, b, c, d, e, f] = arr;

  let suite2 = Math.min(b, c, d);
  let suite1 = Math.min(a, d - suite2);
  if (f > e) {
    suite2 = Math.min(b, c, d);
    suite1 = Math.min(a, d - suite2);
  }
  else {
    suite1 = Math.min(a, d);
    suite2 = Math.min(b, c, d - suite1);
  }

  const price1 = suite1 * e < 0 ? 0 : suite1 * e;
  const price2 = suite2 * f < 0 ? 0 : suite2 * f;
  const ans = price1 + price2;

  console.log(ans);
});


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 arr = [...d];
  const obj = {};

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

  const countArr = Object.values(obj);

  if (countArr.some((x) => x > k)) {
    console.log('NO');
  }
  else {
    console.log('YES');
  }

  c++;
});


let fs = require("fs");

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

}

function doit(n1, n2) {
    for (let i = 1; i < Infinity; i++) {
        n1 *= 3;
        n2 *= 2;
        if (n1 > n2) {
            console.log(i);
            break;
        }

    }
}


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

let l = 0;
let w = []
let h = []

rl.on('line', (input) => {
    if (l === 0) {
        let inp = input.split(" ").map(x => parseInt(x))
        w.push(inp[0])
        h.push(inp[1])
    } else if (l === 1) {
        let inp = input.split(" ").map(x => parseInt(x))
        w.push(inp[0])
        h.push(inp[1])
    } else {
        rl.close();
        let inp = input.split(" ").map(x => parseInt(x))
        let wg = w[0]
        let hg = h[0]
        w.push(inp[0])
        h.push(inp[1])
        if (h[1] < h[2]) {
            let aux = h[1]
            h[1] = h[2]
            h[2] = aux
            aux = w[1]
            w[1] = w[2]
            w[2] = aux
        }
        for (let i = h[0]; i >= h[1]; i--) {
            wg += i
            hg--
        }

        wg -= w[1]
        if (wg < 0)
            wg = 0
        if (hg <= 0) {
            console.log(wg)
            return
        }
        for (let i = h[1] - 1; i >= h[2]; i--) {
            wg += i
            hg--
        }
        wg -= w[2]
        if (wg < 0)
            wg = 0
        for (let i = hg; i >= 0; i--) {
            wg += i;
        }
        console.log(wg)
    }
    l++
});


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

  if (m === 0 || m === 1) {
    console.log(1);
  }
  else if (n === m) {
    console.log(0);
  }
  else if (n / 2 > m) {
    console.log(m);
  }
  else {
    console.log(n - m);
  }

  c++;
});


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

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

readline.on('close', () => {
    const word = new Set(input[1].toLowerCase());
    if (word.size === 26) console.log('YES');
    else console.log('NO');
});


let i = ''

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

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

    let a = parseInt(lines[0].split(" ")[0])
    let ta = parseInt(lines[0].split(" ")[1])

    let b = parseInt(lines[1].split(" ")[0])
    let tb = parseInt(lines[1].split(" ")[1])

    let startingHour = parseInt(lines[2].split(":")[0])
    let startingMinute = parseInt(lines[2].split(":")[1])
    let startingTime = (startingHour * 60) + startingMinute

    let startOfShift = 5 * 60
    let endOfShift = 23 * 60 + 59

    let count = 0

    for (i = startOfShift; i <= endOfShift; i = i+b) {
        if ( i < startingTime + ta && i + tb > startingTime ) {
            count ++
        }
    }

    console.log(count)
 })


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

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

  let ans = 0;
  const arr = str.split(' ');

  for (let i = 0; i < arr.length; i++) {
    let curr = 0;

    for (let j = 0; j < arr[i].length; j++) {
      if (arr[i].charCodeAt(j) >= 65 && arr[i].charCodeAt(j) <= 90) {
        curr++;
      }
    }

    ans = Math.max(ans, curr);
  }

  console.log(ans);

  c++;
});


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

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

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

  console.log(max - min);
});


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

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


var xString = readline(),
	digits = xString.split(""),
	xLength = xString.length,
	maxSum = getDigitsSum(xString),
	maxNumber = xString,
	newNumber, newDigits, newSum, nineDigits;

for(var i = 0; i < xLength; i++) {
	nineDigits = (new Array(xLength - i)).join("9").split("");
	newDigits = digits.slice(0, i + 1).concat(nineDigits);

	if(--newDigits[i] < 0 && i) continue;
	newDigits[i] = (!i && newDigits[i] <= 0) ? "" : "" + newDigits[i];

	newNumber = newDigits.join("");
	newSum = getDigitsSum(newDigits);

	if(newSum > maxSum || (newSum == maxSum && +newNumber > +maxNumber)) {
		maxNumber = newNumber;
		maxSum = newSum;
	}
}

function getDigitsSum(digits) {
	if(!Array.isArray(digits)) digits = ("" + digits).split("");
	return digits.reduce(function (sum, n) {
		return sum + 1*n;
	}, 0);
}

print(maxNumber);


function main() {
    // write code here:
    var arr = stdin[0].split('');
    var str = Array.from(new Set(arr)).length % 2 === 0 ? 'CHAT WITH HER!' : 'IGNORE HIM!';
    console.log(str);
}

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


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    let [Limak , Bob] = readline().split(" ");
    let years =1;
    while (true){

        Limak*=3;
        Bob*=2;
        if (Limak > Bob)
            break;

        years++
    }
    console.log(years);
    return ;
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

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

function main() {
  // input
  const s = readline();
  let result = 0;
  let last = 'a'.charCodeAt();
  for (let i = 0; i < s.length; i++) {
    const c = s.charCodeAt(i);
    const delta = Math.abs(last - c);
    if (delta > 13) {
      result += 26 - delta;
    } else {
      result += delta;
    }
    last = c;
  }
  // output
  print(result);
}


const readline = require("readline");

async function readInput() {
  const readLineInterface = readline.createInterface({
    input: process.stdin
  });
  return new Promise(resolve => {
    readLineInterface.on("line", line => {
      const [n, m, a] = line.split(" ");
      resolve({
        n: parseInt(n, 10),
        m: parseInt(m, 10),
        a: parseInt(a, 10)
      });
    });
  });
}

function calculateOutput(n, m, a) {
  const stonesOnNSide = Math.ceil(n / a);
  const stonesOnMSide = Math.ceil(m / a);
  return stonesOnNSide * stonesOnMSide;
}

async function main() {
  const { n, m, a } = await readInput();
  const output = calculateOutput(n, m, a);
  console.log(output);
}

main();


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

process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  const tiles = lines[0].split(' ');
  console.log(minTiles(tiles));
});

function minTiles(arr) {
  const set = new Set([...arr]);
  if (set.size === 1) return 0;
  if (set.size === 2) return 1;

  let min = 2;
  set.forEach(tile => {
    if (set.has(`${Number(tile.split('')[0]) + 1}${tile.split('')[1]}`)) {
      if (set.has(`${Number(tile.split('')[0]) + 2}${tile.split('')[1]}`)) {
        min = 0;
      } else {
        min = Math.min(min, 1);
      }
    } else if (set.has(`${Number(tile.split('')[0]) + 2}${tile.split('')[1]}`)) {
      min = Math.min(min, 1);
    }
  });

  return min;
}


function solution(arr){
    var ret = 0;
    while (arr[0] <= arr[1]) {
        arr[0] *= 3
        arr[1] *= 2
        ret++;
    }
    return ret
}
process.stdin.addListener("data", (data)=>{
    var arr = data.toString().trim().split(/[\s,]+/).map(Number)
    console.log(solution(arr))
})


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

//Don't have to see. end------------------------------------------
function Main(){
  var s = next().toLowerCase();
  var t = next().toLowerCase();
  if(s == t){
    myout(0);
  }else if(s < t){
    myout(-1);
  }else{
    myout(1);
  }
}


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let a = readLine();
    let b = readLine();
    let c = '';
    for (let i = 0; i < a.length; i++) {
        c = a[i] + c;
    }
    if (b === c) {
        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;
let n, m;

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

  m = BigInt(d);
  const ans = (m % 2n ** n).toString();
  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 n=+(readLine());
    let enc=readLine().trim();
    let ans=enc;
    for(let i=2;i<=n;++i)
    {
        if(n%i==0)
        {
            ans=ans.substr(0,i).split("").reverse().join("")+ans.substr(i);
        }
    }
    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↑入力 ↓出力');
	Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
	};
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
	var list = nextIntArray();
	var set = new Set();
	for(var i = 0; i < N; i++){
		if(list[i] != 0){
			set.add(list[i]);
		}
	}
	myout(set.size);
}


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(s => s.trim())
  main()
})

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

function main() {
  const size = +readline()
  process.stdout.write(size > 2 && size % 2 === 0 ? 'YES' : '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");
  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 set = new Set(nextIntArray());
  myout(4 - set.size);
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    const testCases = Number(readline());
    for (let i = 0; i < testCases; i++) {
        const n = Number(readline());
        console.log(countSquaresAndCubes(n));
    }
}

function countSquaresAndCubes(num) {
    let cnt = 0;
    let i = 2;
    let squares = 1, cubes = 1;
    let arr = [];
    while (squares <= num) {
        squares = i*i;
        if (squares <= num) {
            arr.push(squares);
            cnt++;
        }
        i++;
    }
    let j = 2;
    while (cubes <= num) {
        cubes = j*j*j;
        if (cubes <= num && !arr.includes(cubes)) cnt++;
        j++;
    }
    return cnt + 1;
}


'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 solve(n) {
    return n%2===0 && n>=4 ? `YES`: `NO`;
}

function main() {

    const nk = readLine().split(' ');

    const n = parseInt(nk[0], 10);

    let result = solve(n);
    console.log(result);
}


let stdin = process.openStdin();

stdin.addListener('data', (data) => {
    let input = data.toString().split(' ');
    console.log(Math.ceil(input[0] / input[2]) * Math.ceil(input[1] / input[2]));
    process.exit(0);
});


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

let inputString = '';
let currentLine = 0;

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

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

	main();
});

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

function main() {
	let n = +readline();
	let a = [];
	while (n--) {
		let m = +readline();
		a.push(m);
	}
	let flag = calc(a, 0);
	if (flag == 0) console.log('NO');
	else console.log('YES');
}

calc = (a, sum) => {
	if (a.length == 0) {
		if (sum % 360 == 0) return 1;
		else return 0;
	} else {
		return calc(a.slice(1), sum + a[0]) + calc(a.slice(1), sum - a[0]);
	}
};


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

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

let nl = nextLine();

nl.num = function() {
		return Number(this.next().value);
	};
nl.nums = function() {
		return this.next().value.split(/\s/g).map(Number);
	};
nl.line = function() {
		return this.next().value;
	}

const sol = () => {
	let [n, k, x] = nl.nums();
	let a  = nl.nums();

	let result = a.slice(0, n - k).reduce((x, y) => x + y, 0) + k * x;
	console.log(result);

};

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


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

const main = () => {
    const line = readLine();
    let [n, k] = line.trim().split(' ').map(Number);
    for (let i = 0; i < k; i++) {
        if ((n % 10) === 0) {
            n = parseInt(n / 10);
        } else {
            n = n - 1;
        }
    }
    console.log(n);
}


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

function transform(data) {
    for (let i = 0; i < length - 1; i++) {
        if (data[i] === 'B' && data[i + 1] === 'G') {
            const temp = data[i];
            data[i] = data[i + 1];
            data[i + 1] = temp;
            i++;
        }
    }
    return data;
}

function solve(data) {
    for (let i = 0; i < t; i++) {
        data = transform(data);
    }
    return data;

}

rl.on('line', (line) => {
    if (!length) {
        [length, t] = line.split(' ').map(Number);
        return
    }
    console.log(solve(line.split('')).join(''));
});


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

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

const dragons = () => {
    let [k,l,m,n,d] = input.map(x => +x);
    let count = 0;
    for (let i = 1; i <= d; i++) {
        if ( (i % n === 0) || (i % m === 0) ||
            (i % l === 0) || (i % k === 0) ) {
            count++;
        }
    }
    console.log(count);
};

readLine.on('close', dragons);


const fs = require('fs');
const stdinBuffer = fs.readFileSync(0);
const inpuString = stdinBuffer.toString();
let [number,times] = inpuString.split(' ').map(x => { return parseInt(x, 10);});

function tanyaSub(number) {
  return number % 10 === 0 ? number / 10 : number -1;
}

while (times > 0) {
  number = tanyaSub(number);
  times--;
}

process.stdout.write(`${number}`)


input = []
process.stdin.setEncoding('ascii');
process.stdin.on('data', z => {
    inp = z.split('\n')
    for(let i in inp) {
        if(inp[i].slice(-1) == '\r') {
            inp[i] = inp[i].slice(0, -1)
        }
        input.push(inp[i])
    }
})

process.stdin.on('end', z => {
    // console.log(input)
    a = input[1].split(' ')
    b = input[2].split(' ')
    // console.log(a, b)
    for(let i in a) {
        if(b.includes(a[i])) {
            process.stdout.write(a[i] + ' ')
        }
    }
    process.stdout.write('\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() {
  const [total, front, back] = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  const diff = total - front;

  if (diff > back) console.log(back + 1);
  else console.log(diff);
}


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

let input = [];

rl.on('line', function(line) {
	input.push(line);
	if (input.length === 3) {
		expression(input);
		rl.close();
	}
});

let expression = (input) => {
	//1+2+3 _ 1*2*3 _ (1+2)*3  _ 1*(2+3)    _ 1*2+3 _ 1+2*3
	input = input.map((el) => {
		return el * 1;
	});

	let val = [
		input[0] + input[1] + input[2],
		input[0] * input[1] * input[2],
		(input[0] + input[1]) * input[2],
		input[0] * (input[1] + input[2]),
		input[0] * input[1] + input[2],
		input[0] + input[1] * input[2]
	];

	var max = val.reduce(function(a, b) {
		return Math.max(a, b);
	});

	console.log(max);
};


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
        findTheTotalPlacedDominoes(readline());
}

function findTheTotalPlacedDominoes(matrix) {
    const dominoX = 2;
    const dominoY = 1;

    const matrixArr = matrix.split(' ');

    const canvasX = matrixArr[0];
    const canvasY = matrixArr[1];

    const possibleDivision4XAxis = canvasX / dominoX;
    const possibleDivision4YAxis = canvasY / dominoY;

    const result = Math.floor(possibleDivision4XAxis * possibleDivision4YAxis);

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

}


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  var str = readLine().split("");
  var getLen = removed(str);
  if (getLen.length % 2 === 0) {
    console.log("CHAT WITH HER!");
  } else {
    console.log("IGNORE HIM!");
  }
}
function removed(str) {
  return [...new Set(str)].join("");
}


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

function main(stdin) {
  const [n, k] = stdin.shift().split(' ').map(Number)
  const as = stdin.shift().split(' ')
  process.stdout.write(as.filter(a => a > 0 && +a >= as[k-1]).length + '')
}

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

let inputString = ''

process.stdin.on('data', (inputStdin) => inputString += inputStdin)
process.stdin.on('end', () =>
  main(inputString.trim().split('\n').map(s => s.trim())))


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

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

readline.on('close', () => {
    const [a, b, c] = input.map(v => parseInt(v));
    let abc = a * b * c, apbpc = a + b + c, apbc = (a + b) * c, abpc = a * (b + c);
    if (abc > apbpc && abc > apbc && abc > abpc) console.log(abc);
    else if (apbpc > abc && apbpc > apbc && apbpc > abpc) console.log(apbpc);
    else if (apbc > abc && apbc > apbpc && apbc > abpc) console.log(apbc);
    else console.log(abpc);
});


 /*
Own input stream*/
const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    terminal: false
});

process.stdin.setEncoding('utf8');
let arr=[]
rl.on('line', (input) => {
    if(input!='') arr.push(input)

}).on('close', () => {
    console.log(minfill(arr))
    process.exit(0);

});
function minfill(arr){
 if(arr==2) return "NO"

   if ((arr/2)%2==0){
       return "YES"

   }
   else if(arr%2!=0){
        return "NO"
   }
   else{
       return "YES"

   }

}

module.exports=(minfill)


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

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

readLine.on('close', () => {
	let table = input[0].split('')
	const your = input[1].split(' ')

	let check = false

	your.forEach((el, index) => {
		el.split('').forEach(item => {
			if (table.indexOf(item) !== -1) {
				check = true
			}
		})
	})

	if (check)
		console.log('YES')
	else
		console.log('NO')
})


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
 let s1 = readline().toLowerCase();
 let s2 = readline().toLowerCase();
let output = 0;

 for (let i =0,c=s1.length ; i < c  ; i++ ){
     if (s1[i].charCodeAt(0) > s2[i].charCodeAt(0)) {
         output = 1; break;
     }
     else if (s1[i].charCodeAt(0) < s2[i].charCodeAt(0)){
         output = -1 ; break;
     }
 }

console.log(output)

}


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

rl.on("line", (line) => {
  if (line > 0) console.log(parseInt(line) + "");
  else {
    line = line.split("");
    if (line.length == 2) console.log(0);
    else {
      if (line[line.length - 1] > line[line.length - 2]) {
        line.pop();
        line = line.join("");
        console.log(parseInt(line) + "");
      } else {
        let save = line.pop();
        line.pop();
        line.push(save);
        line = line.join("");
        console.log(parseInt(line) + "");
      }
    }
  }
});

rl.on("close", () => {});


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

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

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const ax = arr.shift().split(' ')
  const v = parseInt(ax[0])
  const e = parseInt(ax[1])

  if(e == 0) {
    console.log(0)
    return
  }
  if(v <= 6) {
    console.log(e)
  }

  else {
    let m = new Map()

    for(let i = 1; i <= v; i ++) {
      m.set(i, [])
    }

    for(let i = 0; i < e; i ++) {
      const edge = arr.shift().split(' ')
      const a = parseInt(edge[0])
      const b = parseInt(edge[1])
      m.get(a).push(b)
      m.get(b).push(a)
    }

    var f = false
    var noOfVertices = 20
    for(let j = 1; j <= 7; j ++) {
      var a7 = m.get(j)
      for(let i = 1; i <= 7; i ++) {
        if(i == j) continue
        var other = m.get(i)
        var x = a7.filter(el => other.indexOf(el) != -1)
        if(x.length == 0) {
          f = true
          break
        }
        else if(x.length < noOfVertices) {
          noOfVertices = x.length
        }
      }
    }
    if(f) {
      console.log(e)
    }

    else {
      console.log(e - noOfVertices)
    }
  }
})


function main() {
    // write code here:
    var arr=stdin[0].split(' ').map(a => Number.parseInt(a)),s;
    var min = Math.min(arr[1], arr[2]);
    s=(arr[0] <= min) ? 'Yes' : 'No';
    console.log(s);
}

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


'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = "";
let lines = [];
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
process.stdin.on('end', _ => {
    lines = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
});

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

function main() {
    const a = readline().split(" ").map(x => parseInt(x));
    console.log(Math.ceil(a[0] / a[2]) * Math.ceil(a[1] / a[2]));
}


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

rl.on('line', function(line){
    var out;
    if (line % 2 === 0 && line > 2 ) {
         out = "Yes"
    }
    else {
        out = "NO";
    }
    console.log(out);
})


const readline = require('readline');

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

rl.on('line', (input) => {
    let temp = input.split(' ').map(item => parseInt(item));
    let n = temp[0], m = temp[1], a = temp[2];
   // let x = (n % a ) ? (n/a).toFixed(0) + 1 : n/a;
   // let y =  (m % a) ? (m/a).toFixed(0) + 1 : m/a;
   let x = Math.ceil(n/a);
   let y = Math.ceil(m/a);
    //console.log("n = " + n + "  m = " + m + "  a = " + a + "  x = " + x + "  y = " + y );
    console.log(x*y);
    rl.close();
  });


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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

const main=()=>{
	let [k,r] = readLine().split(" ").map(n=>+n)
	let canBuy = true
	let i = 0
	let h = 1

	while(canBuy){
		i++
		h = i*k
		if(h%10==0 || h%10==r)
			canBuy=false
	}

	console.log(i)
}


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

// let stdin = [
//   '512 4',
//   // '1000000000 9',
// ]
// main();

function main() {
  let [n, k] = stdin[0].split(' ');
  for (let i = 1; i<=Number(k); i++) {
    const lastDigit = n[n.length - 1];
    if(lastDigit !== '0') {
      n = String(Number(n) - 1);
    } else {
      n = n.slice(0, lastDigit-1);
    }
  }
  console.log(n)
}


'use strict';

let input = [];
const readline = require('readline')

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

rl.on('line', (line) => {
    input = line.split(' ').map((x) => { return parseInt(x) });

    let count = input[0];
    for(let i = input[1]; i--;) {
        if(count % 10) {
        count--;
        }
        else {
        count /= 10;
        }
    }
    console.log(count);
});

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


function funkyNumbers(n) {

    var funkyNumber = 'NO';

    var maxTriangle = maxTrianglePossible(n);

    for(let i = maxTriangle; i > 0; i--) {
        var firstTriangle = triangleNumbers(i);
        var rem = n - firstTriangle

        if(rem === 0) continue;

        var secFactor = maxTrianglePossible(rem);
        var secTriangle = triangleNumbers(secFactor);

        var triangles = firstTriangle + secTriangle;

        if(triangles == n) {
            funkyNumber = 'YES';
            break;
        }

    }

    return funkyNumber;
}

function maxTrianglePossible(n) {
    //k(k+1) / 2 = n where n is an integer
    //k(k+1) = n*2
    //k^2 + k - n*2 = 0 -> factors

    var k = Math.floor( Math.sqrt(n*2) );

    return k;

}

function triangleNumbers(x) {

    var f = ( x * (x + 1) ) / 2;

    return f;
}

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

readline.on('line', n => {
    readline.close();

    let res = funkyNumbers(n);
    console.log(res);
});


// 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 readline() { return inputString[currentLine++]; }
const println = (x = "") => process.stdout.write(String(x) + "\n");
const print = x => { process.stdout.write(String(x)); }
// >>>>>>>>>>>>> Main starts here <<<<<<<<<<<<<<

function main() {
    let s = readline();
    let f = 0;
    if (s.includes("H")) f = 1;
    if (s.includes("Q")) f = 1;
    if (s.includes("9")) f = 1;
    println(f ? "YES" : "NO");
}


const { read } = require('fs');

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

readline.question('', w => {
    if(parseInt(w) %2==0 && parseInt(w)>=4){
        console.log('YES');
    }
    else{
        console.log('NO');
    }
    readline.close();
})


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

// * STANDARD INPUT IS STORED IN A STRING
var arr = '';

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

process.stdin.on('end', function () {
  // * CONVERTING THAT INPUT INTO AN ARRAY
  arr = arr.split('\n');
  // * EXTRACTING THE NUMBER OF TESTCASES
  var a = arr[0];
  var b = arr[1];

  a = a.toLowerCase();
  b = b.toLowerCase();

  if (a === b) {
    console.log(0);
  } else if (a > b) {
    console.log(1);
  } else if (a < b) {
    console.log(-1);
  }
});


// let weight = process.argv[2];
// let weight =  input();

// if (weight >= 2 && weight % 2 == 0)

// {
//     console.log('YES')
// }
// else
// {
//     console.log('NO')
// }

/************* KEEP BELOW CODE AS IT IS *********************/
/**
 * This code has been taken from: https://codeforces.com/blog/entry/69610
 * I am not the owner of the readLine function below, understanding them require knowledge of basic NodeJS I/O and streams
 */
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++];
}

/****** BELOW HERE START WRITING YOUR CODE IN main() FUNCTION   ***************************************/
/**
 * Use "readLine()" function for input, which will return a string consisting the entire line, so accordingly split the string
 * when required.
 *
 * I am using console.log() to output
 */
function main() {
    let weight = readLine();
    // let weight = process.argv[2];
    // console.log(weight)
    if (weight > 2 && weight % 2 == 0)
    {
        console.log('YES')
    }
    else
    {
        console.log('NO')
    }

    // t = parseInt(t);
    // console.log("mai yahan aaya")
    // while(t--) {
    //     let line = readLine();
    //     line = line.split(" ");
    //     let n = parseInt(line[0]);
    //     let m = parseInt(line[1]);
    //     if(n === 1) {
    //         console.log("0");
    //     } else if (n === 2) {
    //         console.log(m);
    //     } else {
    //         console.log(2*m);
    //     }
    // }
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
   // const x = readline();

    var x = readline(); // first line of input usually gives the no. of test cases,i.e, the no. of lines ahead.
    var inp; // declaring the variable outside the loop
    for (var i = 0; i < x; i++) {
        inp = readline();
        console.log(foo(inp))
    }

    // for (let i = 1; i <= x; i++) {
    //     var line2 = readline();
    //     console.log(foo(line2))
    // }
    // foo(x);
    // foo(line2);
}

function test_same_digit(num) {
    const first = num % 10;
    while (num) {
        if (num % 10 !== first) return false;
        num = Math.floor(num / 10);
    }
    return true
}

function foo(n) {

    let result = new Set();
    let b = false;
    for (let i = 1; i <= n; i++) {
        let res = i;
        let index = 1;
        let d = i;

        if (b) {

            break
        }
        while (res < 10000) {
            if (res == n) {
                result.add(`${res}`)
                b = true;
                break
            }
            if (test_same_digit(Number(res)) && !result.has(res)) {
                result.add(`${res}`)

            }
            res = `${d}`.repeat(index);
            index++
        }
    }

    let d = Array.from(result);

    let sum = 0;
    for (let i = 0; i < d.length; i++) {
        let f = d[i].split("").length || 0;
        sum += Number(f)
    }
    return sum
}


let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

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), 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;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/); r = 0;
  let [n, k, s, t] = inp;
  n = +n;
  k = +k;
  if (t[0] == t[1]) {
    let x = Math.min([...s].filter(c => c == t[0]).length + k, n);
    console.log(x * (x - 1) / 2);
    return;
  }
  let f = Arr(0, n + 1, i => Arr(0, n + 1, i => Arr(0, n + 1, i => -1e5)));
  f[0][0][0] = 0;
  For(0, n, i => {
    For(0, k, j => {
      For(0, i, cnt0 => {
        if (f[i][j][cnt0] < 0) return;
        let e0 = s[i] == t[0];
        let e1 = s[i] == t[1];
        f[i + 1][j][cnt0 + e0] = Math.max(f[i + 1][j][cnt0 + e0], f[i][j][cnt0] + e1 * cnt0);
        f[i + 1][j + 1][cnt0 + 1] = Math.max(f[i + 1][j + 1][cnt0 + 1], f[i][j][cnt0]);
        f[i + 1][j + 1][cnt0] = Math.max(f[i + 1][j][cnt0], f[i][j][cnt0] + cnt0);
      })
    })
  })
  // console.log(f);
  console.log(Arr(0, k, i => Arr(0, n, j => f[n][i][j]).max()[0]).max()[0]);
})();


/**
 * Created by ishanarora on 25/11/18.
 */

const stdin = process.openStdin();
let content = ``;
stdin.addListener('data', d => {
  content += d.toString();
});

stdin.addListener('end', () => {
  content = content.split("\n");
  let content_one = content[0].split(" ");
  let total_cities = parseInt(content_one[0]);
  let a = parseInt(content_one[1]);
  let array = content[1].split(" ");
  console.log(totalCriminalCatch(total_cities, a, array));
});

function totalCriminalCatch(totalCities, a, ti) {

    ti = ti.map(Number);
    let count = 0;

    for (var i = 0; i < 100; i++) {

        let a1 = (a - 1 - i >= 0 && ti[a - 1 - i] > 0) || a - 1 - i < 0;
        let a2 = (a - 1 + i < totalCities && ti[a - 1 + i] > 0) || a - 1 + i >= totalCities

        if (a1 && a2) {
            if (i == 0) {
                count += 1;
            } else {

                if ((a - 1 - i >= 0 && ti[a - 1 - i] > 0)) {
                    count++;
                }

                if ((a - 1 + i < totalCities && ti[a - 1 + i] > 0)) {
                    count++;
                }
            }
        }
    }

    return count;
}


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

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

const isCapitalize = s => s.toUpperCase() === s;
const isLower = s => s.toLowerCase() === s;

readLine.on('close', () => {
  const word = input[0];
  let s = 0, b = 0;

  for (let i = 0; i < word.length; i += 1) {
    if (isCapitalize(word[i])) b += 1;
    else s += 1;
  }

  if ( s >= b ) console.log(word.toLowerCase());
  else console.log(word.toUpperCase());
});


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

let currentLine = 0;
let inputString = "";

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

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

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

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

function main() {
  var str = readLine().toLowerCase().split("");
  if (str.length <= 100) {
    var strWithoutVowels = [];
    var vowels = ["a", "e", "i", "o", "u", "y"];
    for (var i = 0; i < str.length; i++) {
      if (vowels.indexOf(str[i]) < 0) {
        strWithoutVowels.push("." + str[i]);
      }
    }
    console.log(strWithoutVowels.join(""));
  }
}


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

// single line input
// readline.on("line", (line) => {
//   readline.close();
// });

// multi line input
readline.on("line", (line) => {
  const input = +line.split(" ")[0];
  readline.close();
  const half = input / 2;
  if (input % 2 === 0) {
    if (half > 1) {
      console.log("YES");
      return;
    }
  }
  console.log("NO");
  return;
});


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

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
	var list = nextIntArray();
	var sum = 0;
	for(var i = 0; i < N; i++){
		sum += Math.abs(list[i]);
	}
	myout(sum);
}


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

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
	var alist = nextIntArray();
	var blist = nextIntArray();
	var asum = 0;
	var bsum = 0;
	for(var i = 0; i < N; i++){
		asum += alist[i];
		bsum += blist[i];
	}
	if(asum >= bsum){
		myout("Yes");
	}else{
		myout("No");
	}
}


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


const readline = require("readline")

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

let teams;
let teamsCounter = 0;
let arrayOfteams = [];
let counter = 0

rl.on("line", (input) => {
    if (!teams) {
        teams = parseInt(input.split(" "))
    } else {
        arrayOfteams.push(input.split(" ").map(Number))
        if (arrayOfteams.length == teams) {
            arrayOfteams.forEach(team => {
                arrayOfteams.forEach(element => {
                    if (team[0] === element[1]) {
                        counter++
                    }
                })
            });
            console.log(counter)
        }

    }

})


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    let x = readLine()
        .split(' ')
        .map(v => parseInt(v))
        .sort((a, b) => {
            return a - b;
        });
    let x1 = x[0];
    let x2 = x[1];
    let x3 = x[2];
    console.log(Math.abs(x2 - x1) + Math.abs(x3 - x2))
}


/**
 * Created by bhavyaagg on 09/06/18.
 */

const readline = require('readline');

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

r1.on('line', (data) => {
  let x = data.split(" ")[0];
  let y = data.split(" ")[1];

  if (x == y) {
    console.log("=");
  } else {
    if (x == 1) {
      console.log("<")
    }
    else if (y == 1) {
      console.log(">")
    }
    else {
      let a = y * Math.log(x) - x * Math.log(y);

      if (a == 0) {
        console.log("=")
      }
      else if (a < 0) {
        console.log("<")
      } else {
        console.log(">")
      }
    }
  }
  // else if (x < y) {
  //
  //   console.log(">")
  // } else {
  //   console.log("<")
  // }

  r1.close();
})


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, k] = d.split(' ').map(Number);
  let red = n * 2;
  let green = n * 5;
  let blue = n * 8;
  let ans = Math.ceil(red / k) + Math.ceil(green / k) + Math.ceil(blue / k);

  console.log(ans);

  c++;
});