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

let count = 0;
let r, c;
// let matrix = [];
// const cake = [];

// const makeRowPoison = (c, cake) => {
//     for (let i = 0; i < matrix.length; i++) {
//         let safe = 1;
//         for (let j = 0; j < matrix[i].length; j++) {
//             if(cake[i][j] === 'S') {
//                 safe = 0;
//             }
//         }

//         if (!safe) {
//             matrix[i][c] = 0;
//         }
//     }
// }

// const makeColPoison = (r, cake) => {
//     for (let i = 0; i < matrix[r].length; i++) {
//         let safe = 1;
//         for (let j = 0; j < matrix.length; j++) {
//             if (cake[j][i] === 'S') {
//                 safe = 0;
//             }
//         }

//         if (!safe) {
//             matrix[r][i] = 0;
//         }
//     }
// }

let row = [];
let col = [];
const cake = [];

rl.on('line', (d) => {
    if (count === 0) {
        count++;
        [r, c] = d.split(' ').map(Number);
        // matrix = new Array(r).fill(1).map(x => new Array(c).fill(1));

        row = new Array(r).fill(1);
        col = new Array(c).fill(1);
        return;
    }

    const cakeLine = d.split('');
    cake.push(cakeLine);

    count++;
});

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

    for (let i = 0; i < cake.length; i++) {
        for (let j = 0; j < cake.length; j++) {
            if (cake[i][j] === 'S') {
                row[i] = 0;
                col[j] = 0;
            }
        }
    }

    for (let i = 0; i < row.length; i++) {
        for (let j = 0; j < col.length; j++) {
            if (cake[i][j] === '.' && (row[i] === 1 || col[j] === 1)) {
                ans++;
            }
        }
    }

    console.log(ans);
});

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

//     for (let row = 0; row < cake.length; row++) {
//         for (let col = 0; col < cake[row].length; col++) {
//             if (cake[row][col] === 'S') {
//                 makeRowPoison(col, cake);
//                 makeColPoison(row, cake);
//             }
//         }
//     }

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

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


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

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

  if(t < k) {
    ans = t;
  }
  else if (t > k && t < n - k + k) {
    ans = k;
  }
  else {
    ans = k - Math.floor(t / k);
  }

  console.log(ans);
});


'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const [ils] = ipt.split(EOL).slice(0, -1)
  const [a, b, c, d, e, f] = ils.split(' ')

  if (c == 0 && d > 0) return console.log('Ron')
  if (b == 0 || d == 0 || f == 0) return console.log('Hermione')
  if (a == 0 || c == 0 || e == 0) return console.log('Ron')
  console.log(1 / a * b / c * d / e * f <= 1 ? 'Hermione' : 'Ron')
})


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

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


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

const solution = () => {
	let a = data.trim().split(/\n/g).map(v => v[0]).join('');
	let f = ['rss', 'prr', 'spp'];
	let m = ['srs', 'rpr', 'psp'];
	let s = ['ssr', 'rrp', 'pps'];
	let ans = '';
	switch(true) {
		case f.includes(a): ans = "F";
			break;
		case m.includes(a): ans = "M";
			break;
		case s.includes(a): ans = "S";
			break;
		default:
			ans = "?";
	}
	console.log(ans);

};


declare const process: any;

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

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

process.stdin.on('end', () => {
    const lines: string[] = input.split('\n');

    const k = parseInt(lines.shift(), 10);

    const occur: number[] = Array(10).fill(1);
    let count: number = 1;
    let index: number = 0;

    while (count < k) {
        occur[index]++;
        count = occur.reduce((acc, value) => acc * value, 1);
        index++;
        if (index === 10) {
            index = 0;
        }
    }

    const word: string = "codeforces";
    const ans: string = occur
        .map((value, index) => word[index].repeat(value))
        .join('');

    console.log(ans);
});

// input helper

function lineToNumArray(line: string): number[] {
    return line.split(' ').map(element => parseInt(element, 10));
}


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


