"use strict";var readline=require("readline"),extendStatics=function(r,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n])})(r,t)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function __extends(r,t){function n(){this.constructor=r}extendStatics(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function isFunction(r){return"function"==typeof r}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(r){r&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=r},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(r){setTimeout((function(){throw r}),0)}var empty={closed:!0,next:function(r){},error:function(r){if(config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)},complete:function(){}},isArray=function(){return Array.isArray||function(r){return r&&"number"==typeof r.length}}();function isObject(r){return null!==r&&"object"==typeof r}var UnsubscriptionErrorImpl=function(){function r(r){return Error.call(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map((function(r,t){return t+1+") "+r.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=r,this}return r.prototype=Object.create(Error.prototype),r}(),UnsubscriptionError=UnsubscriptionErrorImpl,Subscription=function(){function r(r){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,r&&(this._unsubscribe=r)}return r.prototype.unsubscribe=function(){var t;if(!this.closed){var n=this._parentOrParents,e=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof r)n.remove(this);else if(null!==n)for(var i=0;i<n.length;++i){n[i].remove(this)}if(isFunction(e))try{e.call(this)}catch(r){t=r instanceof UnsubscriptionError?flattenUnsubscriptionErrors(r.errors):[r]}if(isArray(o)){i=-1;for(var s=o.length;++i<s;){var u=o[i];if(isObject(u))try{u.unsubscribe()}catch(r){t=t||[],r instanceof UnsubscriptionError?t=t.concat(flattenUnsubscriptionErrors(r.errors)):t.push(r)}}}if(t)throw new UnsubscriptionError(t)}},r.prototype.add=function(t){var n=t;if(!t)return r.EMPTY;switch(typeof t){case"function":n=new r(t);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof r)){var e=n;(n=new r)._subscriptions=[e]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var o=n._parentOrParents;if(null===o)n._parentOrParents=this;else if(o instanceof r){if(o===this)return n;n._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return n;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n},r.prototype.remove=function(r){var t=this._subscriptions;if(t){var n=t.indexOf(r);-1!==n&&t.splice(n,1)}},r.EMPTY=function(r){return r.closed=!0,r}(new r),r}();function flattenUnsubscriptionErrors(r){return r.reduce((function(r,t){return r.concat(t instanceof UnsubscriptionError?t.errors:t)}),[])}var rxSubscriber=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),Subscriber=function(r){function t(n,e,o){var i=r.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=empty;break;case 1:if(!n){i.destination=empty;break}if("object"==typeof n){n instanceof t?(i.syncErrorThrowable=n.syncErrorThrowable,i.destination=n,n.add(i)):(i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,n));break}default:i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,n,e,o)}return i}return __extends(t,r),t.prototype[rxSubscriber]=function(){return this},t.create=function(r,n,e){var o=new t(r,n,e);return o.syncErrorThrowable=!1,o},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this))},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){this.destination.error(r),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var r=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=r,this},t}(Subscription),SafeSubscriber=function(r){function t(t,n,e,o){var i,s=r.call(this)||this;s._parentSubscriber=t;var u=s;return isFunction(n)?i=n:n&&(i=n.next,e=n.error,o=n.complete,n!==empty&&(isFunction((u=Object.create(n)).unsubscribe)&&s.add(u.unsubscribe.bind(u)),u.unsubscribe=s.unsubscribe.bind(s))),s._context=u,s._next=i,s._error=e,s._complete=o,s}return __extends(t,r),t.prototype.next=function(r){if(!this.isStopped&&this._next){var t=this._parentSubscriber;config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,r)&&this.unsubscribe():this.__tryOrUnsub(this._next,r)}},t.prototype.error=function(r){if(!this.isStopped){var t=this._parentSubscriber,n=config.useDeprecatedSynchronousErrorHandling;if(this._error)n&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,r),this.unsubscribe()):(this.__tryOrUnsub(this._error,r),this.unsubscribe());else if(t.syncErrorThrowable)n?(t.syncErrorValue=r,t.syncErrorThrown=!0):hostReportError(r),this.unsubscribe();else{if(this.unsubscribe(),n)throw r;hostReportError(r)}}},t.prototype.complete=function(){var r=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var n=function(){return r._complete.call(r._context)};config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(r,t){try{r.call(this._context,t)}catch(r){if(this.unsubscribe(),config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)}},t.prototype.__tryOrSetError=function(r,t,n){if(!config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,n)}catch(t){return config.useDeprecatedSynchronousErrorHandling?(r.syncErrorValue=t,r.syncErrorThrown=!0,!0):(hostReportError(t),!0)}return!1},t.prototype._unsubscribe=function(){var r=this._parentSubscriber;this._context=null,this._parentSubscriber=null,r.unsubscribe()},t}(Subscriber);function canReportError(r){for(;r;){var t=r,n=t.closed,e=t.destination,o=t.isStopped;if(n||o)return!1;r=e&&e instanceof Subscriber?e:null}return!0}function toSubscriber(r,t,n){if(r){if(r instanceof Subscriber)return r;if(r[rxSubscriber])return r[rxSubscriber]()}return r||t||n?new Subscriber(r,t,n):new Subscriber(empty)}var observable=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function noop(){}function pipeFromArray(r){return r?1===r.length?r[0]:function(t){return r.reduce((function(r,t){return t(r)}),t)}:noop}var Observable=function(){function r(r){this._isScalar=!1,r&&(this._subscribe=r)}return r.prototype.lift=function(t){var n=new r;return n.source=this,n.operator=t,n},r.prototype.subscribe=function(r,t,n){var e=this.operator,o=toSubscriber(r,t,n);if(e?o.add(e.call(o,this.source)):o.add(this.source||config.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),config.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},r.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){config.useDeprecatedSynchronousErrorHandling&&(r.syncErrorThrown=!0,r.syncErrorValue=t),canReportError(r)?r.error(t):console.warn(t)}},r.prototype.forEach=function(r,t){var n=this;return new(t=getPromiseCtor(t))((function(t,e){var o;o=n.subscribe((function(t){try{r(t)}catch(r){e(r),o&&o.unsubscribe()}}),e,t)}))},r.prototype._subscribe=function(r){var t=this.source;return t&&t.subscribe(r)},r.prototype[observable]=function(){return this},r.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return 0===r.length?this:pipeFromArray(r)(this)},r.prototype.toPromise=function(r){var t=this;return new(r=getPromiseCtor(r))((function(r,n){var e;t.subscribe((function(r){return e=r}),(function(r){return n(r)}),(function(){return r(e)}))}))},r.create=function(t){return new r(t)},r}();function getPromiseCtor(r){if(r||(r=Promise),!r)throw new Error("no Promise impl found");return r}var EMPTY=new Observable((function(r){return r.complete()}));function empty$1(r){return r?emptyScheduled(r):EMPTY}function emptyScheduled(r){return new Observable((function(t){return r.schedule((function(){return t.complete()}))}))}var ArgumentOutOfRangeErrorImpl=function(){function r(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return r.prototype=Object.create(Error.prototype),r}(),ArgumentOutOfRangeError=ArgumentOutOfRangeErrorImpl;function map(r,t){return function(n){if("function"!=typeof r)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new MapOperator(r,t))}}var MapOperator=function(){function r(r,t){this.project=r,this.thisArg=t}return r.prototype.call=function(r,t){return t.subscribe(new MapSubscriber(r,this.project,this.thisArg))},r}(),MapSubscriber=function(r){function t(t,n,e){var o=r.call(this,t)||this;return o.project=n,o.count=0,o.thisArg=e||o,o}return __extends(t,r),t.prototype._next=function(r){var t;try{t=this.project.call(this.thisArg,r,this.count++)}catch(r){return void this.destination.error(r)}this.destination.next(t)},t}(Subscriber);function readStdin(){var r=readline.createInterface(process.stdin);return new Observable((function(t){return r.on("line",(function(r){return t.next(r)})),function(){return r.close()}}))}function take(r){return function(t){return 0===r?empty$1():t.lift(new TakeOperator(r))}}var TakeOperator=function(){function r(r){if(this.total=r,this.total<0)throw new ArgumentOutOfRangeError}return r.prototype.call=function(r,t){return t.subscribe(new TakeSubscriber(r,this.total))},r}(),TakeSubscriber=function(r){function t(t,n){var e=r.call(this,t)||this;return e.total=n,e.count=0,e}return __extends(t,r),t.prototype._next=function(r){var t=this.total,n=++this.count;n<=t&&(this.destination.next(r),n===t&&(this.destination.complete(),this.unsubscribe()))},t}(Subscriber);function skip(r){return function(t){return t.lift(new SkipOperator(r))}}var SkipOperator=function(){function r(r){this.total=r}return r.prototype.call=function(r,t){return t.subscribe(new SkipSubscriber(r,this.total))},r}(),SkipSubscriber=function(r){function t(t,n){var e=r.call(this,t)||this;return e.total=n,e.count=0,e}return __extends(t,r),t.prototype._next=function(r){++this.count>this.total&&this.destination.next(r)},t}(Subscriber);readStdin().pipe(skip(1),take(1),map((function(r){return r.split(" ").map((function(r){return+r}))}))).subscribe((function(r){for(var t=0,n=0,e=0,o=[],i=0;i<r.length;i++)if(0===r[i]){for(var s=0===i?"any":r[i-1]%2==0?"even":"odd",u=i;i<r.length&&0===r[i];)i++;var c=--i===r.length-1?"any":r[i+1]%2==0?"even":"odd",a=i-u+1;o.push({left:s,right:c,distance:a})}else r[i]%2==0?n++:t++,i>0&&r[i-1]>0&&r[i-1]%2!=r[i]%2&&(e+=1);var p=Math.round(r.length/2),h=Math.floor(r.length/2),b=p-t,f=h-n,l=function(r,t){"any"===r?e+=1===t?0:1:"even"===r?f>=t?f-=t:e+=1:b>=t?b-=t:e+=1},d=function(r){var t=r.left,n=r.right,e=r.distance;return"any"===t||"any"===n?e+1e4:e};o.sort((function(r,t){return d(r)-d(t)})).forEach((function(r){var t=r.left,n=r.right,o=r.distance;"even"===t&&"odd"===n||"odd"===t&&"even"===n?e+=1:"any"===t?l(n,o):"any"===n?l(t,o):"even"===t?f>=o?f-=o:e+=2:"odd"===t&&(b>=o?b-=o:e+=2)})),console.log(e)}));


