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


function main() {
    let t = readLine()
    let str = readLine()
    let count = 0

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

    console.log(count)

}


const readline = require('readline');

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

var inp = [];

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


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 n = readLine();
  const str1 = readLine();
  let pred = '';
  let str2 = '';
  for (let i = 0; i < n; i++) {
    if (str1[i] !== pred) {
      str2 += str1[i];
      pred = str1[i];
      console.log('aa');
    }
  }
  console.log(str1.length - str2.length);
}


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


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

let stdin = '';

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

process.stdin.on('end', () => {
  const stdin = '5\nBRBG';
  const data = stdin.split('\n')[1];

  let counter = 0;

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

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

});


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

rl.on('line', (d) => {
  const obj = {
    0: 0,
    1: 4,
    2: 4,
    3: 4,
    4: 4,
    5: 4,
    6: 4,
    7: 4,
    8: 4,
    9: 4,
    10: 15
  };

  const r = +d - 10;
  console.log(obj[r] || 0);
});


let data = '';
process.stdin.on('data', c => data += c);
const sol = () => {
    let n = Number(data);
    let ans = 0; //[0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, 4];
    if (n - 10 < 0 || n - 10 > 11) {
        ans = 0;
    } else if (n - 10 === 10){
        ans = 15
    } else {
        ans = 4;
    }
    console.log(ans);
}

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


process.stdin.on('data', function(chunk){
	var lns = chunk.toString().replace(/\r/g, "").split(/\n/);
	var hs = [], gs = [], r = 0;
	for(var i = 0, l = lns.splice(0, 1)[0]; i<l; i ++) {
		ln = lns[i].split(' ');
		if (hs.indexOf(ln[1]) > -1) {
			r++;
		}
		if (gs.indexOf(ln[0]) > -1) {
			r++;
		}
		hs.push(ln[0]);
		gs.push(ln[1]);
	}
	console.log(r);
});


//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 s = next();
  var ok = new Set(["a","e","i","o","u","0","2","4","6","8"]);
  var count = 0;
  for(var i = 0; i < s.length; i++){
    if(ok.has(s[i])){
      count++;
    }
  }
  myout(count);
}


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', () => {
    const check = new Set(); check.add('a'); check.add('e');
    check.add('i'); check.add('o'); check.add('u');
    const str = input[0];
    let answer = 0;
    for(let i = 0; i < str.length; i += 1) {

        if(check.has(str.charAt(i))) {
            answer += 1;
        }
    }
    console.log(answer);
});


'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 numOfInterestingMinutes = readline();
  const interestingMinutes = readline();

  countNumberOfMinutes(
    parseInt(numOfInterestingMinutes),
    interestingMinutes.split(' ')
  );
}

function countNumberOfMinutes(numOfInterestingMinutes, interestingMinutes) {
  const firstInterestingMinute = parseInt(interestingMinutes[0])
  if (firstInterestingMinute >= 16) {
    console.log(15);
    return;
  }

  if (numOfInterestingMinutes === 1) {
    console.log(firstInterestingMinute + 15);
    return;
  }

  let watchMinutes = firstInterestingMinute;

  for (let i = 1; i < numOfInterestingMinutes; i++) {
    const diff =
      parseInt(interestingMinutes[i]) - parseInt(interestingMinutes[i - 1]);
    if (diff >= 16) {
      watchMinutes += 15;
      break;
    } else {
      watchMinutes += diff;
    }
  }

  console.log(watchMinutes >= 90 ? 90 : watchMinutes);
}


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

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

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

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

      if (i !== arr.length - 1) {
        watchedTime += 15;
      }
    }
  }

  console.log(watchedTime);

  c++;
});


"use strict";

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

let inputString = "";
let currentLine = 0;

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

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

  main();
});

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

function main() {

  const x = readline()
    .split(" ")
    .map((x) => +x);

  carrotCakes(x[0],x[1],x[2],x[3]);
}

function carrotCakes(n, t, k, d) {
  let t1 = (n * t) / k;

  let t2 = t1 / 2 + d - Math.abs(t - d);

  //   let k1 = Math.floor(d * k) / t;

  let k1 = (d * k) / t;

  //   let t2 = ((n - k1) * t) / (2 * k) + d;

  //   let t2 = d < t ? ((n - k1) * t) / (2 * k) + d : t1 / 2 + d;
  // console.log(t1, t1);

  console.log(t2 < t1 ? "YES" : "NO");
}


 let t1 = (n * t) / k;

  let tt1 = 0;
  let cakesBox2 = 0;
  let ovenTimer11 = 0;

  while (cakesBox2 < n) {
    if (ovenTimer11 === t - 1) {
      ovenTimer11 = 0;
      cakesBox2 += k;
    } else {
      ovenTimer11++;
    }

    tt1++;
  }

  // let t2 = t1 / 2 + d - Math.abs(t - d);

  //   let k1 = Math.floor(d * k) / t;

  // let k1 = (d * k) / t;

  //   let t2 = ((n - k1) * t) / (2 * k) + d;

  //   let t2 = d < t ? ((n - k1) * t) / (2 * k) + d : t1 / 2 + d;
  // console.log(t1, t1);

  let t2 = 0;
  let cakesBox = 0;
  let ovenTimer1 = 0;
  let ovenTimer2 = 0;

  while (cakesBox < n) {
    if (ovenTimer1 === t - 1) {
      ovenTimer1 = 0;
      cakesBox += k;
    } else {
      ovenTimer1++;
    }

    if (t2 >= d) {
      if (ovenTimer2 === t - 1) {
        ovenTimer2 = 0;
        cakesBox += k;
      } else {
        ovenTimer2++;
      }
    }
    t2++;
  }

  console.log(t2 < tt1 ? "YES" : "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 readint() {
    let line = readline().split(' ').map(function(num) {
        return parseInt(num);
    });
    return line;
}

function readfloat() {
    let line = readline().split(' ').map(function(num) {
        return parseFloat(num);
    });
    return line;
}

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

function write(x) {
    process.stdout.write(x);
}
function main() {
    let [n,t,k,d] = readint();
    let times = d / t + 1;
    let qoldi = n  - times * k;
    if(qoldi > 0) {
        print('YES');
    } else {
        print("NO");
    }

}


process.stdin.setEncoding('utf8');

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

    input = input.split('+');
    input = input.sort((a, b) => a - b);

    console.log(input.join('+'));
    process.exit(1);
});


const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
function sort(array) {
    // use custom compare function that sorts numbers ascending
    alert(ary.sort(function(a, b) {
        return a - b;
    }));
}