'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++];
}
/**
6
6 1
100010
6 2
000000
5 1
10101
3 1
001
2 2
00
1 1
0

**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

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

    // for(let i=0;i<n;i++) {
    //     solve();
    // }

    let currentString = ['c', 'o', 'd', 'e', 'f', 'o', 'r', 'c', 'e', 's'];
    const occur = new Array(10).fill(1);

    let count = 1;
    let index = 0;

    while(count < n) {
        count = count / occur[index];
        occur[index]++;
        count = count * occur[index];
        index++;
        if(index === 10) {
            index = 0;
        }
    }

    let string = '';

    for(let i=0;i<currentString.length;i++) {
        string = string + currentString[i].repeat(occur[i]);
    }

    console.log(string);

}

function solve() {
    let [n, m] = readline().split(" ").map(Number);
    let a = readline().split("");

    let count = 0;
    let i = 1;
    if(a.length === 1 && a[0] === "0") {
        console.log(1);
        return;
    }

    while(m > count && i < n) {
        if(i === 1 && a[i-1] === '0' && a[i] === '0') {
            count++;
            a[i-1] = "1";
            continue;
        }

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

            continue;
        }

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

        i++;
    }

    console.log(count);
}


let input = [];

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

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

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

    if(code.length == 1){
        console.log(code[0]); process.exit();
    }
    let asnwer = [];
    let same = false, len = 1, count = 0;
    for(let i = 1; i < code.length; i++){
        if(code[i] === code[i-1]){
            len++;
            same = true;
            if(i+1 == code.length){
                if(len > count + 1)
                    for(let j = 0; j < len-(count+1); j++) asnwer.push(code[i-1])
                else
                    for(let j = 0; j < len; j++) asnwer.push(code[i-1])
            }
        } else {
            if(len > count+1){
                count += 1;
                for(let j = 0; j < len-count; j++) asnwer.push(code[i-1])
            } else {
                for(let j = 0; j < len; j++) asnwer.push(code[i-1])
            }

            same = false; len = 1;
        }
    }
    let str_answer = ''; asnwer.forEach( s => str_answer+=s );
    console.log(str_answer)
});


const readline = require('readline');

let inputs = [];

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

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

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

    const nums = inputs.map(num => parseInt(num));
    let maxValue = (nums[0] * nums[1]) + nums[2];

    if (nums[0] * nums[1] * nums[2] > maxValue)
        maxValue = nums[0] * nums[1] * nums[2]

    if ((nums[0] + nums[1]) * nums[2] > maxValue)
        maxValue = (nums[0] + nums[1]) * nums[2]

    if (nums[0] + nums[1] + nums[2] > maxValue)
        maxValue = nums[0] + nums[1] + nums[2]

    console.log(maxValue)
})


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

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

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

	let value = 0;

	if (a === 1) {
		value = (a + b) * c;
	} else if (b === 1) {
		if (a > c) {
			value = (b + c) * a;
		} else {
			value = (a + b) * c;
		}
	} else if (c === 1) {
		value = a * (b + c);
	} else {
		value = a * b * c;
	}

	console.log(value);
}


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

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

readline.on('close', () => {
    const ints = input.map(v => parseInt(v));
    if (ints[0] === 1 && ints[1] === 1 && ints[2] === 1) console.log(ints[0] + ints[1] + ints[2]);
    else if (ints.every(v => v > 2)) console.log(ints[0] * ints[1] * ints[2]);
    else if ((ints[0] + ints[1]) >= ints[2]) console.log((ints[0] + ints[1]) * ints[2]);
    else console.log(ints[0] * (ints[1] + ints[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 a = parseInt(readLine());
  const b = parseInt(readLine());
  const c = parseInt(readLine());
  const maxN = Math.max(Math.max(a+b+c, a + (b * c), (a * b) + c), Math.max(a * b * c, (a + b) * c));
  console.log(maxN);
}


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){
        if(stickLength%4===0){
            console.log(Math.trunc((stickLength-1)/4));
        }else{
            console.log(Math.trunc(stickLength/4));
        }
    }else{
        console.log(0);
    }
}


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

  return min;
}


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

rl.on('line', (d) => {
  const arr = d.split(' ').map(Number);
  const sum = arr.reduce((a, b) => a + b, 0);
  const obj = {0: 0};
  let best = 0;

  for (let i = 0; i < arr.length; i++) {
    if (obj[arr[i]]) {
      best = Math.max(best, arr[i]);
      obj[arr[i]] = Math.min(3, obj[arr[i]] + 1);
    }
    else {
      obj[arr[i]] = 1;
    }
  }

  console.log(sum - best * obj[best]);
  c++;
});


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

var templateString = ""

var c = 0;
rl.on('line', function (line) {
    c += 1;
    if (c == 1) {
        templateString = line;
        rl.close();
        var _p = parse(templateString, 2)
        console.log(result(parseInt(_p[0]), parseInt(_p[1])));
    }
});

function parse(template, iLoop) {
    var out=[]
    var regex = /\d+/gm;
    var str = template;
    var m;
    var c = 0;
    while ((m = regex.exec(str)) !== null) {
        if (m.index === regex.lastIndex) {
            regex.lastIndex++;
        }
        if (c==iLoop) {break}
        out[c] = m[0];
        c+=1;
    }
    return out;
}

function result(n,k) {
    var min = n>k ? k : n;
    min = n==k ? min - 1 : min;
    var start = k - n;
    start = start <= 0 ? 1 : start >= n ? n : start;
    return Math.floor((min - start + 1) / 2);
}


const readline = require('readline');

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

rl.on('line', input => {
    let sum = 0
    input = +input
    for (let i = 0; i < input; i++) {
        sum += input - i
    }
    console.log(sum)
    rl.close();
});


const input = [];

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

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

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

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

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

  console.log(sum);
});


const readline = require('readline');

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

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

rl.on('line', (input) => {
    let temp = input.split(' ').map(item => parseInt(item));
    let a = temp[0], b = temp[1], c = temp[2], d = temp[3];
    if (checkT(a, b, c) == "T" || checkT(b, c, d) == "T" || checkT(a, c, d) == "T" || checkT(a, b, d) == "T")
        console.log("Triangle");
    else if (checkT(a, b, c) == "S" || checkT(b, c, d) == "S" || checkT(a, c, d) == "S" || checkT(a, b, d) == "S")
        console.log("Segment");
    else
        console.log("Impossible");
    rl.close();
});


const readline = require('readline');
//const lineReader = require('fs');
//const scanner = lineReader.createReadStream('main.in');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

function reverse(str) {
    return str.split("").reverse().join("");
}

rl.on('line', (input) => {
    x = input;
    x = reverse(x);
    let an = 0, one = 0;
    for (let i = 0; i < x.length; i++){
        if (i % 2 === 0)an++;
        if (x.charAt(i) === '1')one++;
    }
    if (one === 1 && x.length % 2 === 1)an--;
    console.log(an);
    rl.close();
});


let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  const time = parseInt(lines[0], 2);
  if (time === 0) {
    console.log(0);
  } else {
    console.log(Math.ceil(Math.log(time) / Math.log(4)));
  }
});


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

rl.on('line', (d) => {
  const [n] = [d].map(BigInt);
  let total = 0n;

  for (let i = 1n; i <= n; i++) {
    total += i;
  }

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


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

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

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

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


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

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

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

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


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

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

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


"use strict";
let input = [];
const readline=require('readline');
const RL=readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
RL.on('line', (line)=>{
  input.push(line.trim());
});
RL.on('close', ()=>{
  let [n, k]=input[0].split(" ");
  const arr=input[1].split(" ");
  const scores=arr.map((str)=>{
    return Number(str);
  });

  let answer=0;
  const Kth=Number(k);
  scores.forEach(element => {
    if(element>0 && element>=scores[Kth]){
      answer++;
    }
  });
  console.log(answer);
});


// author: Oscar Ramos

/// Source Code
// const input = require('competitive-programming-js').inputReader
// const { forn } = require('../utils/utils')
//
// const [n, k] = input.readNumberArray()
//
// const a = input.readNumberArray()
//
// a.sort((x, y) => y-x)
//
// let cnt = 0
// forn(k+1, idx => {
//   if(a[idx] > 0)
//     cnt++
// })
//
// console.log(cnt)
//

!function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=1)}([function(t,n){t.exports=function(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}},function(t,n,r){t.exports=r(2)},function(t,n,r){let e,o=0,u={readNumberArray:function(){return e[o++].split(" ").map(t=>Number(t))}};var i="";process.stdin.resume(),process.stdin.setEncoding("utf8"),process.stdin.on("data",(function(t){i+=t})).on("end",(function(){e=i.trim().split("\n").map(t=>t.trim());const{forn:t}=r(3),[n,o]=u.readNumberArray(),c=u.readNumberArray();c.sort((t,n)=>n-t);let f=0;t(o+1,t=>{c[t]>0&&f++}),console.log(f)}))},function(t,n,r){const e=r(4);t.exports={forn:(t,n)=>e(0,t).map(t=>n(t)),fornm:(t,n,r)=>e(0,t).map(t=>e(0,n).map(n=>r(t,n))),matrix:(t,n,r)=>e(0,t).map(()=>e(0,n).map(()=>r))}},function(t,n,r){var e=r(5),o=r(7),u=e((function(t,n){if(!o(t)||!o(n))throw new TypeError("Both arguments to range must be numbers");for(var r=[],e=t;e<n;)r.push(e),e+=1;return r}));t.exports=u},function(t,n,r){var e=r(6),o=r(0);t.exports=function(t){return function n(r,u){switch(arguments.length){case 0:return n;case 1:return o(r)?n:e((function(n){return t(r,n)}));default:return o(r)&&o(u)?n:o(r)?e((function(n){return t(n,u)})):o(u)?e((function(n){return t(r,n)})):t(r,u)}}}},function(t,n,r){var e=r(0);t.exports=function(t){return function n(r){return 0===arguments.length||e(r)?n:t.apply(this,arguments)}}},function(t,n){t.exports=function(t){return"[object Number]"===Object.prototype.toString.call(t)}}]);

/// package.json
// {
//   "name": "competitive",
//   "version": "1.0.0",
//   "description": "",
//   "main": "src/index.js",
//   "scripts": {
//     "convert": "cp-convert -s src/index.js -d output/converted.js",
//     "bundle": "webpack --config ./webpack.config.js",
//     "test": "npm run convert && jest ./",
//     "production": "npm run convert && npm run bundle && node src/getOutput.js",
//     "start": "node src/index.js"
//   },
//   "author": "Oscar Ramos",
//   "dependencies": {
//     "child-process-promise": "^2.2.1",
//     "competitive-programming-js": "^1.0.10",
//     "mathball": "^0.4.0",
//     "ramda": "^0.27.1"
//   },
//   "devDependencies": {
//     "@types/jest": "^26.0.10",
//     "concat-stream": "^2.0.0",
//     "cross-spawn": "^7.0.3",
//     "jest": "^26.4.2",
//     "jest-expect-message": "^1.0.2",
//     "mock-stdin": "^1.0.0",
//     "terser-webpack-plugin": "^4.1.0",
//     "webpack": "^4.44.1",
//     "webpack-cli": "^3.3.12"
//   },
//   "jest": {
//     "setupFilesAfterEnv": ["jest-expect-message"]
//   }
// }
//


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

let stdinInput = '';

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

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

main(data) => {
  stdinInput = data.split('\n');
  const contestant = data[0].split(' ');
  const score = data[1].split(' ');
  const kScore = +contestant[1];
  let count = 0;
  for (let i = 0; i < score.length; i += 1) {
    if (+score[i] < 1 || +score[i] < kScore) break;
    count += 1;
  }
  process.stdout.write(count + '');
}


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

let stdinInput = '';

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

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

function main(data) {
  stdinInput = data.split('\n');
  const contestant = data[0].split(' ');
  const score = data[1].split(' ');
  const kScore = +contestant[1];
  let count = 0;
  for (let i = 0; i < score.length; i += 1) {
    if (+score[i] < 1 || +score[i] < kScore) break;
    count += 1;
  }
  process.stdout.write(count + '');
}


const readline = require('readline');

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

var count = 0;
var k;
var places;

rl.on('line', line => {
    if (count === 0) {
        k = line.split(' ')[1];
        count++;
        return;
    }

    if (count === 1) {
        places = line.split(' ').map(item => parseInt(item));
        rl.close();
    }
});

rl.on('close', () => {
    var targetScore = places[k-1];
    var result = 0;

    while(result !== places.length) {
        var manScore = places[result];

        if (manScore === 0 || manScore < targetScore) break;

        result ++;
    }

    rl.close();
});


'use strict'
const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin
});
var sec, fst, win = 0,
  arr = [],
  i, n, k;
rl.question('', (fst) => {
  rl.on('line', (sec) => {
    n = Number(fst[0]);
    k = Number(fst[2]);
    arr = sec.split(' ');
    for (i = 0; i < k; i++) {
      if (arr[i] > 0) {
        win++;
      }
    }
    while ((arr[k - 1] === arr[k]) && (k < n) && (arr[k - 1] != 0)) {
      if (arr[k] > 0) {
        k++;
        win++;
      }
    }
    console.log(win);
    rl.close();
  });
});


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const [data, results] = i.split(EOL).map((x) => {return x.split(" ").map((y) => { return parseInt(y)})})

    if (Math.max(...results) >= results[data[1] - 1]){
        console.log(results.filter(i => i >= results[data[1] -1]).length);
    } else {console.log(0)}

});


const readline = require('readline');

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

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

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

function solve(data) {

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

}


const input = [];

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

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

RL.on('close', () => {
  const balls = input.pop().split(' ').map(x => parseInt(x));
  const params = input.pop().split(' ').map(x => parseInt(x));

  const [n, k] = params;

  let answer = 0;
  balls.forEach((b, i) => {
    if (b >= balls[k] && b > 0) { answer += 1 }
  });

  console.log(answer)
});


const readline = require('readline')

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

rl.on("line", main)
let i = 1
let n = 0
let k = 0
let w = 0
let score = 0
function main(input){
	if(n == 0 ){
		let arr = input.split(' ')
		n = arr[0]
		k = arr[1]
		return
	}

	const arr = input.split(' ')
	score = arr[k]
	for(var i = 0; i < n; i++){
		let a = arr[i]
		if( parseInt(a) >= parseInt(score) && a > 0){
			w++
		}
	}
	console.log(w)
}


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

let inp = 0
process.stdin.on("data",input=>{
    inp = input
})
process.stdin.on("end",input=>{
    inp = inp.replace(/\s*$/, '').split("\n").map(str => str.replace(/\s*$/, ''));

    main();

})

function main(){
    n = inp[0].split(" ")[0]
    k = inp[0].split(" ")[1]

    let allscores = inp[1].split(" ").map(item=>{return parseInt(item)})

    let gecen = allscores.filter((item)=>{return item >= allscores[k-1]})
    console.log(gecen.length)

}


const readline = require('readline');

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

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

function main() {
    let [n, k] = input[0].split(' ');
    const stdin = input[1].split(' ');

    const scores = stdin.map((stdin) => {
        return Number(stdin);
    });
    let count = 0;
    const thK = Number(k);
    scores.forEach(elm => {
        if (elm > 0 && elm >= scores[thK - 1]) {
            count++;
        }
    });
    console.log(count);
}


const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});
let n,k;
rl.on('line', line => {
    [n, k] = line.split(' ');
);
}).on('close', () => {
    const stdin=input[1].split(' ');

    const scores=stdin.map((stdin)=>{
        return Number(stdin);
    });
    let count=0;
    const thK=Number(k);
    scores.forEach(elm=>{
        if(elm>0 && elm>=scores[thK-1]){
            count++;
        }
    });
    console.log(count);
});


process.stdin.on('data', input => {
  const inputs = input.toString().split('\n');
  const cutOffIndex = inputs[0].split(' ')[1];
  const test = inputs[1];
  const result = getNumberOfCrossedThreshold(test.split(' '), Number(cutOffIndex));
  console.log(result);
});

function getNumberOfCrossedThreshold(arr, cutOffIndex) {
  // Check if the cutoff Indey should be less than array length;
  // array length should be of 1 length;
  const cutOff = arr[cutOffIndex];
  return arr.reduce((acc, curr) => {
    if (Number(curr) >= Number(cutOff)) {
      ++acc;
    }

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

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

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

function main() {
    const [n, k] = readAsIntList();
    const list = readAsIntList().filter(x => x > 0);
    console.log(list.slice(k).filter(x => x === list[k]).length + k);
}


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

var idx = 0;
var out = 0;
var totalScores = 0;
var passScore = 0;
rl.on("line", (theLine) => {
    if (idx === 0) {
        var lines = theLine.split(" ");
        totalScores = parseInt(lines[0]);
        passScore = parseInt(lines[1])-1;
    }
    else {
        var scores =  theLine.split(" ");
        var currentCount = 0;
        if ((parseInt(scores[passScore]) > 0) && (totalScores > 0)) {
            scores.forEach(element => {
                if (parseInt(element) >= parseInt(scores[passScore]))
                    out++;
            });
        }
    }
    idx++;
    if (idx > 1)
    {
        rl.close();
        console.log(out.toString());
    }

})


// Sample code to perform I/O:

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

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

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

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

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

// Write your code here
function nameLookUp(arr) {
    let nLines = arr.split('\n');
    let contestantArr = nLines[0].trim().split(' ');
    let scoresArr = nLines[1].trim().split(' ');
    let kScore = scoresArr[+contestantArr[1]];
    let count = 0;
    for (let i = 0; i < scoresArr.length; i++) {

        if (+scoresArr[i] > 0 && +scoresArr[i] >= kScore) {
            count++;
        }
    }
    return count;

}


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

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

  if (c === 1) {
    c++;
    arr1 = d.split(' ').map(Number);
    return;
  }

  arr2 = d.split(' ').map(Number);
  const sum = arr1.reduce((a, b) => a + b, 0) + arr2.reduce((a, b) => a + b, 0);

  if (sum % 2 === 0) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }

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

    main();
});

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

// Complete the coins function below.
function coins(n) {
var ans=[];
var div=[];
var g=0;
for(var i=0;i<=n;i++){
  if(n%i==0) div.push(i);
}
for(var k=0;k<div.length;k++){
  if(Math.log(n/div[k],2)%1==0){
    g=div[k];
  }
  for(var j=0;j<Math.log(n/g,2);j++) {
    ans.push((Math.pow(2,j))*g)
  }
}
return ans;
}

function main() {
  const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
    const n = parseInt(readLine(), 10);
    let result = coins(n);
  ws.write(result + "\n");
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

// Complete the coins function below.
function coins(n) {
var pri=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103];
var ans=[];
var pridiv=[];
var div =[];
var g=0;
var t=1;
for(var i=0;i<=pri.length;i++){
  if(n%pri[i]==0) pridiv.push(pri[i]);
}
for(var k=0;k<pridiv.length;k++){
  t*=pridiv[k];
}
for (var w=;w<=n;w++){
  if(n%w==0 && w%t==0) div.push(w);
}
return div;
}

function main() {
  const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
    const n = parseInt(readLine(), 10);
    let result = coins(n);
  ws.write(result + "\n");
}


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

// Complete the extraLongFactorials function below.
function extraLongFactorials(n) {
    var ans = [];
    var num = n;
    for (var i = num - 1; i >= 1; i--) {
        if (num % i === 0) {ans.push(i);
        num = i;
        }
    }
    console.log(ans.join(' '));
    return ans;
}
function main() {
   // const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
    const n = parseInt(readLine(), 10);

    const result = extraLongFactorials(n);
   // ws.write(result.join(' ') + '\n');

   // ws.end();
}


'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 coins(n){
	var coins =[];
	coins.push(n);
	while(n!=1){
		if(n%2 ==1){
			n=1;
			coins.push(n);
		}
		else{
			n=n/2;
			coins.push(n);
		}
	}
	return coins.join(" ");
}

/////
function main() {
    const ws = fs.createWriteStream(process.env.OUTPUT_PATH);

    const n = parseInt(readLine(), 10);

   /* for (let tItr = 0; tItr < t; tItr++) {
        const nms = readLine().split(' ');

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

        const m = parseInt(nms[1], 10);

        const s = parseInt(nms[2], 10);

    }*/
	let result = coins(n);
	ws.write(result + "\n");

    ws.end();
}


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