const input = [];

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

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

function fact(num)
{
    if(num === 0)
        return 1;
    return num * fact(num-1);
}

RL.on('close', () => {
   let str = input[0];
   let countQ = 0, countA = 0, answer = 0, rightQ = 0;;
   for (let i = 0; i < str.length; i += 1){
        if(str.charAt(i) === 'Q')
            countQ+=1;
        else if(str.charAt(i) === 'A')
        {
            for(let j = i; j < str.length; j += 1)
                if(str.charAt(j) === 'Q') rightQ += 1;
            answer += rightQ*countQ;
            rightQ = 0;
        }
   }
   global.console.log(answer);
});


const readline = require("readline")

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

let pointToCompare;
let dot_prob;

rl.on("line", (input) => {
    if (!pointToCompare) {
        let temparr = input.split(" ").map(Number)
        if (temparr[0] > temparr[1])
            pointToCompare = temparr[0]
        else pointToCompare = temparr[1]
    }
    if (pointToCompare) {
        dot_prob = (6 - pointToCompare + 1)

        let gcdd = gcd(dot_prob, 6)
        console.log(dot_prob / gcdd +"/"+ 6/gcdd)
        rl.close();
    }
})

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

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


let inputString = '';
let currentLine = 0;

const runMain = () => {
  inputString = inputString.trim().split('\n').map(string => string.trim());
  main();
  process.exit();
}
const readLine = () => inputString[currentLine++];

process.stdin.on('data', inputStdin => inputString += inputStdin);
process.stdin.on('end', runMain);
process.on('SIGINT', runMain);

function main() {
  let n = Number(readLine());

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


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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

const main=()=>{
	let first = readLine()
	let second = readLine()

	second = [...second].reverse().join('')
	if(first===second)
		console.log('YES')
	else console.log('NO')
}


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

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
	var s = next();
	var sf = 0;
	var fs = 0;
	for(var i = 0; i < N - 1; i++){
		if(s[i] == "F" && s[i + 1] == "S"){
			fs++;
		}
		if(s[i] == "S" && s[i + 1] == "F"){
			sf++;
		}
	}
	if(sf > fs){
		myout("YES");
	}else{
		myout("NO");
	}
}


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

rl.on('line', (d) => {
  if (+d % 2 === 0) {
    console.log('Mahmoud');
  }
  else {
    console.log('Ehab');
  }
});


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

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

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

  sell = Math.max(...d.split(' ').map(Number));

  if (buy >= sell) {
    console.log(r);
  }
  else {
    let count = 0;

    while (r - buy >= 0) {
      count++;
      r -= buy;
    }

    let ans = count * sell + r;

    console.log(ans);
  }

  c++;
});


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

readline.on("line", line => {
    let counter = 1;
    let result = "NO";
    let input = line;
    for (let i = 0; i < input.length; i++) {
        if (input[i] === input[i + 1]) {
            counter++;
        } else if (input[i] !== input[i + 1]) {
            counter = 1;
        }

        if (counter === 7) {
            result = 'YES';
            break;
        } else {
            result = 'NO';
        }
    }
    console.log(result);
});