var array =[];
var newarr = [];
rl.question(``, (count) => {
    var a = '';
    for (let index = 0; index < count.length; index++) {
       if(count[index]!='+'){
          a =a+count[index];
       }else{
           array.push(a);
           a='';
       }
       if(count.length-index == 1){
        array.push(a);
       }

    }
   array = array.sort(function(a, b) {
    return a - b;
  });
  console.log(array);
 insert_a(array);
  console.log(newarr);
    rl.close();
  })

function  insert_a(array) {
    var count=0;
     for (let index = 0; index <array.length*2-1 ; index++) {
         if(index%2==0){
             newarr.push(array[count]);
             count++;

         }
         else{
            newarr.push('+')

         }

  }
}


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

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

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

process.stdin.on('end', function () {
  // * CONVERTING THAT INPUT INTO AN ARRAY
  arr = arr.split('\n');

  let string = arr[0];

  if (!string.includes('+')) {
    console.log(string);
    return;
  }

  string = string.split('+').sort((a, b) => a - b);

  string = string.map((num, i) => {
    if (i < string.length - 1) {
      return num.concat('+');
    }
  });

  console.log(string);
});


function helpfulMaths(str) {
  let arr = str.split("+");
  arr.sort(function (a, b) {
    return a - b;
  });
  return console.log(arr.join("+"));
}

// read file
const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let input = "";
// read each line
rl.on("line", (lineInput) => {
  input = lineInput;
});

// when all file readed
rl.on("close", () => {
  bautifulMartix(input);
});


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 => str.trim());
    solve();
});
let readLine = () => inputString[currentLine++];

function solve(){
    const n = +(readLine());
    let str = readLine();
    let arr = [], arr2 = [];

    for(let i = 0; i < 2*n; i++){
        if(i < n)
            arr.push(+(str[i]));
        else
            arr2.push(+(str[i]));
    }
    arr.sort((a, b) => a-b);
    arr2.sort((a, b) => a-b);
    let a = true, b = true;

    for(let i = 0; i < n; i++){
        if(arr[i] < arr2[i])
            a = false;
        if(arr[i] > arr2[i])
            b = false;
    }
    console.log(a ^ b ? "YES" : "NO");
}


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

let l = 0;
rl.on('line', (input) => {
    rl.close();
    let inp = input.split("")
    let res = ""
    if (inp.length >= 2 && inp.length % 2 === 1) {
        res += inp[Math.floor((inp.length / 2))]
    } else if (inp.length >= 2 && inp.length % 2 === 0) {
        res += inp[Math.floor((inp.length / 2) - 1)]
    }
    let ln = inp.length % 2 === 1 ? inp.length / 2 : inp.length / 2
    ln = Math.floor(ln)
    let inc = inp.length % 2 === 1 ? 0 : 1
    for (let i = 1; i < ln; i++) {
        res += inp[ln + i - inc]
        res += inp[ln - i - inc]
    }
    res += inp[inp.length - 1]
    if (inp.length % 2 == 1) {
        res += inp[0]
    }
    console.log(res)
    return 0;
});


process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}
function main() {
    let n = parseInt(readLine());
    let pagesInWeekDays = readLine().split(' ').map(Number);
    // while (result < 100) {
    //     result = result +
    // }
    function recursion(totalpagesPerWeak) {
        // console.log(totalpagesPerWeak);
        // let [
        //     monday,
        //     tuseday,
        //     wednessday,
        //     thursday,
        //     friday,
        //     saturday,
        //     sunday,
        // ] = pagesInWeekDays;

        for (let i = 0; i < pagesInWeekDays.length; i++) {
            totalpagesPerWeak = totalpagesPerWeak + pagesInWeekDays[i];
            if (totalpagesPerWeak >= n) {
                console.log(totalpagesPerWeak);
                console.log(i + 1);
                return;
            }
        }
        if (!(totalpagesPerWeak >= n)) {
            console.log(n);
            console.log(totalpagesPerWeak);
            totalpagesPerWeak = n - totalpagesPerWeak;
            recursion(totalpagesPerWeak);
        }
    }
    recursion(0);
}


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

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


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

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

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

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

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

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

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

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

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

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

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

  print(s-n)
}


const readline = require('readline')

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

rl.on("line", main)
let s = ""
function main(input){
	let arr = input.split(' ')

	let k = arr[0]
	let n = arr[1]
	let w = arr[2]

	let c = 0
	for(var i = 0; i < w; i++){
		if( i == 0 ){
			n = n - k
			continue
		}

		n = n - ((i+1)*k)
	}

	console.log(Math.abs(n))
}


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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

const main=()=>{
	let [k,n,w]=readLine().split(" ").map(n=>+n)
	let price=0
	for(let i=1;i<=w;i++)
		price+=(i*k)

	price<0 ? console.log(0) : console.log(price-n)
}


const readline = require('readline');

const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout
})
let n
let c = 0
rl.prompt()
rl.on('line', (cmd) => {
	c++
	//if (c == 1) n = cmd
	if (c == 1) {
		process.stdout.write(test(cmd.split(" ")))
		rl.close()
	}
})
function test(list) {
	let cost = 0
	for (let i = 1; i <= list[2]; i++) {
		cost += i * list[0]
	}
	return cost - list[1] > 0 ? String(cost - list[1]) : "0"
}


const readline = require('readline');

const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout
})
let n
let c = 0
rl.prompt()
rl.on('line', (cmd) => {
	c++
	//if (c == 1) n = cmd
	if (c == 1) {
		process.stdout.write(test(cmd.split(" ")))
		rl.close()
	}
})
function test(list) {
	console.log(list)
	let cost = 0
	for (let i = 1; i <= list[2]; i++) {
		cost += i * list[0]
	}
	return cost - list[1] > 0 ? cost - list[1] : 0
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

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

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

function main() {
  let [k,n,w] = readAsIntList();
  let total = 0;
  for(let i = 1; i <= w; i++) {
    total += k * i;
  }
  console.log(total - n);
}


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

let currentLine = 0;
let inputString = "";

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

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

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

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

function main() {
  var [k, n, w] = readLine().split(" ").map(Number);

  var totalPrice = 0;

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


// 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 nNames = str.trim().split(' ');
    let sum = 0;
    for (let i = 1; i <= nNames[2]; i++) {
        sum = sum + (i * nNames[0]);
    }
    let borrowedMoney = sum - parseInt(nNames[1]);
    if (borrowedMoney == 0) {
        borrowedMoney = 0;
    }
    return borrowedMoney.toString();
}


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


'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() {
    const arr = readLine().split(' ');
    const k = Number(arr[0]);
    const n = Number(arr[1]);
    const w = Number(arr[2]);
    var total = 0;
    for (var i = 1; i <= w; i++) {
        total += (i * k);
    }
    console.log(k, n, w, total);
    if (total <= n) {
        console.log(0);
    } else {
        console.log(total - 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 = readLine();
  var Tarr = T.split(" ");
  var t1 = parseInt(Tarr[0]);
  var t2 = parseInt(Tarr[1]);
  var count = 0;
  var scores = readLine();
  var scoresArr = scores.split(" ");
  scoresArr = scoresArr.map(Number);
  var passScore = scoresArr[t2 - 1];
  for (let i = 0; i < t1; i++) {
    if (scoresArr[i] >= passScore && passScore != 0) {
      count++;
    }
  }
  console.log(count);
}


let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  let nums = lines[1].split(' ');
  nums = nums.map(num => parseInt(num, 10));
  const k = lines[0].split(' ')[1];
  console.log(minOperations(nums, parseInt(k, 10)));
});