// Complete the saveThePrisoner function below.
function coins(n) {
    var coins = [];
    coins.push(n);
    for (var i = n - 1; i > 0; i--) {
        if ((n % i) == 0) {
            coins.push(i);
            n = i;
        }
    }
    return coins;
}

function main() {
    const ws = fs.createWriteStream(process.env.OUTPUT_PATH);

    const n = parseInt(readLine(), 10);

 /*   for (let tItr = 0; tItr < t; tItr++) {
        const nms = readLine().split(' ');

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

        const m = parseInt(nms[1], 10);

        const s = parseInt(nms[2], 10);

    }*/
    let result = coins(n);

    ws.write(result.join(" ") + "\n");
    ws.end();
}


function main(){
var n = parseInt(readLine(), 10);
var coins = [];
coins.push(n);
for (var i = n - 1; i > 0; i--) {
    if ((n % i) == 0) {
        coins.push(i);
        n = i;
    }
}
console.log( coins.join(" ") );
}


'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 bCoins(n) {
    var arr = [n];
    var i,k,max = n;
    for (i = n-1; i > 1; i--){
        if(max % i === 0){
          arr.push(i);
          max = i;
        }
    }
    arr.push(1)
    console.log(arr.join(' '))
}
function main() {
    // const ws = fs.createWriteStream(process.env.OUTPUT_PATH);

    const n = parseInt(readLine(), 10);

    var res = bCoins(n);

    // ws.write(res.join(' ') + '\n');

    // ws.end();
}