function main() {
    // write code here:
    const n = Number(stdin[0]);
    var str = stdin[1];
    var reg = /x{3,}/g;
    if (reg.test(str)) {
        var arr = str.match(reg);
        var count = 0;
        for (let i = 0; i < arr.length; i++) {
            count += arr[i].lastIndexOf('x') - 1;
        }
        console.log(count);
    } else {
        console.log(0);
    }

}

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


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

let standardInputString = '';
let currentLine = 0;

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

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

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

function main() {
    console.log((Array.from(readLine().split("+").join("")).sort()).join("+"));
}


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

let input = [];
let result = "";

rl.on('line', function (line) {
    input = line.split(' ').map((el) => parseInt(el));
    if(input[0] === 2){
    	result = "No";
    }
    else if(input[0] % 2 === 0){
    	result = "Yes";
    }
    else{
    	result = "No";
    }
    rl.close();
  })
  .on('close', function () {
    console.log(result);
    process.exit();
  });


var readline = require('readline');

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

var input = [];

rl.on('line', function (line) {
  input.push(line);
  // console.log("You've entered:", line);
});

rl.on('close', function () {
  var [n, m, a] = input[0].split(' ').map(Number);
  // console.log(n, m, a);
  var result = Math.ceil(n/a) * Math.ceil(m/a);
  console.log(result);
});


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

intInput.on('line', (line) => {
	num = Number(line)
});

intInput.on('close', () => {
	//1, 5, 10, 20, 100
	let result = 0;
	let val = [100, 20, 10, 5, 1];
	for (let i = 0; i < val.length; i++){
		let c = num / val[i];
		if (c >= 1) {
			result += parseInt(c);
			num = num % val[i]
		}
		continue
	}
	console.log(result);
})


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

const readline = require("readline");

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

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

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

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

        gramOccurrences[twogram] = occurrences;
    }

    return mostCommonGram;
}


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

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var K = one[1];
  var list = nextIntArray();
  var min = list[K - 1];
  var output = 0;
  for(var i = 0; i < N; i++){
    if(list[i] > 0 && list[i] >= min){
      output++;
    }
  }
  myout(output);
}


const readline = require('readline');

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

rl.on('line', (input) => {
    var ans = "";
    var N = input.length;
    var meet = false;
    for (let i = 0; i < N - 1; i++) {
        if (input[i] == '/' && input[i + 1] != '/')
            ans += "/";

        else if (input[i] != "/") {
            ans += input[i];
            meet = true;
        }
    }
    if (input[N - 1] != '/' || !meet)
        ans += input[N - 1];

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


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

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

function main() {
  const n = +readLine();
  let result = "";
  let fact = 1n;
  for (let i = 2; i <= n - 1; i++) {
    fact *= BigInt(i);
  }
  const ans = fact / BigInt(Math.floor(n / 2));
  result += ans;
  console.log(result);
}


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(20).fill(1);
        col = new Array(20).fill(1);
        return;
    }

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

    count++;
});

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

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

    for (let i = 0; i < r; i++) {
        for (let j = 0; j < c; 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 solve = (w) => {
    if (w == 2) return false;
    if (w % 2 != 0) return false;
    return true;
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    rl.on('line', (line) => {
        let res = solve(Number(line)) ? 'YES' : 'NO';
        console.log(res);
    });
};

main()


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

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var s = next().split("W");
  var output = [];
  for(var i = 0; i < s.length; i++){
    if(s[i] != ""){
      output.push(s[i].length);
    }
  }
  myout(output.length);
  myout(myconv(output, 8));
}


let input = [];

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

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

RL.on('close', () => {
    let {0:n, 1:c} = {...input[0].split(' ')};
    n = parseInt(n); c = parseInt(c);
    let points = []; input[1].split(' ').forEach( i => points.push(parseInt(i)) );
    let times = []; input[2].split(' ').forEach( i => times.push(parseInt(i)) );
    let secondTimes = []; times.forEach(i => secondTimes.push(parseInt(i)));

    let firstPlayer = 0; let secondPlayer = 0;
    let j = n-1;

    for(let i = 0; i < n; i++) {
        firstPlayer += max(0, points[i] - c*times[i]);
        secondPlayer +=  max(0, points[j] - c*secondTimes[j]);

        if(i + 1 != n) {
            times[i+1] += times[i];
        }
        if(j - 1 >= 0) {
            secondTimes[j-1] += secondTimes[j];
        }
        j--;
        //console.log(`fp = ${firstPlayer}; sp = ${secondPlayer}`);
    }

    if(firstPlayer > secondPlayer) {
        console.log('Limak');
    } else if(secondPlayer > firstPlayer) {
        console.log('Radewoosh');
    } else
        console.log('Tie')
});

function max(a, b) {
    return (a > b) ? a : b;
}


'use stric'
const readline = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
})
readline.question("", ans => {
    var problem = ans.split("+");
    console.log(problem.sort(function(a, b){return a - b}).join("+").trim());
    readline.close();
})


"use strict";
const input = [];
const RL = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
});
RL.on('line', line => {
  input.push(line.trim());
});
RL.on('close', () => {
  const answer = input[0]
    .split("+")
    .sort((a, b) => {
      if(a < b) {
        return -1;
      }
      if(a > b) {
        return 1;
      }
      return 0;
    })
    .join("+");

  console.log(`${answer}`);
});


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

function divideEvenly(w){
    if (w < 3 || w > 100) return console.log('NO');
    if (w % 2 === 0 ){ return console.log('YES')}
    else{ return console.log('NO');}
}


const readLine = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});
const input = [];
readLine.on('line', line => input.push(line));

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

  if (num % 7 === 0 || num % 4 === 0 || num % 47 === 0 || num % 74 === 0 || num % 44 === 0 || num % 77 === 0
      || num % 477 === 0 || num % 774 == 0)
    console.log(`YES`);
  else
    console.log('NO');
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

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

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

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

    for (let test = 0; test < N; test++) {*/
        let [r, c] = readline().split(' ');
        r = BigInt(r);
        c = BigInt(c);
        if (c == BigInt(1)) {
            output(r - BigInt(1));
        } else {
            output((c - BigInt(1)) * r);
        }
    /*}*/
}


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 x = readLine() >> 0;
	let bec = x
		.toString(2)
		.split('')
		.reduce((a, c) => a + (c >> 0), 0);
	console.log(bec);
}


function solve(a, b) {
    let year = 0;
    while(a <= b) {
        year += 1;
        a *= 3;
        b *= 2;
    }
    return year;
}

let line = '';

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