function minOperations(nums, k) {
  nums = nums.sort((a, b) => a - b);

  let totalMin = Number.MAX_VALUE;
  for (let i = -1; i <= nums.length - k; i++) {
    if (i > 0 && nums[i] === nums[i - 1]) continue;

    let index;
    let numToMake;

    if (i === -1) {
      index = 0;
      numToMake = 1;
    } else {
      index = i;
      numToMake = nums[index];
    }

    let operations = 0;
    let matches = 0;
    while (index < nums.length) {
      let currNumber = nums[index];
      let currOperations = 0;
      while (currNumber > numToMake) {
        currNumber = Math.floor(currNumber / 2);
        currOperations++;
      }
      if (currNumber === numToMake) {
        matches++;
        operations += currOperations;
      }

      if (matches === k) {
        totalMin = Math.min(operations, totalMin);
        break;
      }
      index++;
    }
  }
  return totalMin;
}


let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL) ;/*your input text, split by lines*/
    const k = lines[0];
    const arr = lines.slice(1, lines.length).filter(l => l).map(l => parseInt(l));

    if (arr.reduce((a, v) => a + v, 0) === 360) {
    	console.log("YES");
    	return;
    }

   	function subseqs(arr, k) {
			const n = arr.length;
			const res = [];
			let j = 0;

			for (let mask = 0; mask < (1 << n); mask++) {
				let num = 0;

				for (let i = 0; i < n; i++) {
					if (mask & (1 << i)) {
						num++;
					}
				}

				if (num === k) {
					res[j] = [0, 0];

					for (let i = 0; i < n; i++) {
						if (mask & (1 << i)) {
							res[j][0] = (res[j][0] + arr[i]) % 360;
						} else {
							res[j][1] = (res[j][1] + arr[i]) % 360;
						}
					}

					j++;
				}
			}

			return res;
		}

	for (let i = 1; i < arr.length / 2 + 1; i++) {
		for (const ss of subseqs(arr, i)) {
			if (ss[0] === ss[1]) {
				console.log("YES");
				return;
			}
		}
	}

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


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

    console.log(arr);

   	function subseqs(arr, k) {
	  const n = arr.length;
	  const res = [];
	  let j = 0;

	  for (let mask = 0; mask < (1 << n); mask++) {
	    let num = 0;

	    for (let i = 0; i < n; i++) {
	      if (mask & (1 << i)) {
	        num++;
	      }
	    }

	    if (num === k) {
	      res[j] = [0, 0]

	      for (let i = 0; i < n; i++) {
	        if (mask & (1 << i)) {
	          res[j][0] += arr[i]
	        } else {
	          res[j][1] += arr[i];
	        }
	      }

	      j++;
	    }
	  }

	  return res;
	}

	for (let i = 1; i < arr.length; i++) {
	  subseqs(arr, i).map(ss => console.log(ss[0] == ss[1] ? "YES" : "NO"));
	}
});


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

const lines = [];

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

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

      return acc - angle;
    }, 0);

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

  return 'NO';
};

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

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


const n = process.argv[2];
let k = parseInt(process.argv[3]);
let x = `${n}`.split('');
console.log(n, k);
for (let i=0;i<k;i++){
  if (!x.length) return console.log(0);
  if (x[x.length-1] == 0) {
    x.pop();
  } else {
    x[x.length-1] -= 1;
  }
}
console.log(parseInt(x.join('')));


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

// thats all what you have to write to get input from stdin, using readLine.

// Main code runs in main();

function main() {
const num = readline().split(" ").map(x => parseInt(x))
let k = parseInt(num[1]);
let x = `${num[0]}`.split('');
console.log(n, k);
for (let i=0;i<k;i++){
  if (!x.length) return console.log(0);
  if (x[x.length-1] == 0) {
    x.pop();
  } else {
    x[x.length-1] -= 1;
  }
}
console.log(parseInt(x.join('')));
}


const main = (n, k) => {
  res = n;
  const getLastDigit = (d) => {
   last = d%10;
   return +last;
  };

  for (i = 0; i < k; i++){
    let lastDigit = getLastDigit(res);
  //if the last digit of the number is non-zero, she decreases the number by one;
  // the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).
    if (lastDigit !== 0) {
      res--;
    } else {
      res = res/10;
    }
  }
  return res;
};


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

var solution = function(str) {
  var line = str.split(' ');
  var n = parseInt(line[0]);
  var k = parseInt(line[1]);

  var main = function(n, k){
    res = n;
    var getLastDigit = function(d){
      last = d%10;
      return +last;
    };

    for (i = 0; i < k; i++){
      var lastDigit = getLastDigit(res);
      //if the last digit of the number is non-zero, she decreases the number by one;
      // the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).
      if (lastDigit !== 0) {
        res--;
      } else {
        res = res/10;
      }
    }
    return res;
  };

  var result = main(n, k);
  console.log(result);
  return result;

};


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

function solution(str) {
  let line = str[0].split(' ');
  var n = parseInt(line[0]);
  var k = parseInt(line[1]);

  var main = function(n, k){
    res = n;
    var getLastDigit = function(d){
      last = d%10;
      return +last;
    };

    for (i = 0; i < k; i++){
      var lastDigit = getLastDigit(res);
      //if the last digit of the number is non-zero, she decreases the number by one;
      // the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).
      if (lastDigit !== 0) {
        res--;
      } else {
        res = res/10;
      }
    }
    return res;
  }

  var result = main(n, k);
  console.log(result);
  return result;
}


const {EOL} = require('os')

let input = ''
process.stdin.on('data', s => input += s)
process.stdin.on('end', () => {
    let [number, times] = input.split(" ").forEach(element => parseInt(element));
    for(let i = 0; i < times; i++) {
        number = number % 10 == 0 ? number / 10 : number - 1;
    }
    console.log(number);
})