'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 bCoins(n) {
    var arr = [n,1];
    var i,k;
    for (i = 2; i < Math.sqrt(n); i++){
        k = n / i;
        if (n % i == 0) { arr.push(i); if (i != k) arr.push(k);}
    }
    if (Math.sqrt(n) == Math.ceil(Math.sqrt(n))) arr.push(Math.sqrt(n));
    arr = arr.sort((a, b) => b - a);
    console.log(arr)
    var narr = [0];
    var count = 1, j;
    for (i = 1; i < arr.length; i++){
        for (j = 1; j < arr[i]; j++) {
            if (arr[i] % j == 0) { count++; }
        }
        narr.push(count);
        count = 1;
    }
    var max = 0,index;
    narr.map((nar, i) => { if (max < nar) { max = nar; index = i;}})
    max = arr[index];
    arr = [n]
    console.log(max);
    for (i = 1; i < Math.ceil(Math.sqrt(max)); i++) {
        if (max % i == 0) { arr.push(i); if (i!=max / i) arr.push(max / i); }
    }
    arr = arr.sort((a, b) => b - a);
    return arr;
    // console.log(arr);
}
function main() {
    const ws = fs.createWriteStream(process.env.OUTPUT_PATH);

    const n = parseInt(readLine(), 10);

    var res = bCoins(n);

    ws.write(res.join(' ') + '\n');

    ws.end();
}