process.stdin.on('end', () => {
    const [a, b] = line.split(' ').map(v => Number.parseInt(v));
    console.log(solve(a, b));
});


//HQ9+

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

let inp = '';

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

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

    for(let i in lines)  {
    	if('HQ9'.indexOf(lines[i]) != -1)  {
    		process.stdout.write("YES");
    		return;
    	}
    }

    process.stdout.write("NO");
    return;
});


const readline = require('readline');

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

rl.on('line', (input) => {
    let line = input.split(' ');
    let y = parseInt(line[0]);
    let w = parseInt(line[1]);
    let max = y > w ? y : w;
    rl.close();
    let n = 6 - max + 1;
    let d = 6;
    let ans = solve(n, d);
    console.log(`${ans[0]}/${ans[1]}`)

});

const getLCD = (x, y) => {
    let min = x < y ? x : y;
    for (let i = min; i > 0; i--) {
        if (x % i === 0 && y % i === 0) return i;
    }
    return 1;
}
const solve = (n, d) => {
    let lcd = getLCD(n, d);
    return [n / lcd, d / lcd];
}


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

let input = [];
rl.on("line", function (line) {
  input.push(line);
}).on("close", function () {
  solution(input);
  process.exit();
});

function solution(input) {
  let [N, X] = input[0].split(" ");
  N = Number(N);
  X = BigInt(X);
  const dist = new Map();
  dist.set(X, 0);
  queue = [X];
  while (queue.length > 0) {
    const val = queue.shift();
    const str = String(val);
    let splited = new Set(str.split(""));

    if (str.length === N) {
      console.log(dist.get(val));
      return;
    }

    splited.delete("0");
    if (splited.has(1) && splited.size === 1) {
      break;
    }
    splited.delete("1");

    for (const s of splited) {
      const nextVal = val * BigInt(s);
      if (!dist.has(nextVal)) {
        dist.set(nextVal, dist.get(val) + 1);
        queue.push(nextVal);
      }
    }
  }
  console.log(-1);
}


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


let _inputLines;
let _lineNumber = 0;
let inputReader = _inputReader ();

function _main() {

	_inputLines = _inputData.trim().split('\n').map((string) => {
		return string.trim();
	});;
	var t = inputReader.readNumber();
	function print(x) { console.log(x); }
	while (t--) {
	    var n = inputReader.readNumber();
	    var cnt = 0;
	    var f = 0;
	    for (var i = 1; i <= 9; ++i) {
	        for (var j = i, time = 1; j < 10000+1; j = j * 10 + i, ++time) {
	            cnt += time;
	            if (j == n) {
	                f = 1;
	                break;
	            }
	        }
	        if (f) break;
	    }
	    print(cnt);
	}

}

var _inputData = '';
function cacheInput(data) {
	_inputData += data;
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', cacheInput).on('end', _main);

function _inputReader () {
	function readNumber(){
		return Number(_inputLines[_lineNumber++]);
	}

	return {
		readNumber,
	}
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    let n = readLine()
        .split(' ')
        .map(v => parseInt(v))
        .sort((x, y) => {
            return y - x;
        });

    let a = n[0];
    let b = n[1];
    if (a == b) {
        console.log(a, 0);
    } else {
        console.log(b, Math.floor((a - b) / 2));
    }
}


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

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var k = one[0];
  var n = one[1];
  var w = one[2];
  var sum = 0;
  for(var i = 0; i < w; i++){
    sum += (i + 1) * k;
  }
  myout(Math.max(0, sum - n));
}


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  var T = 5;
  var arr = [];
  var ans = 0;
  while (T--) {
    var row = readLine().split(" ").map(Number);
    arr.push(row);
  }
  for (let row = 0; row < 5; row++) {
    for (let col = 0; col < 5; col++) {
      if (arr[row][col] === 1) {
        ans = Math.abs(2 - row) + Math.abs(2 - col);
      }
    }
  }
  console.log(ans);
}


"use strict";

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

let inputString = "";
let currentLine = 0;

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

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

  main();
});

function readline() {
  return inputString[currentLine++];
}
// 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;
  k=+k;
  r=+r;

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

  return n;
}


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

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

let nl = nextLine();

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

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

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

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

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

const sol = () => {
	let s = nl.line();
	let flag = s.split('1').every(x => x.length < 3 && (x.length == 0 || x == '4' || x == '44'));
	flag = flag && s.charAt(0) !== '4';
	console.log(flag?'YES':'NO');

};

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


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

  readline.question("", (_input) => {
      const input = _input.split(' ').map(Number);
              digiGame(input[0], input[1], input[2]);
  });

  const digiGame = (a, b, r) => {
      if (2 * r <= a && 2 * r <= b) {
          console.log('First');
      } else {
        console.log('Second');
      }
  };


let fs = require('fs');

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

function doit(x, y) {
    let player = 1;
    let grid = new Array(y).fill(0);
    grid.forEach((data, index) => {
        grid[index] = new Array(x).fill(true);
    });
    while (true) {
        let test = true;
        for (let i1 = 0; i1 < y; i1++) {
            for (let i = 0; i < x; i++) {
                if (grid[i1][i] === true) {
                    grid[i1][i] = false;
                    test = false;
                    player *= -1;
                    for (let i3 = 0; i3 < x; i3++) {
                        grid[i1][i3] = false;
                    }
                    for (let i4 = 0; i4 < y; i4++) {
                        grid[i4][i] = false;
                    }
                    break;
                }
            }
            if (!test) break;

        }

        if (test) break;
    }
    if (player == 1) {
        console.log("Malvika");
    } else {
        console.log("Akshat");
    }

}


const readline = require('readline');

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

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


var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    console.log(findn(d.toString().trim()));
  });

function findn(str){
    const v = ['a','e','i','o','u'];
    let total = 0;
    for(i of str){
        const int = parseInt(i);
        if(v.includes(i) || (int && int % 2 === 1)){
            total++;
        }
    }

    return total;
}


/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "./sources/hackerrank/algorithms/practice/strings/highest-value-palindrome-copy/index.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./helpers/input-manager.js":
/*!**********************************!*\
  !*** ./helpers/input-manager.js ***!
  \**********************************/
/*! exports provided: InputManager */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InputManager", function() { return InputManager; });
const fs = __webpack_require__(/*! fs */ "fs");

class InputManager {
    static getInput() {
        return new Promise((resolve) => {
            let input = '';

            if (fs.existsSync('./input.txt')) {
                input = fs.readFileSync('./input.txt').toString();
                resolve(this.parseInputString(input));
            } else {
                process.stdin.resume();
                process.stdin.setEncoding('utf-8');
                process.stdin.on('data', inputStdin => {
                    input += inputStdin;
                });

                process.stdin.on('end', () => {
                    resolve(this.parseInputString(input));
                });
            }
        });
    }