const {EOL} = require('os')

let input = ''
process.stdin.on('data', s => input += s)
process.stdin.on('end', () => {
    console.log(1);
})


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

readline.question(`Input your numbers: `, (numbers) => {
  [num1, num2] = numbers.split(' ');
  let result = wrongSubstraction(num1, num2);
  console.log(result);
  readline.close()
})

let wrongSubstraction = (num1, num2) => {
  // revisar en python si vale comprar dos numeros
  if (num1 <= 0 || num2 <= 0) return;

  for(let i = 0; i < num2; i++){
    if(num1%10==0){
      num1 /= 10;
    } else {
      num1 -= 1;
    }
    // console.log(num1);
  }

  return num1;
};


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

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

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

const main = ([inputString]) => {
  const [n, k] = inputString.split(' ');
  let ans = n;
  for (let i = 0; i < k; i += 1) {
    const str = String(ans);
    const endingDigit = str[str.length - 1];
    if (endingDigit === 0) {
      ans = ans / 10;
    } else {
      ans -= 1;
    }
  }
  return String(ans);
};


function Tanya(input) {
	let num = input[0];
	let k = input[1];
	for (let i = 0; i < k; i++) {
		let numToStr = num.toString();
		if (numToStr[numToStr.length - 1] == 0) {
			numToStr = numToStr.slice(0, numToStr.length - 1);
			num = Number(numToStr);
		} else {
			num = num - 1
		}
	}
	return num
}
console.log(Tanya([1000000000, 9]))


let num = input[0];
let k = input[1];
for (let i = 0; i < k; i++) {
	let numToStr = num.toString();
	if (numToStr[numToStr.length - 1] == 0) {
		numToStr = numToStr.slice(0, numToStr.length - 1);
		num = Number(numToStr);
	} else {
		num = num - 1
	}
}
console.log(num)


[n, k] = readline().split(' ').map(n => parseInt(n));

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

print(n);


function main(input) {
    //Enter your code here
    let [target, counter] = input.split(' ');
    for(let i = 0; i <4;  i++ ) {
        if(target % 10 === 0) {
            target /= 10;
        } else {
            target -= 1;
        }
    }
    console.log(target);
}

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

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

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


const readline = require('readline')

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

async function getN() {
	let str = 'enter n'
	return new Promise((res,rej)=>{
		rl
		.question(str,ans=>res(ans))
	})
}

async function getK() {
	let str = 'enter k'
	return new Promise((res,rej)=>{
		rl
		.question(str,ans=>res(ans))
	})
}

function subtraction(n,k){

	if(k == 0)return n

	let resedue = n%10

	if( resedue > 0 ){
		--n
		--k
		return subtraction(n,k)
	}
	else{
		--k
		return subtraction(n/10,k)
	}

}
async function main() {
	let n = await getN()
	let k = await getK()
	rl.close()

	console.log(`n:${n}, k:${k}`)
	console.log(subtraction(n,k))

}

main()


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


const readline = require("readline");

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
rl.question("", loop =>{
  getUserInput(loop);
})

function totalPressedDigit(number){
    let digit = number[0];
    let length = number.length;
    console.log( (digit-1) * 10 + length*(length+1)/2);
}

function getUserInput(n) {
    rl.question('', (number) => {
        totalPressedDigit(number)
        if (n > 1) {
            getUserInput(n-1);
        } else {
            rl.close();
        }
    });
}

rl.on("close", function() {
    console.log("\nBYE BYE !!!");
    process.exit(0);
});


'use strict';

const { reset } = require("nodemon");

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

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

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

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

function foo(n) {

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

        if (b) {

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

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

    let d = Array.from(result);

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

// console.log(foo(9999))


var readline = require('readline');
var rl = readline.createInterface(process.stdin, process.stdout);
rl.question('', (arg)=>{
	let sum = 0;
	if(arg>10){let a = arg - (arg%10) - 1;
			let b= arg - a;
			while(a!=0|| b!=0){
				sum = sum + a%10 +b%10;
				a= Math.floor(a/10);
				b= Math.floor(b/10);
			}
		}else{
			sum = arg;
		}
	console.log(sum);
	rl.close();
});


function countMarkers(w1, h1, w2, h2){
    let totalBoxes2 = ((w2+2) * (h2+1)) - (w2 * h2);
    let totalBoxes1 = ((w1+2) * (h1+1)) - (w1 * h1);
    let rightAllOff = w1 - w2;
    return totalBoxes1 + totalBoxes2 + rightAllOff;

}

function processData(input) {
    //Enter your code here
    // const readline = require('readline');
    var numbers = input.split(" ").map(function(x) { return +x; });

    console.log(countMarkers(numbers[0], numbers[1], numbers[2], numbers[3]))

}

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

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


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

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

readLine.on('close', () => {
  let [a, b] = input[0].split(' ').map(x => parseInt(x));
  let answ = a;

  let ost = a;
  while (ost > 0) {
    answ += parseInt(ost/b);
    ost = parseInt(ost/b);
  }

  console.log(answ);
});


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 [a, b] = readLine()
		.split(' ')
		.map(x => parseInt(x));
	let s = a;
	let hours = 0;

	while (Math.floor(a / b) !== 0) {
		hours += Math.floor(a / b);
		a = Math.floor(a / b);
	}

	console.log(s + hours);
}


    var n = readline();
    var a = readline().split(" ").map(x=> parseInt(x));
    a.sort((x,y) => x-y);

    let c = 0;
    for(let i=0;i<n;++i){
        if(a[i]){
            let tmp = a[i];
            for(let j=i;j<n;++j){
                if(a[j]%tmp==0)
                    a[j]=0;
            }
            c++;
        }
    }
    console.log(c);


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

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


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

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

readLine.on('close', () => {
   const banknotes = [1, 5, 10, 20, 100];

    let min = 0;

    for (let i = banknotes.length - 1; i >= 0; --i) {
      min += Math.floor(n / banknotes[i]);

      n -= Math.floor(n / banknotes[i]) * banknotes[i];
     }
    console.log( min);

});


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*/
    getMinNumber(lines[0])
})

function getMinNumber(input) {
    let avaialbleBankNotes = [1, 5, 10, 20, 100];
    let output = 0;
    let bankNotesCount = 0;
    let reaminingInput = input

    avaialbleBankNotes.reverse().forEach(element => {
        if (input === element) {
            // console.log('Input === Element');
            output = element;
            bankNotesCount = 1;
            return;
        }

        if (reaminingInput >= element) {
            do {
                output = output + element;
                reaminingInpu50t = reaminingInput - element;
                bankNotesCount = bankNotesCount + 1;

                // console.log("Bank Note used: " + element);
                // console.log("Remaining Amount:" + reaminingInput);
                // console.log("Current Output: " + output);
            } while(output + element <= input)
        }
    });
    // console.log('Final Output is: ' + output);
    console.log(bankNotesCount);
}


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

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


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