const readline = require('readline');

let secondLine = false;

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

let inputs = [];

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

// Read Inputs
rl.on('close', () => {
    inputs = inputs[0].split(' ');
    const n = parseInt(inputs[0]);
    const m = parseInt(inputs[1]);
    let moves = 0;

    if (n < m)
        return console.log(-1)

    moves = Math.floor(n / 2) + n % m;
    while (moves%m !== 0 && moves < n) {
        moves +=1;
    }
    console.log(moves)

});


//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  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 x = one[0];
  var y = one[1];
  var z = one[2];
  one = nextIntArray();
  var a = one[0];
  var b = one[1];
  var c = one[2];
  if(a < x){
    myout("NO");
    return;
  }
  a -= x;
  if(a + c < y){
    myout("NO");
    return;
  }
  var ac = a + c;
  ac -= y;
  if(ac + b < z){
    myout("NO");
    return;
  }else{
    myout("YES");
    return;
  }
}


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();
    }
    if (word) {
        for (let index = 0; index < word.length; index++) {
            let temp = Math.abs((word.charCodeAt(index) - currentChar))
            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()
    }
})


function giaiBai(data) {
    let temp = 0
    if(data.length === 1) {
        return
    }
    for(var i = 0; i < data.length; i++) {
        let count = 0
        if(i === 0) {
            count = Math.abs(data.charCodeAt(0) - 97)
        } else {
            count = Math.abs(data.charCodeAt(i) - data.charCodeAt(i - 1))
        }
        if (count > 13) {
            count = 26 - count
        }
        temp = temp + count
    }
    console.log(temp)
}

// Get process.stdin as the standard input object.
var standard_input = process.stdin;

// Set input character encoding.
standard_input.setEncoding('utf-8');

// Prompt user to input data in console.
// console.log("Please input text in command line.");

// When user input data and click enter key.
standard_input.on('data', function (data) {

    // User input exit.
    if(data === 'exit\n'){
        // Program exit.
        console.log("User input complete, program exit.");
        process.exit();
    }else
    {
        // Print user input in console.
        data = data.trim()
        giaiBai(data)
        process.exit();
    }
});


const readline = require("readline")

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

let shovelPrice;
let unlimitedBudget = 10;
let r = 0;
let flag = true;
let counter = 1;

rl.on("line", (input) => {
    if (!shovelPrice) {
        let tempArr = input.split(" ").map(Number)
        shovelPrice = tempArr[0]
        r = tempArr[1]
    }
    if (shovelPrice) {
        while (flag) {
            let temp = 1;
            let temp2 = 0;
            temp = (((unlimitedBudget * counter) + r) / shovelPrice)
            temp2 = (((unlimitedBudget * counter)) / shovelPrice)
            if (temp === Math.round(temp)) {
                console.log(temp)
                flag = false
                rl.close();
            } else if (temp2 === Math.round(temp2)) {
                console.log(temp2)
                flag = false
                rl.close();
            } else {
                counter++
            }

        }
    }

})


const readline = require("readline")

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

let shovelPrice;
let unlimitedBudget = 10;
let r = 0;
let flag = true;
let counter = 1;

rl.on("line", (input) => {
    if (!shovelPrice) {
        let tempArr = input.split(" ").map(Number)
        shovelPrice = tempArr[0]
        r = tempArr[1]
    }
    if (shovelPrice) {
        while (flag) {
            if(shovelPrice===r){
                console.log(counter)
                flag = false
                rl.close();
                break;
            }
            if (shovelPrice % unlimitedBudget * counter === 0 || shovelPrice * counter % 10 === r) {
                console.log(counter)
                flag = false
                rl.close();
                break;
            } else {
                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
    .trim()
    .split("\n")
    .map((string) => {
      return string.trim();
    });

  main();
});

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

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

  buyAShovel(x[0],x[1]);
}

function buyAShovel(k, r) {
  let n = 1;

  while (!((n * k) % 10 === 0 || (n * k) % 10 === r)) {
    n++;
  }
  console.log(n);

  return n;
}


//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 K = nextInt();
  var L = nextInt();
  var M = nextInt();
  var D = nextInt();
  var N = nextInt();
  var output = 0;
  for(var i = 1; i <= N; i++){
    if(i % K == 0 || i % L == 0 || i % K == M || i % D == 0){
      output++;
    }
  }
  myout(output);
}


//Insomnia cure

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

let inp = '';

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

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

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

    let lcm = (a, b) => (a * b) / gcd(a, b);

    let thr = lines.slice(0, 4);

    let flg = true;
    for(let i in thr)  {
        if(thr[i] < lines[4])  {
            flg = false;
        }
    }
    if(flg)  {
        process.stdout.write('0');
        return;
    }

    let thrx = [];

    for(let i = 0; i < thr.length; i++)  {
    	let addflg = true;
    	for(let j = 0; j < thrx.length; j++)  {
    		if(thr[i] % thrx[j] == 0)  {
    			addflg = false;
    			break;
    		}
    		if(thrx[j] % thr[i] == 0)  {
    			thrx[j] = thr[i];
    			addflg = true;
    			break;
    		}
    	}
		if(addflg)  {
			thrx.push(thr[i]);
		}
    }

    let thrf = [thrx, [], [], []];
    for(let i = 0; i < thrx.length; i++)  {
    	for(let j = i + 1; j < thrx.length; j++)  {
    		let l1 = lcm(thrx[i], thrx[j]);
    		for(let k = j + 1; k < thrx.length; k++)  {
    			let l2 = lcm(l1, thrx[k]);
    			for(let l = k + 1; l < thrx.length; l++)  {
    				thrf[3].push(lcm(l3, thrx[l]));
    			}
    			thrf[2].push(l2);
    		}
    		thrf[1].push(l1);
    	}
    }

    let calc = (i) => Math.floor(lines[4] / i);

    let res = 0;

    for(let i = 0; i < thrf.length; i++)  {
    	let sum = 0;
    	for(let j in thrf[i])  {
    		sum += calc(thrf[i][j]);
    	}
    	res += (1 - ((i % 2) * 2)) * sum;
    }

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

    return;
});


//Insomnia cure

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