    static parseInputString(input) {
        return input.replace(/\s*$/, '')
            .split('\n')
            .map(str => str.replace(/\s*$/, ''));
    }
}

/***/ }),

/***/ "./helpers/solution-manager.js":
/*!*************************************!*\
  !*** ./helpers/solution-manager.js ***!
  \*************************************/
/*! exports provided: SolutionManager */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SolutionManager", function() { return SolutionManager; });
class SolutionManager {
    static printSolution(solutionFn) {
        let result = solutionFn();
        if (typeof result !== 'undefined') {
            if (Array.isArray(result)) {
                result.forEach(v => console.log(v));
            } else {
                console.log(result);
            }
        }
    }
}

/***/ }),

/***/ "./sources/hackerrank/algorithms/practice/strings/highest-value-palindrome-copy/index.js":
/*!***********************************************************************************************!*\
  !*** ./sources/hackerrank/algorithms/practice/strings/highest-value-palindrome-copy/index.js ***!
  \***********************************************************************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _helpers_solution_manager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../../../helpers/solution-manager */ "./helpers/solution-manager.js");
/* harmony import */ var _helpers_input_manager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../../../helpers/input-manager */ "./helpers/input-manager.js");

_helpers_input_manager__WEBPACK_IMPORTED_MODULE_1__["InputManager"].getInput().then((input) => _helpers_solution_manager__WEBPACK_IMPORTED_MODULE_0__["SolutionManager"].printSolution(() => {
    let [n, a, b] = input.shift().split(' ').map(v => Number(v));
    let suits = input.shift().split(' ').map(v => Number(v));
    let costs = [a, b];
    let totalCost = 0;
    let i = 0;

    for (i = 0; i < Math.floor(n / 2); i++) {
        let mirrorIndex = n - 1 - i;

        if (suits[i] !== suits[mirrorIndex]) {
            if (suits[mirrorIndex] !== 2 && suits[i] !== 2) {
                return -1;
            }

            let colorIndex = suits[mirrorIndex] === 2 ? mirrorIndex : i;
            totalCost += costs[mirrorIndex === colorIndex ? suits[i] : suits[mirrorIndex]];
        } else if (suits[mirrorIndex] === 2 && suits[i] === 2) {
            totalCost += Math.min(a, b) * 2;
        }
    }

    if (suits[i] === 2 && n % 2 !== 0) {
        totalCost += Math.min(a, b);
    }

    return totalCost;
}));

/***/ }),

/***/ "fs":
/*!*********************!*\
  !*** external "fs" ***!
  \*********************/
/*! no static exports found */
/***/ (function(module, exports) {

module.exports = require("fs");

/***/ })

/******/ });
//# sourceMappingURL=index.built.js.map


const readline = require('readline');

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

let arr = [4, 7]
for (let i = 0; i < 6; i++) {
    arr.push(arr[i] * 10 + 4)
    arr.push(arr[i] * 10 + 7)
}
let result, n
rl.on('line', (input) => {
  n = input
  for (let i = 0; i < arr.length; i++) {
      if (+n % arr[i] == 0) {
          result = 'YES'
          break
      } else {
        result = 'NO'
      }
  }
  console.log(result)
  rl.close();
});


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

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

const store = {};

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

	if (m > b) {
		console.log(b + 1);
	} else {
		console.log(m);
	}
}


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 str = readLine();
  str = str.toLowerCase();
  const vowels = ["a", "o", "y", "e", "u", "i"];

  const arr = str.split("").filter((char) => !vowels.includes(char));
  console.log(`.${arr.join(".")}`);
}


/**
 * @author 'Sunwarul Islam'
 * Full Stack JavaScript Developer
 */
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStd => {
    inputString += inputStd;
});
process.stdin.on('end', () => {
    inputString = inputString.trim().split('\n').map(str => {
        return str.trim();
    });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    const line = readLine();
    let [n, k] = line.trim().split(' ').map(Number);
    for (let i = 0; i < k; i++) {
        if ((n % 10) === 0) {
            n = parseInt(n / 10);
        } else {
            n = n - 1;
        }
    }
    console.log(n);
}


let i = ''

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

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

    let citiesCount = parseInt(lines[0].split(" ")[0])
    let limakCity = parseInt(lines[0].split(" ")[1])

    let criminals = lines[1].split(" ").map( value => {
        return parseInt(value)
    })

    let distanceCount = 0
    let caughtCriminalsCount = 0
    let passedCities = {}

    let limakCityIndex = limakCity - 1

    for(i = 0; i < citiesCount ; i++){

        distanceCount = Math.abs(i - limakCityIndex)

        let leftCityIndex =  limakCityIndex - distanceCount
        let rightCityIndex = distanceCount + limakCityIndex

        if (passedCities[rightCityIndex] === true || passedCities[leftCityIndex] === true) {
            continue
        }

        if (distanceCount === 0) {
            caughtCriminalsCount = caughtCriminalsCount + criminals[i]
            passedCities[i] = true
            distanceCount++
            continue
        }

        let rightCriminalCount = 0
        let leftCriminalCount = 0

        if (leftCityIndex >= 0) {
            passedCities[leftCityIndex] = true
            leftCriminalCount = criminals[leftCityIndex]
        } else {
            leftCriminalCount = -1
        }

        if (rightCityIndex < citiesCount) {
            passedCities[rightCityIndex] = true
            rightCriminalCount = criminals[rightCityIndex]
        } else {
            rightCriminalCount = -1
        }

        if (rightCriminalCount + leftCriminalCount === 2) {
            caughtCriminalsCount = caughtCriminalsCount + 2
        } else if (rightCriminalCount === 1 && leftCriminalCount === -1) {
            caughtCriminalsCount = caughtCriminalsCount + 1
        } else if (leftCriminalCount === 1 && rightCriminalCount === -1){
            caughtCriminalsCount = caughtCriminalsCount + 1
        }

        distanceCount++
    }
    console.log(caughtCriminalsCount)
})


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

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

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

  seq = d.split(' ').map(Number);
  const obj = {};

  for (let i = 0; i < seq.length; i++) {
    obj[seq[i]] = true;
  }

  const ans = [];

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

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

  c++;
});

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

});


const readline = require('readline');

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

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

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