rl.on("line", (d) => {
  const [start, shop1, shop2] = d.split(" ").map(Number);

  console.log(
    Math.min(
      start * 2 + shop1 + shop2,
      start * 2 + shop1 * 2,
      start * 2 + shop2 * 2,
      shop1 * 2 + shop2 * 2,
      start + shop2 + shop2
    )
  );
});


const prompt = require('prompt');

prompt.start();

const arr = [];

prompt.get(['d1', 'd2', 'd3'], function (err, result) {
    if (err) { console.log(err); }
    arr.push(Number(result.d1), Number(result.d2), Number(result.d3))
    console.log(calculateMinDis(arr));
});

function calculateMinDis(a) {
    console.log(a)
    miniCor = a[0] + a[1]
    mid = a[2] > miniCor ? miniCor : a[2]
    firstSol = miniCor + mid
    secSol = 2*a[2] + 2*a[0]
    thirdSol = 2*a[2] + 2*a[1]
    return Math.min(firstSol, secSol, thirdSol)
}


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

rl.question("", function(input) {
    arrOfInp = input.split(' ')
    // rl.question("", function(d2) {
    //     rl.question("", function(d3) {
    //         console.log(calculateMinDis([Number(d1), Number(d2), Number(d3)]));

    //     });
    // });
    console.log(calculateMinDis([Number(arrOfInp[0]), Number(arrOfInp[1]), Number(arrOfInp[2])]));
    rl.close();
});

rl.on("close", function() {
    process.exit(0);
});

function calculateMinDis(a) {
    console.log(a)
    miniCor = a[0] + a[1]
    mid = a[2] > miniCor ? miniCor : a[2]
    firstSol = miniCor + mid
    secSol = 2*a[2] + 2*a[0]
    thirdSol = 2*a[2] + 2*a[1]
    return Math.min(firstSol, secSol, thirdSol)
}


const readline = require('readline')

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

rl.question('', ans => {
  rl.close()

  let n = Number(ans)

  function closest (n) {
    let closest = ''
    while (true) {
        if (n <= 9) {
			closest = n + closest
			break
        }

		closest = 9 + closest
        n = ~~((n - 9) / 10)
    }

    return Number(closest)
  }

  function nirvana (n) {
    const c = closest(n)
    const sC = String(c).split('')
    let grtst = Number(sC.reduce((i, acc = 1) => Number(i) * acc))

    for (let i = c + 1; i <= n; i++) {
    const sI = String(i).split('')
        let dMult = Number(sI.reduce((i, acc = 1) => i * acc))
        grtst = dMult > grtst ? dMult : grtst
    }

    return grtst
  }

  console.log(nirvana(n))
})


function distToCenter(lines) {
    for (var i = 0; i < lines.length; i++) {
        var j = lines[i].indexOf("1");
        if (j !== -1) {
            return Math.abs(j - 2) + Math.abs(i - 2);
        }
    }
}
function main(stdin) {
    console.log(distToCenter(stdin.split("\n")));
}
main(require("fs")
    .readFileSync(0, "utf-8")
    .trim());


const readline = require('readline');

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

let matrix = [], location = [];

rl.on('line', n => {
  matrix.push(n.split(' ').map(Number));
  if (matrix.length === 5) {
    for (let i = 0; i < matrix.length; i++) {
      if (matrix[i].includes(1)) {
        location.push(i, matrix[i].indexOf(1));
        break;
      }
    }

    const yShift = Math.abs(location[0] - 2);
    const xShift = Math.abs(location[1] - 2);
    console.log(Math.max(xShift, yShift));
    rl.close();
  }
});


// Generated by CoffeeScript 2.5.1
var find, lines, mainAux, print, readline, rl, rli, sum, write;

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

print = console.log;

write = function(...args) {
  return process.stdout.write(args.join(' '));
};

lines = [];

rl.on('line', function(line) {
  return lines.push(line);
});

rl.on('close', main);

rli = 0;

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

sum = function(items) {
  return items.reduce((function(a, b) {
    return a + b;
  }), 0);
};

find = function(input) {
  return [
    input.find((inp) => {
      return inp.includes('1');
    }).split(' ').findIndex((str) => {
      return str === '1';
    }),
    input.findIndex((inp) => {
      return inp.includes('1');
    })
  ];
};

mainAux = function() {
  var input;
  input = [];
  input.push(readline());
  input.push(readline());
  input.push(readline());
  input.push(readline());
  input.push(readline());
  return print(sum(find(input).map(function(v) {
    return Math.abs(3 - v);
  })));
};

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

//# sourceMappingURL=matrix.js.map


// Generated by CoffeeScript 2.5.1
var find, lines, mainAux, numMoves, print, readline, rl, rli, sum, write;

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

print = console.log;

write = function(...args) {
  return process.stdout.write(args.join(' '));
};

lines = [];

rl.on('line', function(line) {
  return lines.push(line);
});

rl.on('close', main);

rli = 0;

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

sum = function(items) {
  return items.reduce((function(a, b) {
    return a + b;
  }), 0);
};

find = function(input) {
  return [
    input.find((inp) => {
      return inp.includes('1');
    }).split(' ').findIndex((str) => {
      return str === '1';
    }),
    input.findIndex((inp) => {
      return inp.includes('1');
    })
  ];
};

numMoves = function(v) {
  return Math.abs(3 - v);
};

mainAux = function() {
  var input;
  input = [];
  input.push(readline());
  input.push(readline());
  input.push(readline());
  input.push(readline());
  input.push(readline());
  return print(sum(find(input).map(function(v) {
    return numMoves(v);
  })));
};

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

//# sourceMappingURL=matrix.js.map


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

    let row = line.split(' ').map(Number);
    if (!point) {
        for (let j = 0; j < row.length; j++) {
            if (row[j] === 1) {
                point = {i, j};
            }
        }
    }
    i++
    if (i === 5) {
        let moves = 0;
        if (point.i > 2) {
            moves += point.i - 2;
        } else if (point.i > 2) {
            moves += 2 - point.i;
        }
        if (point.j > 2) {
            moves += point.j - 2;
        } else if (point.j > 2) {
            moves += 2 - point.j;
        }
        console.log(moves);
    }
});