let inp = '';

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

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

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

    let lcm = (a, b) => (a * b) / gcd(a, b);

    let thr = lines.slice(0, 4);

    let flg = true;
    for(let i in thr)  {
        if(thr[i] < lines[4])  {
            flg = false;
        }
    }
    if(flg)  {
        process.stdout.write('0');
        return;
    }

    let thrx = [];

    for(let i = 0; i < thr.length; i++)  {
    	let addflg = true;
    	for(let j = 0; j < thrx.length; j++)  {
    		if(thr[i] % thrx[j] == 0)  {
    			addflg = false;
    			break;
    		}
    		if(thrx[j] % thr[i] == 0)  {
    			thrx[j] = thr[i];
    			addflg = true;
    			break;
    		}
    	}
		if(addflg)  {
			thrx.push(thr[i]);
		}
    }

    let thrf = [thrx, [], [], []];
    for(let i = 0; i < thrx.length; i++)  {
    	for(let j = i + 1; j < thrx.length; j++)  {
    		let l1 = lcm(thrx[i], thrx[j]);
    		for(let k = j + 1; k < thrx.length; k++)  {
    			let l2 = lcm(l1, thrx[k]);
    			for(let l = k + 1; l < thrx.length; l++)  {
    				thrf[3].push(lcm(l2, thrx[l]));
    			}
    			thrf[2].push(l2);
    		}
    		thrf[1].push(l1);
    	}
    }

    let calc = (i) => Math.floor(lines[4] / i);

    let res = 0;

    for(let i = 0; i < thrf.length; i++)  {
    	let sum = 0;
    	for(let j in thrf[i])  {
    		sum += calc(thrf[i][j]);
    	}
    	res += (1 - ((i % 2) * 2)) * sum;
    }

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

    return;
});


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

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

  if (c === 1) {
    l = +data;
    c++;
    return;
  }

  if (c === 2) {
    m = +data;
    c++;
    return;
  }

  if (c === 3) {
    n = +data;
    c++;
    return;
  }

  if (c === 4) {
    d = +data;
    c++;
  }

  let ans = Math.ceil(d / k) + Math.ceil(d / l) + Math.ceil(d / m) + Math.ceil(d / n) - Math.ceil(d / (k * l)) - Math.ceil(d / (k * m)) - Math.ceil(d / (k * n)) - Math.ceil(d / (l * m)) - Math.ceil(d / (l * n)) - Math.ceil(d / (m * n)) + Math.ceil(d / (k * l * m)) + Math.ceil(d / (k * l * n)) + Math.ceil(d / (l * m * n)) - Math.ceil(d / (k * l * m * n));

  if (k === 1 || l === 1 || m === 1 || n === 1) {
    ans = d;
  }

  console.log(ans);
  // for (let i = 1; i <= d; i++) {
  //   if (i % k === 0 || i % l === 0 || i % m === 0 || i % n === 0) {
  //     ans++;
  //   }
  // }

  // console.log(ans);

  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 k = parseInt(input[0]);
  const l = parseInt(input[1]);
  const m = parseInt(input[2]);
  const n = parseInt(input[3]);
  const d = parseInt(input[4]);

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

  console.log(answ);
});


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

    let result = d;

    if (k == 1 || l == 1 || m == 1 || n == 1) {
        console.log(result);
        return;
    }
    for (let i = 1; i <= d; i++) {
        if (k % i !== 0 && l % i !== 0 && m % i !== 0 && n % i !== 0) {
            result--;
        }
    }
    console.log(result);
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    let k = parseInt(readLine());
    let l = parseInt(readLine());
    let m = parseInt(readLine());
    let n = parseInt(readLine());
    let d = parseInt(readLine());
    if (k == 1 || l == 1 || m == 1 || n == 1) {
        console.log(d);
    } else {
        for (var i = 1; i <= d; i++) {
            if (i % k != 0 && i % l != 0 && i % m != 0 && i % n != 0) {
                d--;
            }
        }
        console.log(d);
    }
}


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

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


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

   let putted = 0;

	while (count > 0) {
	  if (count % 2 == 1) {
	    putted += 1;
	  }
	  count = parseInt(count / 2)
	}

	console.log(putted);
})


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

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

  let mid = Math.ceil(n / 2);
  let x = mid % (k + 1);
  let a = (mid - x) / (k + 1);
  let b = a * k;
  let c = n - a - b;

  console.log(`${a} ${b} ${c}`);
});


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

function main() {
    let brain = readLine();
    while (brain.includes('>')) {
        brain = brain.replace('>', '1000');
    }
    while (brain.includes('<')) {
        brain = brain.replace('<', '1001');
    }
    while (brain.includes('+')) {
        brain = brain.replace('+', '1010');
    }
    while (brain.includes('-')) {
        brain = brain.replace('-', '1011');
    }
    while (brain.includes('.')) {
        brain = brain.replace('.', '1100');
    }
    while (brain.includes(',')) {
        brain = brain.replace(',', '1101');
    }
    while (brain.includes('[')) {
        brain = brain.replace('[', '1110');
    }
    while (brain.includes(']')) {
        brain = brain.replace(']', '1111');
    }
    // console.log(brain);
    let ans = parseInt(brain, 2);
    let final = ans % 1000003;
    console.log(final);
}


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

function main() {
    let brain = readLine();
    while (brain.includes('>')) {
        brain = brain.replace('>', '1000');
    }
    while (brain.includes('<')) {
        brain = brain.replace('<', '1001');
    }
    while (brain.includes('+')) {
        brain = brain.replace('+', '1010');
    }
    while (brain.includes('-')) {
        brain = brain.replace('-', '1011');
    }
    while (brain.includes('.')) {
        brain = brain.replace('.', '1100');
    }
    while (brain.includes(',')) {
        brain = brain.replace(',', '1101');
    }
    while (brain.includes('[')) {
        brain = brain.replace('[', '1110');
    }
    while (brain.includes(']')) {
        brain = brain.replace(']', '1111');
    }
    // console.log(brain);
    let ans = convertBase(brain, 2, 10);
    // let ansString = ans.toString();
    // let final = ans % 1000003;
    let final = 0;
    let length = ans.toString().length;
    for (let i = 0; i < length; i++) {
        final = (final * 10 + (ansString[i] - 0)) % 1000003;
    }
    console.log(final);
}
function parseBigInt(bigint, base) {
    //convert bigint string to array of digit values
    for (var values = [], i = 0; i < bigint.length; i++) {
        values[i] = parseInt(bigint.charAt(i), base);
    }
    return values;
}

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

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