rl.on('line', (input) => {
    var n = parseInt(input);
    var ans = 0;

    for (let i = 2; i < n; i++)
        ans += sumInBase(n, i);

    let temp = GCD(ans, n - 2);
    console.log("%d/%d", ans / temp, (n - 2) / temp);
    rl.close();
});


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

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

  const arr = d.split(' ').map(Number);
  let ans = 0;
  let L = 0;
  let R = arr.length - 1;

  while (L <= R) {
    if (arr[L] <= k) {
      ans++;
      L++;
    }
    else if (arr[R] <= k) {
      ans++;
      R--;
    }
    else {
      break;
    }
  }

  console.log(ans);

  c++;
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    let a1 = readLine();
    let a2 = readLine();
    let ans = '';
    for (var i = 0; i < a1.length; i++) {
        if (parseInt(a1[i]) + parseInt(a2[i]) == 1) {
            ans += 1;
        } else ans += 0;
    }
    console.log(ans);
}


/* Common Template Starts */
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++];
}
/* Common Template Ends */

function main() {
    //take input according to the format;
    const n = +(readline());
    for(let i =0; i<n; ++i){
        let number = +(readline());
        squareAndCubes(number);
    }
}

const squareAndCubes = (num)=>{
    let sqN =Math.floor( Math.sqrt(num) );

    let set= new Set();
    for(let i =1; i <=sqN; ++i){
        set.add(i*i);
        if(i*i*i <=num)
            set.add(i*i*i);
    }
    console.log(set.size);
}


const f = (n, s) => {
    const k = 2;

    const result = new Map();
    let best = null;
    let preBest = null;

    const compare = (sub) => {
        result[sub] = result[sub] ? result[sub] + 1 : 1;
        if (!best) {
            best = sub;
        } else if (result[sub] > result[best]) {
            preBest = best;
            best = sub;
        }
    };

    for (let i = 0; i < n - 1; i += 1) {
        if (result[best] > n / 2) {  return best; }
        if (preBest) {
            const leftSteps = n - 1 - i;
            const bestLeadSteps = result[best] - result[preBest];
            if (leftSteps < bestLeadSteps) { return best; }
        }

        compare(s.slice(i, i + k));
    }

    return best;
};

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


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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

const main=()=>{
	let n=+readLine()
	let stones = readLine()
	let minStones=0

	for(let i=0;i<stones.length-1;i++){
		if(stones[i]==stones[i+1])
			minStones++;
	}

	console.log(minStones)
}


let input = [];

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

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

RL.on('close', () => {
    let hand = input[0];
    input[1].split(' ').forEach(i => {
        if(i[0] === hand[0] || i[1] == hand[1])
        {
            console.log('YES'); process.exit();
        }
    });
    console.log('NO');
});


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  const target = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  if (target === 0) {
    console.log(0);
    return;
  }
  arr.sort((a, b) => b - a);
  let [count, sum, found] = [0, 0, false];

  for (let i = 0; i < arr.length; i++) {
    sum += arr[i];
    count++;
    if (sum >= target) {
      found = true;
      break;
    }
  }

  if (found) console.log(count);
  else console.log(-1);
}


// Little Pigs and Wolves - https://codeforces.com/problemset/problem/116/B

const main = async () => {
  const arr = [];
  let len = [];

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

  let m, n;
  let i = 1;

  for await (const line of rl) {
    if (!len.length) {
      len = line.split(" ").map(Number);
      n = len[0];
      m = len[1];
      arr[n + 1] = [];
      arr[0] = [];
      for (let x = 0; x < m + 2; x++) {
        arr[0].push(".");
        arr[n + 1].push(".");
      }
    } else {
      if (i < n) {
        arr[i] = ["."];
        arr[i].push(...line.split(""));
        arr[i].push(".");
      } else {
        arr[i] = ["."];
        arr[i].push(...line.split(""));
        arr[i].push(".");
        rl.close();
      }
      i++;
    }
  }
  runGame(arr, m, n);
};

const runGame = (arr, m, n) => {
  let output = 0;

  for (let i = 1; i < n + 1; i++) {
    for (let j = 1; j < m + 1; j++) {
      if (arr[i][j] == "W") {
        if (
          arr[i - 1][j] == "P" ||
          arr[i + 1][j] == "P" ||
          arr[i][j - 1] == "P" ||
          arr[i][j + 1] == "P"
        ) {
          output++;
        }
      }
    }
  }
  console.log(output);
};

main();


const fs = require("fs");

const [sectionCountMax, nutCount, divisorCount, sectionCapacity] = fs.readFileSync(0).toString().trim().split(" ").map(x => Number(x));
const divisorCountMax = sectionCountMax - 1;
let used = Math.floor(divisorCount / divisorCountMax);
const dividedCapacity = sectionCountMax * sectionCapacity;
let remaining = nutCount - used * dividedCapacity;
if (remaining <= 0) process.stdout.write(Math.ceil(nutCount / dividedCapacity) + "\n");
else {
  remaining -= (divisorCount - used++ * divisorCountMax + 1) * sectionCapacity;
  if (remaining > 0) used += Math.ceil(remaining / sectionCapacity);
  process.stdout.write(used + "\n");
}
process.exit();


const transformString = (newString, char) => newString += `.${char}`;

process.stdin.once('data', (input) => {
    let withOutVowels = input.toString().trim().toLowerCase().replace(/[aeiouy]/gi, '');
    let newString = Array.from( withOutVowels ).reduce( transformString, '' );
    console.log(newString);
    process.exit();
});


const stdin = process.openStdin();

process.stdin.on('data', function (chunk) {
  lines = chunk.toString().split('\n');
  lines = lines.map(a => a.trim());

  let before;
  let count = 0;
  for (let i = 0; i < lines[0].length; i += 1) {
    if (lines[0].charAt(i) === before) {
      count += 1;
      if (count === 7) {
        console.log('YES');
        return;
      }
    } else {
      count = 1;
    }
    before = lines[0].charAt(i);
  }
  console.log('NO');
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

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

function main() {
  // input
  const a = readline();
  let l = 0;
  let result = a.toUpperCase();
  for (let i = 0; i < a.length; i++) {
    const c = a.charAt(i);
    if (c === c.toLowerCase()) {
      l++
    }
    if (l >= Math.ceil((a.length) / 2)) {
      result = a.toLowerCase();
      break;
    }
  }
  // output
  print(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.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
function main() {
    let w = readline();
    let result ="";
    const vow = ["a", "e", "i", "o", "u", "y"];
    for(const letter of w){
        const lowerTerm = letter.toLowerCase();
        if(vow.indexOf(lowerTerm) == -1){
            result += `.${lowerTerm}`;
        }
    }
    console.log(result);
}


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 s = readLine();
    if (s.includes('0000000') || s.includes('1111111')) {
        console.log('YES');
    } else {
        console.log('NO');
    }
}


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

rl.on('line', (d) => {
  const y = Number(d);
  let i = y;

  while (true) {
    i++;

    if (new Set(String(i)).size === 4) {
      console.log(i);
      break;
    }
  }
});


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 string = readLine();
    let stringArray = string.split('');
    let finalArray = [];
    for (let i = 0; i < stringArray.length; i++) {
        if (finalArray.indexOf(stringArray[i]) === -1) {
            finalArray.push(stringArray[i]);
        }
    }

    if (finalArray.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;
let n, d;

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

  const arr = data.split('').map(Number);
  let ans = 0;
  let best = 0;
  let inc = 1;

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

    if (inc === d || i + 1 === arr.length) {
      if (best === 0) {
        ans = -1;
        break;
      }
      else {
        ans++;
        i = best;
        best = 0;
        inc = 0;
      }
    }

    inc++;
  }

  console.log(ans);

  c++;
});


const readline = require('readline');

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

rl.on('line', line => {
    input.push(line.trim());
}).on('close', () => {
    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);
});