const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let matrix = [];
rl.on("line",(input)=>{
    let row = input.split(" ").map(Number)
    matrix.push(row)
    if(matrix[4]){
        rl.close();
        let perfectRow = 3;
        let perfectCol = 3;
        let steps = null ;
        let currentRow = null
        let currentCol = null
        matrix.forEach((row,index) => {
            if(row.includes(1)){
                currentRow = index+1;
                row.forEach((col,index)=>{
                    if(col==1) currentCol = index+1;
                })

            }
            if (currentRow!=perfectRow || currentCol!=perfectCol ) {
                steps = Math.abs(currentCol - perfectCol)+Math.abs(currentRow-perfectRow);
            }

        });
        console.log(steps)

    }
})


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();
  let count_4_7 = 0;

  str.split("").forEach((char) => {
    if (char === "4" || char === "7") count_4_7++;
  });

  if (count_4_7 === str.length || +str % 4 === 0 || +str % 7 === 0) {
    console.log("YES");
  } else {
    console.log("NO");
  }
}


const readline = require('readline');

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

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

function check(num) {

    if (num % 7 == 0 || num % 4 == 0)
        return console.log("YES")
    else {

        const nums = num.split('');

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

            if (nums[i] != 4 && nums[i] != 7)
                return console.log("NO")
        }

        return console.log("YES")

    }

}


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)
    console.log(`YES`);
  else
    console.log('NO');
});


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 number = Array.from(readLine());

    if((1*number.join("")) % 4 === 0 || (1*number.join(""))%7 === 0) {
        console.log('YES');
        return;
    }

    let match = number.filter(n => {
        if(n === '4' || n === '7') {
            return true;
        } else {
            return false;
        }
    })

    if(number.length === match.length) {
        console.log('YES');
    } else {
        console.log("NO");
    }
}


let fs = require("fs");

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

    doit(txt[index]*1);

}

function doit(num) {
    let tab = String(num).split("").filter(data => {
        if (data != 4 && data != 7) {
            return data;
        }
    }).length;
    if(tab==0){
        console.log("YES");
    }else if(num%4==0 || num%7==0){
        console.log("YES");
    }else{
        console.log("NO");
    }
}


const input = [];

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

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

function solver(n, m) {
  let first = 0, second = 0, copyN = n;
  let point = (m % 2 === 0) ? m : m + 1;

  while (copyN !== point/2) {
    if (copyN > point/2) {
      first += copyN - (point/2);
      copyN = point/2;
    }
    if (copyN < point/2) { copyN *= 2;  first += 1; }
  }
  first += (m % 2 === 0) ? 1 : 2;

  copyN = n;
  while (copyN !== m) {
    if (copyN < m) copyN *= 2;
    else {
      second += copyN - m;
      break;
    }
    second += 1;
  }

  return Math.min(first, second);
}

RL.on('close', () => {
  let [n, m] = input[0].split(' ').map(x => parseInt(x));
  if (n > m) {
    console.log(n - m); return;
  }
  let data = {};
  data[n] = n;

  let find = 0;
  while (true) {
    const map = {};
    for (const i of Object.keys(data)) {
      let x = parseInt(i)
      if (x - 1 >= (m/2) - 100 ) {
        map[x - 1] = x-1;
        if (x - 1 === m) {
          console.log(find+1); return;
        }
      }
      if (x*2 <= m*1.5) {
        map[x * 2] =x*2;
        if (x*2 === m) {
          console.log(find+1); return;
        }
      }
    }
    data = map;

    find += 1;
  }
});


const input = [];

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

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

function solver(n, m) {
  let first = 0, second = 0, copyN = n;
  let point = (m % 2 === 0) ? m : m + 1;

  while (copyN !== point/2) {
    if (copyN > point/2) {
      first += copyN - (point/2);
      copyN = point/2;
    }
    if (copyN < point/2) { copyN *= 2;  first += 1; }
  }
  first += (m % 2 === 0) ? 1 : 2;

  copyN = n;
  while (copyN !== m) {
    if (copyN < m) copyN *= 2;
    else {
      second += copyN - m;
      break;
    }
    second += 1;
  }

  return Math.min(first, second);
}

RL.on('close', () => {
  let [n, m] = input[0].split(' ').map(x => parseInt(x));
  if (n > m) {
    console.log(n - m); return;
  }
  let arr = [n];

  let find = 0;
  while (true) {
    const newArr = [];
    for (let i = 0; i < arr.length; i += 1) {
      let x = arr[i];
      if (x - 1 >= parseInt(m/3) ) {
        newArr.push(x - 1);
        if (x - 1 === m) {
          console.log(find+1); return;
        }
      }
      if (x*2 <= m*2) {
        newArr.push(x*2);
        if (x*2 === m) {
          console.log(find+1); return;
        }
      }
    }
    arr = newArr;
    find += 1;
  }
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

function main() {
let nums = readline().split(' ');
let n = parseInt(nums[0]);
let m = parseInt(nums[1]);

minClicks(n, m);
}

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

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


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

function main() {
    let nums = readline().split(' ');
    let n = parseInt(nums[0]);
    let m = parseInt(nums[1]);

    minClicks(n, m);
}

function minClicks(n, m){
	let queue = [n];
	let distance = new Map();
	distance.set(n, 0);
	// BFS
	while(queue[0] != m){
		let cur = queue.shift();
	if(!distance.get(cur -1)){
	distance.set(cur - 1, distance.get(cur) + 1);
	queue.push(cur - 1);
    }
    if(!distance.get(cur * 2)){
	distance.set(cur * 2, distance.get(cur) + 1);
	queue.push(cur * 2);
    }
    }
    console.log(distance.get(m));
}


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

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

stdin.addListener('end', () => {
    content = content.split("\n");
    console.log(countrySide(parseInt(content[0]), (content[1].split(" "))));
});

function countrySide(count, samples) {

    samples.map(Number)

    let lastElement = samples.pop();

    if (lastElement == 0) {
        return 'UP'
    }

    if (lastElement == 15) {
        return 'DOWN'
    }

    let secondLast = samples.pop();
    if (secondLast === undefined) {
        return -1;
    }

    let initialDecision = 'DOWN'

    if (lastElement > secondLast) {
        initialDecision = 'UP';
    }

    return initialDecision;
}


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

var input= '', readline, print;

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

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

  process.exit(main(...input) || 0);
});

const even = ['a', 'o', 'u', 'i', 'e'];

function minPrice(n, v) {
  var currentPrice = Math.min(v, n - 1);
  var currentLiters = Math.min(v, n - 1);

  for(var i = 2; i < n; i++) {
    if(currentLiters > n - i) break;

    currentLiters++;
    currentPrice += i;
  }

  return currentPrice;
}