const readline = require('readline');

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

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

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

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

    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 givenYear = readLine();
    let givenYearNumber = parseInt(givenYear);
    while (true) {
        givenYearNumber++;
        let firstDigit = givenYearNumber / 1000;
        let SecondDigit = (givenYearNumber / 100) % 10;
        let ThirdDigit = (givenYearNumber / 10) % 10;
        let LastDigit = givenYearNumber % 10;
        if (
            firstDigit !== SecondDigit &&
            firstDigit !== ThirdDigit &&
            firstDigit !== LastDigit &&
            SecondDigit !== ThirdDigit &&
            SecondDigit !== LastDigit &&
            ThirdDigit !== LastDigit
        ) {
            break;
        }
    }
    console.log(givenYearNumber);
}


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 givenYear = parseInt(readLine());
    while (true) {
        givenYearNumber++;
        let firstDigit = parseInt(givenYearNumber / 1000);
        let SecondDigit = parseInt((givenYearNumber / 100) % 10);
        let ThirdDigit = parseInt((givenYearNumber / 10) % 10);
        let LastDigit = givenYearNumber % 10;
        if (
            firstDigit !== SecondDigit &&
            firstDigit !== ThirdDigit &&
            firstDigit !== LastDigit &&
            SecondDigit !== ThirdDigit &&
            SecondDigit !== LastDigit &&
            ThirdDigit !== LastDigit
        ) {
            break;
        }
    }
    console.log(givenYearNumber);
}


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

    this.rec = function( arr , brr , firstFlag ) {
    	var res , r1 , newArr , newBrr , fl , sz , i , sz1 , sz2 ;
    	if( firstFlag == false && arr.length == this.baseCaseArr.length && brr.length == this.baseCaseBrr.length ) {
    		fl = 1 ;
    		sz = arr.length ;
    		for( i = 0 ; i < sz ; i++ ) {
    			if( arr[ i ] != this.baseCaseArr[ i ] ) {
    				fl = 0 ;
    				break ;
    			}
    		}
    		sz = brr.length ;
    		for( i = 0 ; i < sz ; i++ ) {
    			if( brr[ i ] != this.baseCaseBrr[ i ] ) {
    				fl = 0 ;
    				break ;
    			}
    		}
    		if( fl == 1 ) {
    			return -1 ;
    		}
    	}
    	if( firstFlag == false && arr.length == this.baseCaseBrr.length && brr.length == this.baseCaseArr.length ) {
    		fl = 1 ;
    		sz = arr.length ;
    		for( i = 0 ; i < sz ; i++ ) {
    			if( arr[ i ] != this.baseCaseBrr[ i ] ) {
    				fl = 0 ;
    				break ;
    			}
    		}
    		sz = brr.length ;
    		for( i = 0 ; i < sz ; i++ ) {
    			if( brr[ i ] != this.baseCaseArr[ i ] ) {
    				fl = 0 ;
    				break ;
    			}
    		}
    		if( fl == 1 ) {
    			return -1 ;
    		}
    	}
    	if( arr.length == 0 ) {
    		this.winner = 2 ;
    		return 0 ;
    	}
    	if( brr.length == 0 ) {
    		this.winner = 1 ;
    		return 0 ;
    	}
    	newArr = [] ;
    	newBrr = [] ;
    	sz1 = arr.length ;
    	sz2 = brr.length ;
    	for( i = 1 ; i < sz1 ; i++ ) {
			newArr.push( arr[ i ] ) ;
		}
		for( i = 1 ; i < sz2 ; i++ ) {
			newBrr.push( brr[ i ] ) ;
		}
    	if( arr[ 0 ] > brr[ 0 ] ) {
    		newArr.push( brr[ 0 ] ) ;
    		newArr.push( arr[ 0 ] ) ;
    	}
    	else {
    		newBrr.push( arr[ 0 ] ) ;
    		newBrr.push( brr[ 0 ] ) ;
    	}
    	r1 = this.rec( newArr , newBrr , false ) ;
    	if( r1 == -1 ) {
    		res = -1 ;
    	}
    	else {
    		res = r1 + 1 ;
    	}
    	return res ;
    } ;

    this.solveCase = function() {
        var res , i , j , fl , cn , temp ;
        res = 0 ;
        this.baseCaseArr = [] ;
        for( i = 0 ; i < this.k1 ; i++ ) {
        	this.baseCaseArr.push( this.arr[ i ] ) ;
        }
        this.baseCaseBrr = [] ;
        for( i = 0 ; i < this.k2 ; i++ ) {
        	this.baseCaseBrr.push( this.brr[ i ] ) ;
        }
        this.winner = -1 ;
        res = this.rec( this.arr , this.brr , true ) ;
        if( res == -1 ) {
        	print( res );
        }
        else {
        	print( res + ' ' + this.winner );
        }
    };

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

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

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

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

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

    this.init();
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    this.configureStreamsAndReadInput();
}

new CodeExecutioner();


'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  let n = +ipt.split(EOL)[0]

  const H = ['Sheldon', 'Leonard', 'Penny', 'Rajesh', 'Howard']
  for (let i = 0; i < n; i++) {
    H.push(H[i], H[i])
  }
  console.log(H[n - 1])
})


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

readline.on('line', input => {
  const seq = ['Sheldon', 'Leonard', 'Penny', 'Rajesh', 'Howard'];
  let segment = 0;
  let segmentFloor = 1;
  let segmentCeiling = 5;

  while (!(input >= segmentFloor && input <= segmentCeiling)) {
    segment++;
    segmentFloor = segmentCeiling + 1;
    segmentCeiling = segmentCeiling + (Math.pow(2, segment) * 5);
  }

  const nthAfterFloor = input - segmentFloor + 1;

  const pointer = Math.ceil(nthAfterFloor / (segment + 1)) - 1;

  console.log(seq[pointer]);
});


const input = [];

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

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

RL.on('close', () => {
  const n = parseInt(input[0]);
  let queue = 5, iteration = 1;
  let low, high;

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

  if (n <= 5) { console.log(map[n]); return; }

  while (queue <= n) {
    low = queue;
    queue *= 2;
    high = queue;
  }
  iteration = (high - low) / 5;
  let pos = n - low;
  console.log( map[ parseInt(Math.ceil(pos / iteration)) ] );
});


const input = [];

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

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

RL.on('close', () => {
  const [param] = input[0].split(" ").map(x => parseInt(x));
  const pattern = "qwertyuiopasdfghjkl;zxcvbnm,./";

  const answer = [];
  for (let i = 0; i < input[1].length; i += 1) {
    let k = pattern.indexOf(input[1][i]);
    if (param === 'R') {
      if (k === pattern.length-1) answer.push(pattern[0]);
      else answer.push(pattern[k+1]);
    } else {
      if (k === 0) answer.push(pattern[pattern.length-1]);
      else answer.push(pattern[k-1]);
    }
  }
  console.log(answer.join(''))
});


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

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

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

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

    L--;
    R++;
  }

  console.log(ans);

  c++;
});


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

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var D = one[1];
  var list = next();
  var dp = new Array(N).fill(-1);
  dp[0] = 0;
  for(var i = 0; i < N; i++){
    if(list[i] == "1"){
      for(var j = 1; j <= D; j++){
        if(list[i + j] == "1"){
          if(dp[i + j] == -1){
            dp[i + j] = dp[i] + 1;
          }else{
            dp[i + j] = Math.min(dp[i] + 1, dp[i + j]);
          }
        }
      }
    }
  }
  myout(dp[N - 1]);
}


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

rl.on('line', (str) => {
  let L = 0;
  let R = str.length - 1;
  let ans = '';

  while (L <= R) {
    if (L !== R) {
      ans += str[R];
      ans += str[L];
    }
    else {
      ans += str[L];
    }

    L++;
    R--;
  }

  console.log([...ans].reverse().join(''));

  c++;
});


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