let inputString = '';
let currentLine = 0;

const runMain = () => {
  inputString = inputString.trim().split('\n').map(string => string.trim());
  main();
  process.exit();
}
const readLine = () => inputString[currentLine++];

process.stdin.on('data', inputStdin => inputString += inputStdin);
process.stdin.on('end', runMain);
process.on('SIGINT', runMain);

function main() {
  const str = readLine();
  const m = {};
  let c = 0;
  for (let i = 0; i < str.length; i++) {
    if (!m[str[i]]) {
      m[str[i]] = 1;
      c++;
    }
  }
  console.log(c % 2 === 0 ? 'CHAT WITH HER!' : 'IGNORE HIM!');
}


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

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var output = 1;
  for(var i = 1; i < N; i++){
    output += i * 4;
  }
  myout(output);
}


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

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

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

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


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

process.stdin.on('data', (s) => {
  console.log(+s % 9 === 0 ? 9 : +s % 9)
})


var readline = require("readline");
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
rl.on("line", function(line){
    i = line.length;
    for(var j = 0; j < line.length; j++){
        for(var c = j +1 ; c < line.length; c++) {
            if (line.charAt(j) == line.charAt(c)){
                i--;
                break;
            }
        }
    }

    if (i % 2 == 0 ){
        console.log("CHAT WITH HER!");
    }else {
        console.log("IGNORE HIM!");
    }
    process.exit(0);
});


// http://codeforces.com/problemset/problem/977/A
module.exports = solve;
function solve(line) {
    let [a, b] = line.split(' ').map(n => parseInt(n, 10));
    return ~~(a * b / 2);
}

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

let i = 1;
rl.on('line', (line) => {
    if (i++) {
        console.log(solve(line))
        rl.close();
    }
});


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

rl.on('line', (line) => {
    console.log(solution(line));
});

function solution(input) {
    let luckyDigits = 0;
    for (let i = 0 ; i < input.length; i++) {
        if (input[i] === '4' || input[i] === '7') {
            luckyDigits++;
        }
    }

    if (luckyDigits === 4 || luckyDigits === 7) {
        return 'YES';
    }
    return 'NO';
}


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

rl.on('line', (d) => {
  if (+d % 2 === 0) {
    console.log(0);
  }
  else {
    console.log(1);
  }

  c++;
});


const lines = [];

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

// multi line input
readline.on('line', line => {
  lines.push(line);
});

readline.on('close', line => {

  /**
   * 1
   */

  let name = lines[0];

  recognizeHim(name);

});

function recognizeHim(name) {

  let exist = {};
  let distinct = 0;

  for (let ii = 0; ii < name.length; ii++) {
    if (!exist[name[ii]]) {
      exist[name[ii]] = 1;
      distinct++
    }
  }

  if (distinct % 2 == 0)
    return console.log("CHAT WITH HER!")
  else
    return console.log("IGNORE HIM!")
}


function main() {
    // write code here:
    var m=Number(stdin[0]);
    for(var i=m;;i++){
        //别忘记 parseInt(cur) ，否则只会像连接字符串一样
        var n=i.toString().split('').reduce((acc,cur) => acc+parseInt(cur),0);
        if(n%4===0){
            //只需要满足和取余4为零即可
            console.log(i);
            break;
        }
    }
}

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


'use-strict'

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

let data = '';
let currentLine = 0;

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

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

    let testCases = parseInt(data.shift());

    var mod = BigInt(1e9 + 7);

    while(testCases--) {

        const [nn, kk ] = get_ints();

        const n = BigInt(nn);
        const k = BigInt(kk);

        let ans = BigInt(1);
        for(let i = 0;  i < k; i++){
            ans = (ans * n) % mod;
        }
        console.log(parseInt(ans));
    }
});

function get_ints() {
    return data.shift().split(' ').map(Number);
}

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


const processData = (lines) => {
  const k = lines[1].split(' ').map(x => +x)
  const l = lines[2].split(' ').map(x => +x)
  let diff = [0, 0]
  for (let i =0; i<k.length; i++) {
    if (k[i] !== l[i]) {
      if (k[i] === 1) {
        diff[0]++
      }
      if (l[i] === 1) {
        diff[1]++
      }
    }
  }
  if (diff[0] === 0) {
    console.log(-1)
  } else {
    let rest = Math.ceil(diff[1]/diff[0])
    if (diff[1]%diff[0] === 0) {
      rest++
    }
    console.log(rest)
  }
}

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*/
  processData(lines)
})


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

  for (let i = 0, j = 0; i < str.length; i++) {
    const [char, targetChar] = [str[i], target[j]];
    if (char === targetChar) {
      count++;
      j++;
    }

    if (count === 5) {
      console.log("YES");
      return;
    }
  }
  console.log("NO");
}


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

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

readLine.on('close', () => {
let check = 'NO'
let SF = input[1].match(/(SF)/g)
SF = SF ? SF.length : 0
let FS = input[1].match(/(FS)/g)
FS = FS ? FS.length : 0
if (SF > FS)
  check = 'YES'
console.log(check)
})


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
  const x = readline();
  // process.stdout.write('hello')
  console.log(x % 2 == 0 && x > 3 ? 'YES' : 'NO');
}


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let t = +readLine();
  while (t--) {
    const num = +readLine();
    let found = false;
    if (num % 2 === 0) {
      console.log(`${num / 2} ${num / 2}`);
      continue;
    } else {
      for (let i = 2; i * i <= num; i++) {
        if (num % i === 0) {
          let [a, b] = [num / i, num - num / i];
          console.log(`${a} ${b}`);
          found = true;
          break;
        }
      }
    }
    !found && console.log(`${1} ${num - 1}`);
  }
}


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

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