function main(n, v) {
  arr = n.split(' ');
  console.log(minPrice(+arr[0], +arr[1]));
}

// main("ninja");


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

rl.on('line', (d) => {
  let [n, v] = d.split(' ').map(Number);
  let ans = Math.min(n, v);
  let price = 1;
  n -= v + 1;

  while (n) {
    price++;
    ans += price;

    n--;
  }

  console.log(ans);

  c++;
});


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

rl.on('line', (d) => {
  let [n, v] = d.split(' ').map(Number);
  let ans = Math.min(n, v);
  let price = 1;
  n -= v + 1;

  while (n > 0) {
    price++;
    ans += price;

    n--;
  }

  console.log(ans);

  c++;
});


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

let lineNum = 0;
let n, v;
rl.on('line', (l) => {
  lineNum++;
  [n, v] = l.split(" ").map(x => parseInt(x));
  let cost = v;
  let d = v+1;
  let perunitCost = 1;
  while (d < n) {
    perunitCost++;
    cost += perunitCost
    d++
  }
  console.log(cost)
  rl.close()
})


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

}


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

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

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


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

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

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

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


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

readline.on('line', line => {
    readline.close(), console.log(capsLocks(line));
});
const capsLocks = (word) => {
    const upperCase = /^[A-ZÑ]+$/g;

    if (word.length > 1)
        if (upperCase.test(word))
            return word.toLowerCase();
        else if (upperCase.test(word.slice(1)) && !upperCase.test(word.charAt(0)))
            return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
        else
            return word;
    else
        if (!upperCase.test(word))
            return word.toUpperCase();
        else
            return word;
}


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

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

const isCapitalize = ch => ch === ch.toUpperCase();

readLine.on('close', () => {
  const str = input[0];
  let flag = true;

  if (str.length === 1) {console.log(str); return}

  for (let i = 1; i < str.length; i += 1) if(!isCapitalize(str[i])) flag = false;

  if (flag) {
    console.log(str[0].toUpperCase() + str.slice(1).toLowerCase());
    return;
  }

  console.log(str);
});


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

let currentLine = 0;
let inputString = "";

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

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

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

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

function isLowerCase(str) {
  return str == str.toLowerCase() && str != str.toUpperCase();
}

function main() {
  var str = readLine().split("");
  var string = str.join("");
  var Fstr = str[0];
  var EFstr = str.join("").slice(1);

  var count = 0;

  for (var i = 0; i < str.length; i++) {
    if (isLowerCase(str[i]) == false) {
      count++;
    }
  }
  if (isLowerCase(EFstr) == false && isLowerCase(Fstr)) {
    console.log(Fstr.toUpperCase() + EFstr.toLowerCase());
  } else if (count === str.length) {
    console.log(string.toLowerCase());
  } else {
    console.log(string);
  }
}

// either it only contains uppercase letters;
// or all letters except for the first one are uppercase.


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

let currentLine = 0;
let inputString = "";

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

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

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

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

function isLowerCase(str) {
  return str == str.toLowerCase() && str != str.toUpperCase();
}

function main() {
  var str = readLine().split("");
  var string = str.join("");
  var Fstr = str[0];
  var EFstr = str.slice(1);

  var count = 0;
  var eFstrCount = 0;

  for (var i = 0; i < EFstr.length; i++) {
    if (isLowerCase(EFstr[i]) == false) {
      eFstrCount++;
    }
  }

  for (var i = 0; i < str.length; i++) {
    if (isLowerCase(str[i]) == false) {
      count++;
    }
  }

  if (eFstrCount == str.length - 1 && isLowerCase(Fstr)) {
    console.log(Fstr.toUpperCase() + EFstr.toLowerCase());
  } else if (count === str.length) {
    console.log(string.toLowerCase());
  } else {
    console.log(string);
  }
}

// either it only contains uppercase letters;
// or all letters except for the first one are uppercase.


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 a = readLine();
  if (a.toUpperCase() === a || a[0].toLowerCase() + a.substring(1).toUpperCase() === a) {
    console.log(a[0].toUpperCase() + a.substring(1).toLowerCase());
  } else {
    console.log(a);
  }
}


const readline = require('readline');

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

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


var input = ''
process.stdin.on('data', c => input += c)
process.stdin.on('end', () => {
  console.log('.' + input.toLowerCase().replace(/[aeiou]|\W/g, '').replace(/\B/g, '.'))
})


const readline = require('readline');

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

rl.on('line', line => {
    input.push(line.trim());
}).on('close', () => {
    const str = line.toLowerCase().slice(' ');
    // console.log(str);
    const remove = 'aoyeui';
    let res = ' ';
    for (let i = 0; i < str.length; i++) {
        if (remove.indexOf(str[i]) < 0) {
            res += '.' + str[i];
        }
    }
    console.log(res);
});


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()
		.toLowerCase()
		.replace(/[aeiou]/gi, '')
		.split('')
		.map(char => `.${char}`)
		.join('');
	console.log(str);
}


process.stdin.on('data', input => {
  console.log(formatString(input.trim()));
});

function formatString(str) {
  const vowels = ['a', 'e', 'i', 'o', 'u'];
  const arr = Array.from(str);
  return arr.reduce((acc, curr) => {
    if (!vowels.includes(curr.toLowerCase())) {
      acc.push('.', curr);
    }

    return acc;
  }, []).join('')
}


const vowels = ['a', 'e', 'i', 'o', 'u'];
process.stdin.on('data', input => {
  console.log(formatString(input.toString().trim()));
});

function formatString(str) {
  const arr = Array.from(str);

  return arr.reduce((acc, curr) => {
    curr = curr.toLowerCase();
    if (!vowels.includes(curr)) {
      acc.push('.', curr);
    }

    return acc;
  }, []).join('')
}


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 line = '';
    line = readLine().toLowerCase();
    const li = Array.from(line).filter(char=> {
        if(char === 'o' || char === 'e' || char === 'i' || char === 'a' || char === 'u') {
            return false;
        } else {
            return true;
        }
    })
    console.log(li.map(char=> '.'+char).join(""));
}


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

let currentLine = 0;
let inputString = "";

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

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

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

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

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


const stdin = process.openStdin();

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

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


let 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().toLowerCase();
  const vowels = { a: "", o: "", y: "", e: "", y: "", i: "" };
  str = str
    .split("")
    .filter((s) => {
      return vowels[s] == undefined;
    })
    .join(".");
  console.log("." + str);
}


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