rl.on('line', (d) => {
  if (+d <= 2) {
    console.log(1);
  }
  else {
    console.log(Math.floor(+d / 2) + 1);
  }
});


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

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

const store = {};

function main() {
	let n = readLine() >> 0;
	let map = { 1: 8, 2: 4, 3: 2, 4: 6 };
	n = n % 4;
	if (n === 0) n = 4;
	console.log(map[n]);
}


function funkyNumbers(n) {

    var funkyNumber = 'NO';

    if(n == 1) return funkyNumber;

    var maxTriangle = maxTrianglePossible(n);

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

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


const funkyNumbers = n => {
    let funkyNumber = 'NO';

    let maxTriangle = maxTrianglePossible(n);

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

        if(rem === 0) continue;

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

        let triangles = firstTriangle + secTriangle;

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

    }

    return funkyNumber;
}

const maxTrianglePossible = n => Math.floor( Math.sqrt(n*2) );

const triangleNumbers = x => ( x * (x + 1) ) / 2;

//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('Is ' + n + ' a Funky Number? -> ' + res);
});


let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  const b = parseInt(lines[0], 10);
  const g = parseInt(lines[1], 10);
  const n = parseInt(lines[2], 10);
  console.log(badges(b, g, n));
});

function badges(b, g, n) {
  if (n === b + g) return 1;
  const min = Math.min(b, g);
  return min >= n ? 1 + n : 1 + min;
}


/**
 * Codeforces Challenge #1204B
 *    @ennukee
 *
 * Time Elapsed: 5.64ms (test cases)
 */

const MODE = "SUBMIT";
const CF_1204_B = (n, l, r) =>  {
    /**
     * n, n-1, ..., n-l, 2^1, ..., 2^(l-1)
     * 2^1, ..., 2^(r-1), 2^(r-1), ..., 2^(r-1)
     *
     * 5, 2, 3
     * => 1, 1, 1, 2
     * => 1, 2, 4, 4, 4
     */
    const low_bound = 1 * (n - l + 1) + [...Array(l).keys()].slice(1).reduce((a, c) => a + Math.pow(2, c), 0);
    const high_bound = [...Array(r).keys()].reduce((a, c) => a + Math.pow(2, c), 0) + (n - r) * Math.pow(2, n - r - 1);
    return `${low_bound} ${high_bound}`;
}

/**
 *
 * Submission standard input read-in
 *
 */

if (MODE === "SUBMIT") {
    var readline = require('readline');

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

    rl.question("", function(answer) {
        const parsed = answer.split(' ').map(i => parseInt(i));
        console.log(CF_1204_B(...parsed));
        rl.close();
    });
}

/**
 *
 * Test cases and benchmarking code below this point
 *
 * Unrelated to the solution code
 *
 */

if (MODE === "TEST") {
    const { performance } = require('perf_hooks');
    let timer = performance.now();

    // Assumptions:
    //   1 <= n <= 1000
    //   1 <= l <= r <= min(n, 20)
    //   [n, l, r]
    const test_cases = [
        [4, 2, 2],
        [5, 1, 5]
    ]
    test_cases.forEach(( v ) => {
        console.log( CF_1204_B( ...v ) );
    });

    timer = performance.now() - timer;
    console.log(`Time elapsed for test case: ${timer.toFixed(2)}ms`)
}


process.stdin.setEncoding('utf8');

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

    if (input !== null) {
        let lowerCase = 0;
        let upperCase = 0;

        for (let i = 0; i < input.length; i++) {
            if (input[i] == input[i].toUpperCase()) upperCase++;
            else lowerCase++;
        }

        if (upperCase > lowerCase) input = input.toUpperCase();
        if (lowerCase > upperCase || lowerCase == upperCase) input = input.toLowerCase();

        process.stdout.write(`${input}\n`);
    }
});


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


var str = "AAAAdel";
  var res = (str.replace(/[^A-Z]/g, "").length);
  var reslow = (str.replace(/[^a-z]/g, "").length);
  if(reslow >= res){
  var up = str.replace(str , str.toLowerCase() );
  console.log(up);
  }else{
  var low = str.replace(str , str.toUpperCase() );
  console.log(low);
  }


const readline = require('readline');

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

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


const readline = require('readline');

let inputs = [];

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

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

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

    const n = inputs[0].split(' ').map(num => parseInt(num))[0];
    let puzzles = inputs[1].split(' ').map(num => parseInt(num)).sort((a, b) => a - b).splice(0, n)
    const minimumDiffer = puzzles[puzzles.length - 1] - puzzles[0];

    console.log(minimumDiffer)

})


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

  const arr = d.split(' ').map(Number);
  arr.sort((a, b) => a - b);
  const diff = new Array(arr.length).fill(0);

  for (let i = 1; i < arr.length; i++) {
    diff[i] = arr[i] - arr[i - 1];
  }

  let ans = Infinity;

  for (let i = 0; i < diff.length - n + 1; i++) {
    let sum = 0;

    let idx = i;
    while (idx < i + n) {
      sum += diff[idx];
      idx++;
    }

    ans = Math.min(sum, ans);
  }

  console.log(ans);

  c++;
});


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

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

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

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

	arr.sort((a, b) => a - b);
	console.log(arr[n - 1] - arr[0]);
}


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let [n, m] = readLine().split(' ').map(Number);
    let puzzles = readLine().split(' ').map(Number);
    // let sorted = [];
    // for (let i = 0; i < n; i++) {
    //     sorted.push(puzzles[i]);
    // }
    // sorted.sort((a, b) => a - b);
    // console.log(sorted[sorted.length - 1] - sorted[0]);
    puzzles.sort((a, b) => a - b);

    let min = 10000000000;
    // for (let i = 0; i < puzzles.length; i++) {
    //     for (j = 0; j < puzzles.length; j++) {
    //         if (i === j) {
    //             continue;
    //         }
    //         let diff = Math.abs(puzzles[i] - puzzles[j]);
    //         if (diff < min) {
    //             min = diff;
    //         }
    //     }
    // }
    for (let i = 1; i < m - n; i++) {
        min = Math.min(min, puzzles[i + n - 1] - puzzles[i]);
    }
    console.log(min);
}


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 str = readLine()
    let arr = []

    str.split("").forEach(s => {
        if (arr.indexOf(s) === -1) arr.push(s)
    })

    if (arr.length % 2 === 0) console.log("CHAT WITH HER")
    else console.log("IGNORE HIM")

}


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

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

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


process.stdin.on('data', async data => {
	let result = 0
	const dataarr = data.toString().trim().split('');
	await Promise.all(dataarr.reverse().map(datum => new Promise(resolve => {
		result += (10 - (+datum + 1)%10)%10;
		resolve()
	})))
	if (dataarr.reverse()[0] == 0) result+=10
	result += +dataarr[0] + +!!dataarr.length
	console.log(result)
})