readLine.on('close', () => {
  let [m, s] = input[0].split(' ').map(x => parseInt(x));
  if (s === 0 || m*9 < s) {
    if (m === 1 && s === 0)
      console.log(`0 0`);
    else
      console.log(`-1 -1`);
  } else {
    let bigAnswer = [];
    let smallAnswer = [1];
    let smallSumm = s - 1;

    if (s <= 9 && m === 1) {
      console.log(`${s} ${s}`); return;
    }

    if (s <= 9) {
      bigAnswer.push(s);
      bigAnswer = bigAnswer.concat(Array(m-1).fill(0));
    } else {
      while (s !== 0) {
        if (s - 9 < 0) {
          bigAnswer.push(s); break;
        }

        bigAnswer.push(9);
        s -= 9;
      }
      bigAnswer = bigAnswer.concat(Array(m - bigAnswer.length).fill(0));
    }

    let smallTmpNums = [];
    while (smallSumm !== 0) {
      if (smallSumm - 9 < 0) {
        smallTmpNums.push(smallSumm); break;
      }

      smallTmpNums.push(9);
      smallSumm -= 9;
    }

    if (smallTmpNums.length + 1 < m) {
      smallAnswer = smallAnswer.concat(Array( m - (smallTmpNums.length + 1) ).fill(0)).concat(smallTmpNums.reverse());
    } else {
      smallAnswer = smallAnswer.concat(smallTmpNums.reverse());
    }
    if (smallAnswer.length > bigAnswer.length) {
      smallAnswer = [...bigAnswer].reverse();
    }

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


const readline = require('readline');

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

rl.question('', (answer) => {
    const argumentArray = answer.split(' ');
    let bearWeight = parseInt(argumentArray[0]);
    let brotherWeight = parseInt(argumentArray[1]);
    let year = 0;

    while(brotherWeight >= bearWeight) {
        bearWeight *= 3;
        brotherWeight *= 2;
        year++;
    }

    console.log(year);

    rl.close();
});


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

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

function main() {
  const n = +readLine();
  let count = 0;

  for (let i = n; i >= 1; i--) {
    let [left, right] = [1, i - 1];
    const target = i * i;
    while (left < right) {
      const sum = left * left + right * right;
      if (sum === target) {
        count++;
        left++;
        right--;
      } else if (sum < target) left++;
      else right--;
    }
  }
  console.log(count);
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main(){
  var n = parseInt(readLine());
  var res = "NO";
  if(n%2 ==0){
  for(var i=1;i<n;i++){
    if(i%2 ==0){
      if((n-i)%2 ==0){
        res="YES";
      }
    }
  }
}
console.log(res);

}


let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const r = +i;
    const names = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"];
    let pos = 1, doubles = 1;
    while ('Doubling...') {
        for (let i = 0; i < names.length; i++) {
            if (r >= pos && r < pos + doubles) {
                console.log(names[i]);
                process.exit();
            }
            pos += doubles;
        }
        doubles <<= 1;
    }
});


//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 a = nextInt();
	var b = nextInt();
	var diff = Math.abs(a - b);
	if(diff % 2 == 0){
		diff /= 2;
		myout(diff * (diff + 1));
	}else{
		var tmp = diff - 1;
		tmp /= 2;
		myout((tmp * (tmp + 1)) + (tmp + 1));
	}
}


//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 list = new Array(5);
  for(var i = 0; i < 5; i++){
    list[i] = nextStrArray();
    if(list[i].indexOf("1") != -1){
      myout(Math.abs(list[i].indexOf("1") + 1 - 3) + Math.abs(3 - (i + 1)));
      return;
    }
  }

}


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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
function main() {
var num = readline().split(" ").map(x => parseInt(x)); // num will be an array [1,2,3]
var x= num[0]; // to store values in different variables.
var y= num[1];
var z= num[2];
console.log(Math.floor((x+z-1)/z)*Math.floor((y+z-1)/z));
}


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

let standardInputString = ''
let currentLine = 0

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

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

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

    main()
})
function main() {
    let matrix = []
    for (let i = 0; i < 5; i++) {
        matrix[i] = readLine().split(' ').map(Number)
    }

    let res = 0
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            if (i === 0 && j === 0) {
                if (matrix[i][j] === 1) {
                    res = 4
                } else {
                    res = 0
                }
            } else if (matrix[i][j] === 1) {
                res = Math.abs(i - 2) + Math.abs(j - 2)
            }
        }
    }
    console.log(res)
}


function processData(input) {
    //Enter your code here
     let  res=input.split("\n"),   [n,k]=res[0].split(" ").map(Number),
      arr=res[1].split(" ").filter((x)=>x!=="").map(Number);
  while(arr.length>0){
    if(arr[0]<=k){
      arr.shift()
    }else if(arr[arr.length-1]<=k){
      arr.pop()
    }else{
      break;
    }
  }
  console.log(n-arr.length)
}

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

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


'use strict';

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

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readLine() {
    return inputString[currentLine++];
}
function main() {
    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(" "));

}


const readline = require('readline')

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

rl.on("line", main)
let n = 0
let s = ""
let count = 0
function main(input){
	if(n === 0){
		n = parseInt(input)
		return
	}

	s = input

	for(var j = 0; j < s.length; j++){

		/*if(s.charAt(j) === s.charAt(j+1)){
			if(s.charAt(j) === s.charAt(j+2) && s.charAt(j) !== s.charAt(j+3)){
				count++
				j = j + 3
			}
		}*/
		if(s.charAt(j) === s.charAt(j+1)){
			count++
		}
	}
	console.log(count)
}


// Sample code to perform I/O:

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

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

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

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

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

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

    let inputs = str.trim().split(' ');
    let k = +inputs[0];
    let r = +inputs[1];
    let shovelBought = 0;
    for (var i = 1; i <= 10; i++) {
        let shPrice = k * i;
        if (shPrice % 10 == 0 || shPrice % 10 == r) {
            break;
        }
    }
    return i.toString();

}


const readline = require("readline")

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

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

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

    }
})


const readline = require('readline');

let inputs = [];

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

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

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

    let arr = [];
    let bestPosition = [2, 2];

    for (let i = 0; i < inputs.length; i++) {
        const subArr = inputs[i].split(' ');
        arr.push(subArr);
    }

    // Get The position of 1
    let currentPositon = [];
    for (let i = 0; i < arr.length; i++) {

        for (let j = 0; j < arr[i].length; j++) {
            if (arr[i][j] == 1)
                currentPositon.push(i, j);
        }
    }

    // Get the max number that needs minimum steps

    const rowSteps = currentPositon[0] - bestPosition[0];
    const colSteps = currentPositon[1] - bestPosition[1];
    const minimumSteps = Math.abs(colSteps) + Math.abs(rowSteps);

    console.log(minimumSteps);

})


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

// End of interface

const solution = function(a, b){
  for (i = 1; i < 10; i++){
    a = a * 3;
    b = b * 2;
    if (a > b){
      return i;
    }
  }
};