process.stdin.on('data', (input) => {
  for (const c of input)
    if (!['a', 'o', 'y', 'e', 'u', 'i'].includes(c)) {
      result += `.${c.toLowerCase()}`;
    }

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


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

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

  for (const c of input.trim())
    if (!['a', 'o', 'y', 'e', 'u', 'i'].includes(c)) {
      result += `.${c.toLowerCase()}`;
    }

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


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

// listCount = new Array(1001).fill(0);
const obj = {};
let a;
let b;
let c;

function solve(n) {
    if (obj[n]) {
        return obj[n];
    }
    let sum = 0;
    if (n - a >= 0) {
        sum = Math.max(solve(n - a) + 1, sum);
    }
    if (n - b >= 0) {
        sum = Math.max(solve(n - b) + 1, sum);
    }
    if (n - c >= 0) {
        sum = Math.max(solve(n - c) + 1, sum);
    }
    obj[n] = sum;
    return sum;
}

rl.on('line', (line) => {
    const [n, aa, bb, cc] = line.split(' ').map(Number);
    a = aa;
    b = bb;
    c = cc;
    solve(n);
    console.log(obj[n]);
});


const mainFunction = (lines) => {
    let n, a, b, c;
    [n, a, b, c] = lines[0].split(" ").map(Number)
    if (a + b + c == n) console.log(3)
    else if (a + b == n || b + c == n || a + c == n) console.log(2)
    else if ([a, b, c].includes(n)) console.log(1)
}

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


const mainFunction = (lines) => {
    let n, a, b, c, ans = -1;
    [n, a, b, c] = lines[0].split(" ").map(Number)
    for (let i = 0; i <= 10e4; i++) {
        for (let j = 0; j <= 10e4; j++) {
            let qwe = n - a * i - b * j;
            ans = (qwe > 0 && qwe % c === 0) ? Math.max(i + j + qwe / c, ans) : ans;
        }
    }
    console.log(ans)
}

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


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

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

readLine.on('close', () => {
  const [n, a, b, c] = input[0].split(' ').map(x => parseInt(x));

  let max = 0;
  for (let i = 0; i <= 4000; i += 1) {
    for (let j = 0; j <= 4000; j += 1) {
      let ax = i*a, by = j*b;
      let z = (n - ax - by);

      if (z > 0 && z % c === 0) {
        z /= c;
        if (i + j + z > max) max = i + j + z;
      }
    }
  }

  console.log(max);

});


const readline = require('readline')
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let input = ''
rl.on('line', (line) => {
  input += line
  input = input.split(' ').map(x => parseInt(x))

  let n = input[0]
  let arr = input.slice(0)
  let memo = {}
  let recur = function (n) {
    if(memo[n] != null) return memo[n]
    if (n < 0) return Number.MIN_SAFE_INTEGER
    if (n === 0) return 0
    let max = 0
    for (let j of arr) {
      max = Math.max(max, 1 + recur(n - j))
    }
    memo[n] = max
    return max
  }

  console.log(recur(n))
})


let fs = require("fs");

let txt = fs.readFileSync(0, "utf-8").split(/[\r\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.shift(),info.sort((a,b)=>a-b));
}

function doit(n,tab) {
    let sum=0;
    let m=0;
    while (sum!=n) {
        sum+=tab.shift();
        ++m;
    }
    console.log(sum);

}


let fs = require('fs');
let txt = fs.readFileSync(0, "utf-8").split(/[\n\r]/).filter(data => data.length > 0);
let tab;
for (let i = 0; i < txt.length; i ++) {
    tab=-Infinity;
    let data=txt[i].split(" ").filter(data => data.length > 0).map(data => data * 1);
    doit(data.shift(),...data.sort((a,b)=>b-a));
}
function doit(n,a,b,c) {
 calc(n,a,b,c,0);
 console.log(tab);
}
function calc(n,a,b,c,index){
    if(n===0){
        if(index>tab)tab=index;
        return;
    }
    ++index;
    if(n>=a)calc(n-a,a,b,c,index);
    if(n>=b)calc(n-b,a,b,c,index);
    if(n>=c)calc(n-c,a,b,c,index);
}


let fs = require("fs");

let txt = fs.readFileSync("input.txt", "utf-8").split(/[\r\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);a
    doit(info.shift(),info.sort((a,b)=>a-b));
}

function doit(n,tab) {
    let sum=0;
    let m=0;
    while (sum!=n) {
        sum+=tab.shift();
        ++m;
        if(tab.length===0)break;
    }
    console.log(m);

}


let fs = require('fs');
let txt = fs.readFileSync(0, "utf-8").split(/[\n\r]/).filter(data => data.length > 0);
let tab;
for (let i = 0; i < txt.length; i ++) {
    tab=[];
    let data=txt[i].split(" ").filter(data => data.length > 0).map(data => data * 1);
    doit(data.shift(),...data.sort((a,b)=>b-a));
}
function doit(n,a,b,c) {
 calc(n,a,b,c,0);
 console.log(Math.max(...tab.filter(data=>data[0]===0).map(data=>data[1])));
}
function calc(n,a,b,c,index){
    if(n<c){
        tab.push([n,index]);
        return;
    }
    tab.push([n,index]);
    ++index;
    if(n>=a)calc(n-a,a,b,c,index);
    if(n>=b)calc(n-b,a,b,c,index);
    if(n>=c)calc(n-c,a,b,c,index);
}


'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 nn = readline();
    var n = nn[0];
    let arr = readline().split(' ');
    n = parseInt(n);

    arr = arr.map(ele => parseInt(ele))

    console.log(cutRibbon(n, arr));
}

function cutRibbon(ribbon, piecesLength){
 let ways = new Array(ribbon + 1).fill(0);
 ways[0] = 1;

  for(let piece of piecesLength){
    for(let amt = 1; amt < ribbon + 1; amt++){
      if(piece <= amt){
        ways[amt] += ways[amt - piece];
      }
    }
  }
  return ways[ribbon];

}


'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 nn = readline();
    var n = nn[0];
    let arr = nn.split(' ').slice(1);
    n = parseInt(n);

    arr = arr.map(ele => parseInt(ele))

    console.log(cutRibbon(n, arr));
}

function cutRibbon(ribbon, piecesLength) {
  let cuts = new Array(ribbon + 1).fill(0);
  cuts[0] = 0;
  piecesLength.forEach(ele => {
      cuts[ele] = 1;
  });

  for(let i = 1; i <= ribbon; i ++) {
    let cur = cuts[i];
    for(let piece of piecesLength){

    	if(piece <= i){
    	    if(cuts[i - piece] > 0){
                cur = Math.max(cur, 1 + cuts[i - piece]);
    	    }
    	}
     }

    cuts[i] = cur;
    }
  return cuts[ribbon];

}