//Input
// k - Precio por pala
// r - demonimación de la moneda que Polycarp tiene en su bolsillo
// var firstLine = "117 3";        // 9
// var firstLine = "237 7";        // 1
// var firstLine = "15 2";         // 2

let firstLine = readline();

retorno = eval(firstLine);

//Solution
function eval(firstLine){
    let tmp = firstLine.split(" ").map(function(x) { return parseInt(x); });
    let k  = tmp[0];
    let r = tmp[1];

    write(minimumNumberOfShovels(k, r));
    // console.log(minimumNumberOfShovels(k, r));
    // return "Hola;"
};

function minimumNumberOfShovels(k, r){
    let m1 = 0;
    for(var n = 1 ; n < 1000 ; n++){
        //console.log("n*10/k: " + Math.floor(n*10/k));
        if( (n*10/k) == Math.floor(n*10/k) ){
            m1 = n*10/k;
            break;
        };
    };

    let m2 = 0;
    for(var n = 1 ; n < 1000 ; n++){
        if( ((n*10+r)/k) == Math.floor((n*10+r)/k) ){
            m2 = (n*10+r)/k;
            break;
        }
    };
    //console.log("m1: " + m1 + "    m2: " + m2);

    var m = ( (m2 != 0 ) ? Math.min(m1, m2) : m1 );
    //console.log("m: " + m);

    return m;
};


//Input
// k - Precio por pala
// r - demonimación de la moneda que Polycarp tiene en su bolsillo
// var firstLine = "117 3";        // 9
// var firstLine = "237 7";        // 1
// var firstLine = "15 2";         // 2

let firstLine = readLine();

retorno = eval(firstLine);

//Solution
function eval(firstLine){
    let tmp = firstLine.split(" ").map(function(x) { return parseInt(x); });
    let k  = tmp[0];
    let r = tmp[1];

    write(minimumNumberOfShovels(k, r));
    // console.log(minimumNumberOfShovels(k, r));
    // return "Hola;"
};

function minimumNumberOfShovels(k, r){
    let m1 = 0;
    for(var n = 1 ; n < 1000 ; n++){
        //console.log("n*10/k: " + Math.floor(n*10/k));
        if( (n*10/k) == Math.floor(n*10/k) ){
            m1 = n*10/k;
            break;
        };
    };

    let m2 = 0;
    for(var n = 1 ; n < 1000 ; n++){
        if( ((n*10+r)/k) == Math.floor((n*10+r)/k) ){
            m2 = (n*10+r)/k;
            break;
        }
    };
    //console.log("m1: " + m1 + "    m2: " + m2);

    var m = ( (m2 != 0 ) ? Math.min(m1, m2) : m1 );
    //console.log("m: " + m);

    return m;
};


var valores = readline().split(" ");
var ptoalla = valores[0];
var centimos = valores[1];
var ptotal=ptoalla;
var contador=1;

while ((ptotal%10!=0)&&((ptotal-centimos)%10!=0){
	contador++;
	ptotal=contador*ptoalla;
}
print(parseInt(contador));


var valores = readline().split(" ");
var ptoalla = valores[0];
var centimos = valores[1];
var ptotal=ptoalla;
var contador=1;

while ((ptotal%10!=0)&&((ptotal-centimos)%10!=0){
	contador++;
	ptotal=contador*ptoalla;
}
print(contador);


var valores = readline().split(" ");
var ptoalla = valores[0];
var centimos = valores[1];
var ptotal=ptoalla;
var contador=1;

while ((ptotal%10!=0)||((ptotal-centimos)%10!=0){
	contador++;
	ptotal=contador*ptoalla;
}
print(contador);


var valores = readline().split(" ");
var ptoalla = parseInt(valores[0]);
var centimos = parseInt(valores[1]);
var ptotal=ptoalla;
var contador=1;

while ((ptotal%10!=0)&&((ptotal-centimos)%10!=0){
	contador++;
	ptotal=contador*ptoalla;
}
print(contador);


var valores = readline().split(" ");
var ptoalla = valores[0];
var centimos = valores[1];
var ptotal=ptoalla;
var contador=1;

while (!(ptotal%10==0)||!((ptotal-centimos)%10==0){
	contador++;
	ptotal=contador*ptoalla;
}
print(contador);


var arr = readline().split(" ");
var n = +arr[0];
var k = +arr[1];

var arr = readline().split(" ").map(function(v) {return +v;});
arr.sort(function(a,b) {return a-b;});

var res = [];
for(var i = 0; i < n; i++) {
    k-=arr[i];
    if(k>=0)
        res.push(arr[i]);
    else
        break;
}

print(i);
print(res.join(" ");


var str[11];
var line = readline().split(' ');
var F = parseInt(line[0]), I = parseInt(line[1]), T = parseInt(line[2]);
for (var i = 0; i < F; i++) str[i] = readline();
var ans = 0;
	for (var j = 0; j < I; j++){
		var cnt = 0;
		for (var i = 0; i < F; i++) if (str[i][j] == 'Y') cnt++;
		if (cnt >= T) ans++;
	}
print(ans);


var str[11]
var line = readline().split(' ')
var F = parseInt(line[0]), I = parseInt(line[1]), T = parseInt(line[2])
for (var i = 0; i < F; i++) str[i] = readline();
var ans = 0;
	for (var j = 0; j < I; j++){
		var cnt = 0;
		for (var i = 0; i < F; i++) if (str[i][j] == 'Y') cnt++;
		if (cnt >= T) ans++;
	}
print(ans)


var f,I,ans,t;
    var m=[];
     for (var i=0;i<100;i++) m.push(0);
    var s;
    var s1 = readLine();
    s1 = s1.split(' ');
    f = s1[0];
     I=s1[1];
     t=s1[2];
    for (var i=0;i<f;i++)
    {
        s = readLine():
        for (var j=0;j<I;j++)
            if (s[j]=='Y') m[j]++;
    }
    ans =0;
    for (var i=0;i<I;i++) if (m[i]>=t) ans++;
    print(ans);


var inp = readline().split(' ').map(x => parseInt(x));
var S = [];
for(var i = 0; i < inp[0]; ++i){
    S.push(readline());
}

var cnt = 0;

for(var i = 0; i < inp[1]; ++i){
    var l = 0;
    for(var j = 0; j < inp[0]; ++j){
        if (S[j][i] == 'Y')
            l++;
    }
    if (l >= inp[2])
        cnt++;

}

print(cnt);
print(🐈);


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

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


var word = readline();
let upperCase =0 , lowerCase =0;
for (const ch of word){
    if (ch == ch.toUpperCase()){
        upperCase ++;
    }
    else{
        lowerCase ++;
    }
}
if (upperCase > lowerCase){
    print(word.toUpperCase());
}
else{
    print(word.toLowerCase());
}


input = readline();
let upperCase =0 , lowerCase =0;
for (const ch of word){
    if (ch == ch.toUpperCase()){
        upperCase ++;
    }
    else{
        lowerCase ++;
    }
}
if (upperCase > lowerCase){
    print(word.toUpperCase());
}
else{
    print(word.toLowerCase());
}


var word = readline();
let upperCase =0 , lowerCase =0;
for (let i=0;i<word.length;i++){
    let ch = word[i];
    if (ch == ch.toUpperCase()){
        upperCase ++;
    }
    else{
        lowerCase ++;
    }
}
if (upperCase > lowerCase){
    print(word.toUpperCase());
}
else{
    print(word.toLowerCase());
}


let word = "HOUse";
let upperCase =0 , lowerCase =0;
for (const ch of word){
    if (ch == ch.toUpperCase()){
        upperCase ++;
    }
    else{
        lowerCase ++;
    }
}
if (upperCase > lowerCase){
    console.log(word.toUpperCase());
}
else{
    console.log(word.toLowerCase());
}


const transform = (text) => {

  let lowerCount = 0, upperCount =0;
  for(let i =0; i <= text.length; ++i){

    if("A".charCodeAt(0) <= text.charCodeAt(i) && "Z".charCodeAt(0) >= text.charCodeAt(i) ){
       ++upperCount;
    } else {
       ++lowerCount;
    }
  }
  return (lowerCount < upperCount) ? text.toUpperCase() : text.toLowerCase();
}

transform(readline())


let word = prompt();
let upperCase =0 , lowerCase =0;
for (const ch of word){
    if (ch == ch.toUpperCase()){
        upperCase ++;
    }
    else{
        lowerCase ++;
    }
}
if (upperCase > lowerCase){
    console.log(word.toUpperCase());
}
else{
    console.log(word.toLowerCase());
}


function main{
    var n = readline();
    var u = 0;
    var l = 0;
    for (var j = 0; j < n.length; j++) {
        if isStringUpperCase(n[j]){
            u++;
        else:
            l++;
        }
    if(u > l) {
        print(toUpperCase(n));
    }
    else {
        print(toLowerCase(n))
    }
}
main();


function transform (text) {

  let lowerCount = 0, upperCount =0;
  for(let i =0; i <= text.length; ++i){

    if("A".charCodeAt(0) <= text.charCodeAt(i) && "Z".charCodeAt(0) >= text.charCodeAt(i) ){
       ++upperCount;
    } else {
       ++lowerCount;
    }
  }
  return (lowerCount < upperCount) ? text.toUpperCase() : text.toLowerCase();
}

transform(readline())


let word = readline();
let upperCase =0 , lowerCase =0;
for (const ch of word){
    if (ch == ch.toUpperCase()){
        upperCase ++;
    }
    else{
        lowerCase ++;
    }
}
if (upperCase > lowerCase){
    print(word.toUpperCase());
}
else{
    print(word.toLowerCase());
}


let word = prompt("Enter a word");
let upperCase =0 , lowerCase =0;
for (const char of word){
    if (char == char.toUpperCase()){
        upperCase ++;
    }
    else{
        lowerCase ++;
    }
}
if (upperCase > lowerCase){
    alert(word.toUpperCase());
}
else{
    alert(word.toLowerCase());
}


let word = readLine();
let upperCase =0 , lowerCase =0;
for (const ch of word){
    if (ch == ch.toUpperCase()){
        upperCase ++;
    }
    else{
        lowerCase ++;
    }
}
if (upperCase > lowerCase){
    print(word.toUpperCase());
}
else{
    print(word.toLowerCase());
}


const readline = require('readline');

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

let colored = {C:true, M:true, Y: true};
let isColored = false;
let count = 0;
let n;

rl.on('line', (input) => {
  //console.log(`Received: ${input}`);

  let arr = input.split(' ');
  if (!count) {
    n = +arr[0];
  }

  if (colored[arr[0]] || colored[arr[1]]) {
    isColored = true;
    done();
    rl.close();
  }

  //console.log(count, n);
  if (count === n) {
    done();
    rl.close();
  }
  count++;
});

function done() {
  let output = isColored? '#Color':'#Black&White';
  rl.write(output);
}


var dimentions = readline().split(' ').map(Number)
var rows = dimentions[0]
var columns = dimentions[1]

var ans = '#Black&White'
for (var i = 0; i < rows; i++) {
  var row = readline().split(' ')·
  for (var j = 0; j < columns; j++) {
     if (row[j] === 'C' || row[j] === 'M' || row[j] === 'Y') {
       ans = '#Color'
       break;
     }
  }
  if (ans === '#Color') {
    break;
  }
}

print(ans)


const { readlink } = require("fs");

var x = readline();
var n = 0;

x.split('');

for (e of x) {
  n += Number(e);
}

print(n);


var n,m,x;
var cnt[1024][5];

var line = readline().split('');
n=line[0];
m=line[1];

for(var i=0;i<n;i++){
    line = readline();
    cnt[i%m][line[0]]++;
}

var ans=0;

for(int i=0;i<m;i++){
    ans+=min(cnt[i][1],cnt[i][2]);
}

print(ans);


(function(n){

	var binary_number = 0,
		binary_digit_count = 0;

	while(n > 0){
		n_mod = n % 10;

		if(n_mod > 1){
			binary_number = (1 << binary_digit_count+1) - 1;
		} else if(n_mod == 1){
			binary_number |= 1 << binary_digit_count;
		}

		binary_digit_count++

		n = (n - n_mod) / 10;
	}

	print binary_number;
})(+readline());


'use strict'

const rem = (s, m) => {
    const n = s.length;
    if (n <= 10) return parseInt(s) % m;

    const first = s.slice(0, n-10);
    const second = s.slice(-10);
    return (rem(first, m) * ((10**10) % m) + parseInt(second) % m) % m;
}
const div = (s, m) => {
    const n = s.length;
    if (n <= 10) return parseInt(parseInt(s) / m);

    const rem = parseInt(s.slice(0, 10)) % m
    const head = (parseInt(s.slice(0, 10)) - rem) / m;
    return `${head}${div(`${rem}${s.slice(10)}`, m)}`;
}

const sub = (a, b) => {
    const subact = (A, B) => {
        const lA = A.length, lB = B.length;
        if (lA <= 9 && lB <= 9) return [ { value: parseInt(A) - parseInt(B), size: lA } ];
        if (lA < lB) return [ { value: -parseInt(B.slice(0, -lA)), size: lB - lA }, ...subact(B.slice(-lA), A) ];
        if (lA > lB) return [ { value: parseInt(A.slice(0, -lB)), size: lA - lB }, ...subact(A.slice(-lB), B) ];

        return [ { value: parseInt(A.slice(0, 9)) - parseInt(B.slice(0, 9)), size: 9 }, ...subact(A.slice(9), B.slice(9)) ]
    }

    let x = subact(a, b);
    x = x.slice(x.findIndex(i => i.value));
    if (!x.length) return '0';

    let t = '';
    if (x[0] < 0) { t = '-'; x = x.map(i => -i); }

    for (let i = 1; i < x.length; i++) {
        if (x[i].value < 0) { x[i-1].value -= 1; x[i].value = 10**10 + x[i].value; }
    }
    return t + x.map(i => `${'0'.repeat(i.size)}${i.value}`.slice(-i.size)).join('').replace(/^0+/, '') || '0';
}

const problem = (n, p, w, d) => {
    let Y = -1;
    const W = parseInt(w);
    while (++Y < W && rem(p, w)) p = sub(p, d);
    console.log(n, '[', p, w, div(p, w), ']', Y );
    const z = sub(sub(n, div(p, w)), `${Y}`);
    if (Y === W) return -1; // || (p|z) < 0
    console.log(Y, p, z);
    return `${div(p, w)} ${Y} ${z}`;
}

const npwd = readline().split(' ');
write(problem(npwd[0], npwd[1], npwd[2], npwd[3]));


var firstLine = readline();
print('\n');

var args = firstLine.split(' ');

let count = 0;
let numRez = firstLine.split(' ')[0];
let res = [];

print(getRezult(numRez));

function getRezult (num) {
  var input = `${num}`;
  var parse = [];
  var sum = 0;
  parse.push(+input);
  debugger;
  for (var i =0; i < input.length; i++) {
    parse.push(+input[i]);
  }

  for (var j =0; j < parse.length; j++) {
     sum += parse[j];
  }

  if(sum == numRez) {
    res.push(input);
  } else {
    count++;
  }

  if (count == numRez) {
    return 0;
  }
  getRezult(--input);

  return res;
}


/*var inputVedraDlinna = prompt("Enter dlinna koli4estvo veder i dlinna sada  ").split(' ');
var koli4estvoVeder = inputVedraDlinna[0];
var dlinnaSada = inputVedraDlinna[1];

var otrezkiZemli = prompt("Otrzli zemli").split(' ');

var r = Math.max()
console.log(koli4estvoVeder, dlinnaSada);
alert(otrezkiZemli);
*/
/*var n  = prompt("dannue")

function getNumbersSum(num){
    return num.toString().split('').reduce(function(a, b) {
     return +a + +b;

    })

    }

getNumbersSum(n);
*/
/*var n = prompt("ented digit");

for (i = 1 ; i < n; i++){
var res = n/2 + i;

console.log(res);
}

/*function getSumNumber(num) {
   var sum = 0, tmp;

    while (num) {
    tmp = num % 10;
num = (num - tmp) / 10;
sum += tmp;
  }
  return sum;
   }
alert(n + getSumNumber(n));
    */

    var n = readline(); //+prompt("dsfs");
    var resultArr = [];

    for (let i = Math.floor(n / 2); i < n; i++) {
      const sumOfDigits = i.toString().split('').map(Number).reduce((a, b) => a + b, 0);
      const resultSum = i + sumOfDigits;
      //console.log(resultSum);
      if (resultSum === n) {
        resultArr.push(i);
      }
    }
    print(resultArr.length);
    print(resultArr.toString().replace(',', ' '));
    //console.log(resultArr.length);
    //console.log(resultArr.toString().replace(',', ' '));


/*var n = prompt("enter digit");

for (i = n/2 ; i < n; i++){
  function getSumNumber(i) {
   var sum = 0, tmp;
   while (i) {
    tmp = i % 10;
i = (i - tmp) / 10;
sum += tmp;
  }
  return Math.trunc(sum);

   }

alert(getSumNumber(i));
}
    /*var n = prompt("ented digit");

for (i = 1 ; i < n; i++){
var res = n/2 + i;.

console.log(res);

}
*/
const n = readline(); //prompt("olo");
const resultArr = [];

for (let i = Math.floor(n / 2); i < n; i++) {
  const sumOfDigits = i.toString().split('').map(Number).reduce((a, b) => a + b, 0);
  const resultSum = i + sumOfDigits;
  if (resultSum === n) {
    resultArr.push(i);
  }
}
print(resultArr.length);
preint(resultArr.toString().replece(',', ' '));
//console.log(resultArr.length);
//console.log(resultArr.toString().replace(',', ' '));


var firstLine = readline();

var args = firstLine.split(' ');

var count = 0;
var numRez = firstLine.split(' ')[0];
var res = [];
let rezult = getRezult(numRez)

print(rezult.length);
print(rezult);

function getRezult (num) {
  var input = `${num}`;
  var parse = [];
  var sum = 0;
  parse.push(+input);
  debugger;
  for (var i =0; i < input.length; i++) {
    parse.push(+input[i]);
  }

  for (var j =0; j < parse.length; j++) {
     sum += parse[j];
  }

  if(sum == numRez) {
    res.push(input);
  } else {
    count++;
  }

  if (count == numRez) {
    return 0;
  }
  getRezult(--input);

  return res;
}


'use strict';
var num = parseInt(readline()),
var res = new Array;
for (var i = num - 9*num.toString().length; i <num - 1; i++) {
    var sum = 0;
    var t = i;
        while (t) {
            sum += t % 10;
            t = Math.floor(t / 10);
        }
        if (sum + i === num)
            res.push(i);
    }
print(res.length);
for (var i = 0; i < res.length; i++)
    print(res[i]);


'use strict';
var num = parseInt(readline());
var res = new Array;
var numLength = num.toString().length;
if (num > = 1) {
for (var i = num - 9*numLength; i <num - 1; i++) {
    var sum = 0, t = i;
        while (t) {
            sum += t % 10;
            t = Math.floor(t / 10);
        }
        if (sum + i === num)
            res.push(i);
    }
print(res.length);
for (var i = 0; i < res.length; i++)
    print(res[i]);
}


    var n = +readline(); //+prompt("dsfs");
    var resultArr = [];

    for (let i = Math.floor(n / 2); i < n; i++) {
      var sumOfDigits = i.toString().split('').map(Number).reduce((a, b) => a + b, 0);
      var resultSum = i + sumOfDigits;
      //console.log(resultSum);
      if (resultSum === n) {
        resultArr.push(i);
      }
    }
    print(resultArr.length);
    print(resultArr.toString().replace(',', ' '));
    //console.log(resultArr.length);
    //console.log(resultArr.toString().replace(',', ' '));


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script src="ex3.js"></script>
</body>
</html>


    var n = readline(); //+prompt("dsfs");
    var resultArr = [];

    for (let i = Math.floor(n / 2); i < n; i++) {
      var sumOfDigits = i.toString().split('').map(Number).reduce((a, b) => a + b, 0);
      var resultSum = i + sumOfDigits;
      //console.log(resultSum);
      if (resultSum === n) {
        resultArr.push(i);
      }
    }
    print(resultArr.length);
    print(resultArr.toString().replace(',', ' '));
    //console.log(resultArr.length);
    //console.log(resultArr.toString().replace(',', ' '));


function(n){
    var i;
    var k = 0;
    var s = [];
    var m = [];
    s = n.toString().split('');
    n < 18 ? i = n : i = 9 * s.length;
    var p;
    while(i >= 0){
        var p = n - i;
        var t = p;
        while(p){
            t += (p % 10);
            p = Math.floor(p / 10);
        }
        if(t === n){
            m.push(n - i);
            k++;
        }
        i--;
    }
    print(k);
    for(var e of m)
    print(e);
}


/*var n = prompt("enter digit");

for (i = n/2 ; i < n; i++){
  function getSumNumber(i) {
   var sum = 0, tmp;
   while (i) {
    tmp = i % 10;
i = (i - tmp) / 10;
sum += tmp;
  }
  return Math.trunc(sum);

   }

alert(getSumNumber(i));
}
    /*var n = prompt("ented digit");

for (i = 1 ; i < n; i++){
var res = n/2 + i;.

console.log(res);

}
*/
const n = readline(); //prompt("olo");
const resultArr = [];

for (let i = Math.floor(n / 2); i < n; i++) {
  const sumOfDigits = i.toString().split('').map(Number).reduce((a, b) => a + b, 0);
  const resultSum = i + sumOfDigits;
  if (resultSum === n) {
    resultArr.push(i);
  }
}
print(resultArr.length);
print(resultArr.toString().replece(',', ' '));
//console.log(resultArr.length);
//console.log(resultArr.toString().replace(',', ' '));


var x = parseInt(readline()),
 y = parseInt(readline()),
 z = parseInt(readline());
 print(Math.max( x*y*z , (x+y)*z , x*(y+z) , x+y+z)


var a = readline();
var b = readline();
var c = readline();
var max = 0;
var abc = [a,b,c];
for (i in abc){
abc[i]=parseInt(abc[i]);
abc.sort(mySort);
if (abc[2]!==1){
if(abc[1]+abc[0]>=abc[1]*abc[0]){
	max = abc[2]*(abc[1]+abc[0]);}
else max = abc[2]*(abc[1]*abc[0]);
}
else max = abc[0]+abc[1]+abc[2];
print(max);
function mySort(a, b){return a-b;}


var res =0;
for (var i=0; i<3; i++){
	var n = readline();
    if (res==0);
	res+=Number(n);
	else if (res==1)
		res+=Number(n);
	else if res*=Number(n);
}
print(res);


var a = parseInt(readline());
var b = parseInt(readline());
var c = parseInt(readline());

print(Math.max(a + b + c, (a + b) * c, a * (b + c), a * b * c);


var a = readline();
var b = readline();
var c = readline();
var max = 0;
var abc = [a,b,c];
for (i in abc){
abc[i]=parseInt(abc[i]);
}
abc.sort(mySort);
if (abc[2]!==1){
if(abc[1]+abc[0]>=abc[1]*abc[0]){
	max = abc[2]*(abc[1]+abc[0]);}
else max = abc[2]*(abc[1]*abc[0]);
}
else max = abc[0]+abc[1]+abc[2];
print(max);
function mySort(a, b){return a-b;}
}


<!DOCTYPE html>
<html>

<body>
  <script>
    'use strict';
  var x = prompt('x', '');
  var hh = prompt('hh', '');
  var mm = prompt('mm', '');

  findTime(x, hh, mm);

  function findTime(x, hh, mm) {
  var date = new Date();
  date.setHours(hh);
  date.setMinutes(mm);
  var i = 0;
  var dateToString = 0;
  while (true) {
      dateToString = date.getHours().toString() + date.getMinutes().toString();
      if (dateToString.indexOf('7') != -1) {
      alert('Result='+i);
      return i;
    }
    date.setMinutes(date.getMinutes() - x);
    i += 1;
    }
  }
  </script>
</body>

</html>


function findDelayCount(delay,alarmTime){
    let hour = Number(alarmTime.split(' ')[0]),
        min = Number(alarmTime.split(' ')[1]),
        delayCounter = 0;

    for(let i = 0; true; i++){
        let time = hour.toString() + ':' + min.toString();
        if(time.search('7') > 0){
            delayCounter = i;
            break;
        }
        else{
            if(min>=delay){
                min -= delay;
            }
            else{
                min += 60 - delay;
                if(hour==0){
                    hour = 23;
                }else{
                    hour--;
                }
            }
        }
    }
    console.log(delayCounter);
    return delayCounter;
}

findDelayCount("3", "15 23");


let minuteInterval = readline();
let entereTime = readline().split(' ').map(minuteInterval function(+minuteInterval));
let stopActionCount = 0;
let n = entereTime[0]*60+entereTime[1]
let res = function () {
 while (7) {
  if (`${Math.round(n/60)}${n%60}`.indexOf('7')>=0)
   return stopActionCount;
   else
  n = n >= minuteInterval ? n - minuteInterval : n - minuteInterval + 24*60;
  y++;
 }
}
print(res());


/* eslint-disable */
require('dotenv').config();

require('babel-polyfill');
const babel                 = require('babel-loader');
const HtmlWebpackPlugin     = require('html-webpack-plugin');
const webpack               = require('webpack');
const path                  = require('path');
const WebpackNotifierPlugin = require('webpack-notifier');
const CleanWebpackPlugin    = require('clean-webpack-plugin');
const UglifyJSPlugin        = require('uglifyjs-webpack-plugin');

const port = process.env.PORT || 5001;
const proxyUrl = process.env.PROXY_URL || 'http://localhost:5000';

const DEBUG = process.env.NODE_ENV !== 'production';

let config = {
    distPath     : path.join(__dirname, 'public'),
    srcPath      : path.join(__dirname, 'front/src/app')
};

let appEntries = [
    'babel-polyfill',
    `${config.srcPath}/index.tsx`
];

if(process.env.NODE_ENV !== 'production') {
    [].unshift.apply(appEntries, [
        'webpack-dev-server/client?http://localhost:' + port,
        'webpack/hot/only-dev-server'
    ])
} else {
    console.log(process.env.NODE_ENV)
}

/*{
    test: /\.tsx?$/,
        enforce: 'pre',
    loader: 'tslint-loader'
},*/

let moduleRules = [
    {
        use : DEBUG ? ['react-hot-loader/webpack', 'babel-loader', 'ts-loader'] : [ 'babel-loader', 'ts-loader' ],
        test   : /\.tsx?$/,
        exclude: /(node_modules)/
    },
    {
        loader: 'html-loader',
        test  : /\.html?$/
    },
    {
        test: /\.scss$/,
        use: ["style-loader", "css-loader", "sass-loader"]
    },
    {
        test: /\.css$/,
        loader: "style-loader!css-loader"
    },
    {
        test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
        loader: 'url-loader?limit=10000&mimetype=application/font-woff'
    },
    {
        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
        loader: 'url-loader?limit=10000&mimetype=application/octet-stream'
    },
    {
        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
        loader: 'file-loader'
    },
    {
        test: /\.(jpe?g|png|gif|svg|ico)$/i,
        use: [
            'file-loader?name=[hash].[ext]'
        ]
    }
];

const plugins = [
    new CleanWebpackPlugin([config.distPath], {verbose:true}),
    new webpack.DefinePlugin({
        'process.env': {
            'NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
            'STRIPE_KEY': JSON.stringify(process.env.STRIPE_PUBLISH_KEY || 'pk_test_GrMRPRZI9vLTKBFG5NybQx6Z'),
            'WIDGET_URL': JSON.stringify(process.env.WIDGET_URL || 'https://brands-widget.klickly.com')
        }
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.LoaderOptionsPlugin({
        debug: true
    }),
    new HtmlWebpackPlugin({
        //favicon: 'front/app/favicon.ico',
        template: path.join(config.srcPath, 'index.html')
    }),
    new WebpackNotifierPlugin({alwaysNotify: true})
];

if (!DEBUG) {
    plugins.push(
        new UglifyJSPlugin({
            uglifyOptions: {
                compress: true,
                warnings: false,
                comments: false,
            }
        })
    )
}

module.exports = {
    resolve: {
        extensions: ['.ts', '.tsx', '.js', '.jsx', 'scss']
    },
    entry  : {
        app: appEntries
    },
    output : {
        filename         : '[name].bundle-[hash:4].js',
        sourceMapFilename: '[name].bundle-[hash:4].map',
        path             :  config.distPath,
        publicPath       : '/'
    },

    devServer: {
        port: port,
        proxy: [{
            context: ['/api/**'],
            changeOrigin: true,
            target: proxyUrl,
            secure: false
        }]
    },

    devtool: 'source-map',

    module: {
        rules: moduleRules
    },

    plugins: plugins
};


let minuteInterval = readline();//prompt("enter minute interval");
let entereTime = readline().split(' ').map(minuteInterval => +minuteInterval);//prompt("enter HH, MM").split(' ').map(minuteInterval => +minuteInterval);
let stopActionCount = 0;
let time = entereTime[0]*60+entereTime[1];

let res = function () {
 while (true) {
  if (`${Math.round(time/60)}${time%60}`.indexOf('7')>=0){
   return stopActionCount;
  }
   else {
  time = time >= minuteInterval ? time - minuteInterval : time - minuteInterval + 24*60;
  stopActionCount++;
}
 }
}
print(res());//alert(res());


let minuteInterval = readline();//prompt("enter minute interval");
let entereTime = readline().split(' ').map(minuteInterval => +minuteInterval);//prompt("enter HH, MM").split(' ').map(minuteInterval => +minuteInterval);
let stopActionCount = 0;
let time = entereTime[0]*60+entereTime[1];

let res = function () {
 while (true) {
  if (`${Math.round(time/60)}${time%60}`.indexOf('7')>=0){
   return stopActionCount;
  }
   else {
  time = time >= minuteInterval ? time - minuteInterval : time - minuteInterval + 24*60;
  stopActionCount++;
}
 }
}
pprint(res());//alert(res());


getAlarmCount = (delay, hours, minutes) => {
  let counter = 0;
  while (!this.isHappy(hours, minutes)) {
    counter++;
    minutes -= delay;
    if (minutes < 0) {
      minutes += 60;
      hours--;
      if (hours < 0) hours = 23;
    }
  }
  return counter;
};

isHappy = (h, m) => h.toString().includes("7") || m.toString().includes("7");


'use strict';

const hh = +prompt('Hours');
const yy = +prompt('Minuts');
const x = +prompt('Interval');;

const rezult = getRezult(hh, yy, x);
alert(rezult);

function getRezult (hh, yy, x) {
    const maxTime = 60 * 24 / x;
    let count = 0;
    let hours = hh;
    let min = yy;

    for (let i = 0; i < maxTime; i++) {
        const newTime = changeTime(hours, min, x);
        if (getHappyTime(hours, min)) {
            return count;
        } else {
            ++count;
        }
        hours = newTime.hh;
        min = newTime.yy ;
    }

    return "more than 1 day";
}

function getHappyTime (hh, yy) {
    const time = `${hh}:${yy}`;
    return time.includes('7');
}

function changeTime (hh, yy, x) {
    if ( yy - x < 0) {
        hh = getChangedH(hh);
    }
    yy = yy >= x ? yy - x : 60 + yy - x;

    return {hh, yy};
}

 function getChangedH (hh,) {
    return hh - 1 < 0 ? 23 : --hh;
 }


let minuteInterval = prompt("enter minute interval");
let entereTime = prompt("enter HH, MM").split(' ').map(minuteInterval => +minuteInterval);
let stopActionCount = 0;
let time = entereTime[0]*60+entereTime[1];

let res = function () {
 while (true) {
  if (`${Math.round(time/60)}${time%60}`.indexOf('7')>=0){
   return stopActionCount;
  }
   else {
  time = time >= minuteInterval ? time - minuteInterval : time - minuteInterval + 24*60;
  ++stopActionCount;
}
 }
}
alert(res());


 class Program
    {
        static void Main(string[] args)
        {
            string str =  System.Console.ReadLine().ToString();
            int n = Convert.ToInt32(str[0]);
            int k = Convert.ToInt32(str[1]);
            k = k * 2 - 1;
            System.Console.Write(k <= n ? k : k - n + (n % 2==0 ? 0 : 1));
        }
    }


var str = readline().split(" ");
var n = +str[0]; var k = +str[1];
var res = 0;
if (n/2>k){
	for (var i=1; i<+n; i++){
			if(i%2!=0)
				res++;

		if (res==k){
				print(i);
				break;
				}

	}
}
else (n/2<k){
k=Math.floor(k-n/2);
for (var i=1; i<+n; i++){
			if(i%2==0)
				res++;

		if (res==k){
				print(i);
				break;
				}

	}
}


   class Program
    {
        static void Main(string[] args)
        {
            string str =  System.Console.ReadLine().ToString();
            int n = Convert.ToInt32(str[0]);
            int k = Convert.ToInt32(str[1]);
            k = k * 2 - 1;
            System.Console.Write(k <= n ? k : k - n + (n % 2==0 ? 0 : 1));
        }


const evenAndOdd = (lastNumber, needNumber) => {
  var currentNumber = 1;
  var someArray = [];
  if (lastNumber % 2 === 0) {
    lastNumber += 1;
  }
  for(let i = 1; i <= needNumber; i++) {
    someArray.push(currentNumber);
    currentNumber += 2;
    if (currentNumber === lastNumber) {
      someArray.push(currentNumber);
      currentNumber = 2;
    }
    if (someArray.length === needNumber) {
      break;
    }
  }
  return currentNumber;
};
evenAndOdd();


const evenAndOdd = (lastNumber, needNumber) => {
  var currentNumber = 1;
  var someArray = [];
  if (lastNumber % 2 === 0) {
    lastNumber += 1;
  }
  for(let i = 1; i <= needNumber; i++) {
    someArray.push(currentNumber);
    currentNumber += 2;
    if (currentNumber === lastNumber) {
      someArray.push(currentNumber);
      currentNumber = 2;
    }
    if (someArray.length === needNumber) {
      break;
    }
  }
  return currentNumber;
};


<!DOCTYPE HTML>
<html lang="en">
    <head>
    <meta charset="utf-8">
    </head>
<body>
<script>
var line=readline().split(' ')
if(line[1]>=2&&line[1]<10)
{
print(line[1]);
for(var i=0;i<(line[0]-1);i++) print("0");
}
else if(line[0]>1&&line[1]==10)
{
print("1");
for(var i=0;i<(line[0]-1);i++) print("0");
}
else print("-1");

</script>
</body>

</html>


let n = Number(readline());
let p = readline().split(' ').map(Number);

// let n = 6;
// let p = [1, 2, 6];

// let n = 10;
// let p = [1, 2, 3, 4, 5];

let b = 0,
	w = 0;

p.map((p, j) => {
	b += Math.abs(p - ((j + 1)*2 - 1));
	w += Math.abs(p - (j + 1)*2);
})

// console.log(b, w);

// console.log(b > w ? w : b);

print(b > w ? w : b);


var arr = readline().split(" ").map(function(v) {return +v;});

var a = arr[0];
var b = arr[2];
var c = arr[1];
var d = arr[3];

function score(a,b) {
    return Math.max(3*a/10, a-a*b/250);
}

if(score(a,b)>score(c,d))
    print("Misha");
else if(score(a,b)===score(c,d));
    print("Tie");
else
    print("Vasya");


const n = +readline();

function solve(n) {
    if (n % 2 === 0) {
        return n / 2;
    }

    const square = Math.sqrt(n);
    let d = 3;
    let smallestDivisor = n;
    while (d < square) {
        if (n % d === 0) {
            smallestDivisor = d;
            break;
        }
        d += 2;
    }

    return n / smallestDivisor;
}

write(solve(n));


function firstPrimeDivisorExcept2(x) {
    for (let i = 3; i <= Math.sqrt(x); i+=2) {
        if (x % i === 0) return i;
    }
}

function run(input) {
    if (input % 2 === 0) return print(input / 2);
    const prime = firstPrimeDivisorExcept2(input);
    return (input - prime) / 2;
}

print(run(parseInt(readline())));


const n = +readLine();

function solve(n) {
    if (n % 2 === 0) {
        return n / 2;
    }

    const square = Math.sqrt(n);
    let d = 3;
    let smallestDivisor = n;
    while (d < square) {
        if (n % d === 0) {
            smallestDivisor = d;
            break;
        }
        d += 2;
    }

    return n / smallestDivisor;
}

solve(n);


function main(n,m) {

    var ans = 2**n;
    // if(n > 1){
    //   for(var i = 0 ; i < n ; i++)ans *= 2;
    // }
    ans = m%ans;
    print(ans);
}

//
var n = parseInt(readline());
var m = parseInt(readline());

main(n,m);


function main(n,m) {

    print(m%(2**n));
}

var n = parseInt(readline());
var m = parseInt(readline());

main(n,m);


function main(n,m) {

    var ans = 2 ** n;
    ans = m%ans;
    print(ans);
}

var n = parseInt(readline());
var m = parseInt(readline());

main(n,m);


// Copyright (c) 2005  Tom Wu
// All Rights Reserved.
// See "LICENSE" for details.

// Basic JavaScript BN library - subset useful for RSA encryption.

// Bits per digit
var dbits;

// JavaScript engine analysis
var canary = 0xdeadbeefcafe;
var j_lm = (canary & 0xffffff) == 0xefcafe;

// (public) Constructor
function BigInteger(a, b, c) {
  if (a != null)
    if ('number' == typeof a) this.fromNumber(a, b, c);
    else if (b == null && 'string' != typeof a) this.fromString(a, 256);
    else this.fromString(a, b);
}

// return new, unset BigInteger
function nbi() {
  return new BigInteger(null);
}

// am: Compute w_j += (x*this_i), propagate carries,
// c is initial carry, returns final carry.
// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
// We need to select the fastest one that works in this environment.

// am1: use a single mult and divide to get the high bits,
// max digit bits should be 26 because
// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
function am1(i, x, w, j, c, n) {
  while (--n >= 0) {
    var v = x * this[i++] + w[j] + c;
    c = Math.floor(v / 0x4000000);
    w[j++] = v & 0x3ffffff;
  }
  return c;
}
// am2 avoids a big mult-and-extract completely.
// Max digit bits should be <= 30 because we do bitwise ops
// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
function am2(i, x, w, j, c, n) {
  var xl = x & 0x7fff,
    xh = x >> 15;
  while (--n >= 0) {
    var l = this[i] & 0x7fff;
    var h = this[i++] >> 15;
    var m = xh * l + h * xl;
    l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);
    c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);
    w[j++] = l & 0x3fffffff;
  }
  return c;
}
// Alternately, set max digit bits to 28 since some
// browsers slow down when dealing with 32-bit numbers.
function am3(i, x, w, j, c, n) {
  var xl = x & 0x3fff,
    xh = x >> 14;
  while (--n >= 0) {
    var l = this[i] & 0x3fff;
    var h = this[i++] >> 14;
    var m = xh * l + h * xl;
    l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;
    c = (l >> 28) + (m >> 14) + xh * h;
    w[j++] = l & 0xfffffff;
  }
  return c;
}
if (j_lm && navigator.appName == 'Microsoft Internet Explorer') {
  BigInteger.prototype.am = am2;
  dbits = 30;
} else if (j_lm && navigator.appName != 'Netscape') {
  BigInteger.prototype.am = am1;
  dbits = 26;
} else {
  // Mozilla/Netscape seems to prefer am3
  BigInteger.prototype.am = am3;
  dbits = 28;
}

BigInteger.prototype.DB = dbits;
BigInteger.prototype.DM = (1 << dbits) - 1;
BigInteger.prototype.DV = 1 << dbits;

var BI_FP = 52;
BigInteger.prototype.FV = Math.pow(2, BI_FP);
BigInteger.prototype.F1 = BI_FP - dbits;
BigInteger.prototype.F2 = 2 * dbits - BI_FP;

// Digit conversions
var BI_RM = '0123456789abcdefghijklmnopqrstuvwxyz';
var BI_RC = new Array();
var rr, vv;
rr = '0'.charCodeAt(0);
for (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
rr = 'a'.charCodeAt(0);
for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
rr = 'A'.charCodeAt(0);
for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;

function int2char(n) {
  return BI_RM.charAt(n);
}
function intAt(s, i) {
  var c = BI_RC[s.charCodeAt(i)];
  return c == null ? -1 : c;
}

// (protected) copy this to r
function bnpCopyTo(r) {
  for (var i = this.t - 1; i >= 0; --i) r[i] = this[i];
  r.t = this.t;
  r.s = this.s;
}

// (protected) set from integer value x, -DV <= x < DV
function bnpFromInt(x) {
  this.t = 1;
  this.s = x < 0 ? -1 : 0;
  if (x > 0) this[0] = x;
  else if (x < -1) this[0] = x + this.DV;
  else this.t = 0;
}

// return bigint initialized to value
function nbv(i) {
  var r = nbi();
  r.fromInt(i);
  return r;
}

// (protected) set from string and radix
function bnpFromString(s, b) {
  var k;
  if (b == 16) k = 4;
  else if (b == 8) k = 3;
  else if (b == 256) k = 8;
  else if (b == 2)
    // byte array
    k = 1;
  else if (b == 32) k = 5;
  else if (b == 4) k = 2;
  else {
    this.fromRadix(s, b);
    return;
  }
  this.t = 0;
  this.s = 0;
  var i = s.length,
    mi = false,
    sh = 0;
  while (--i >= 0) {
    var x = k == 8 ? s[i] & 0xff : intAt(s, i);
    if (x < 0) {
      if (s.charAt(i) == '-') mi = true;
      continue;
    }
    mi = false;
    if (sh == 0) this[this.t++] = x;
    else if (sh + k > this.DB) {
      this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;
      this[this.t++] = x >> (this.DB - sh);
    } else this[this.t - 1] |= x << sh;
    sh += k;
    if (sh >= this.DB) sh -= this.DB;
  }
  if (k == 8 && (s[0] & 0x80) != 0) {
    this.s = -1;
    if (sh > 0) this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;
  }
  this.clamp();
  if (mi) BigInteger.ZERO.subTo(this, this);
}

// (protected) clamp off excess high words
function bnpClamp() {
  var c = this.s & this.DM;
  while (this.t > 0 && this[this.t - 1] == c) --this.t;
}

// (public) return string representation in given radix
function bnToString(b) {
  if (this.s < 0) return '-' + this.negate().toString(b);
  var k;
  if (b == 16) k = 4;
  else if (b == 8) k = 3;
  else if (b == 2) k = 1;
  else if (b == 32) k = 5;
  else if (b == 4) k = 2;
  else return this.toRadix(b);
  var km = (1 << k) - 1,
    d,
    m = false,
    r = '',
    i = this.t;
  var p = this.DB - (i * this.DB) % k;
  if (i-- > 0) {
    if (p < this.DB && (d = this[i] >> p) > 0) {
      m = true;
      r = int2char(d);
    }
    while (i >= 0) {
      if (p < k) {
        d = (this[i] & ((1 << p) - 1)) << (k - p);
        d |= this[--i] >> (p += this.DB - k);
      } else {
        d = (this[i] >> (p -= k)) & km;
        if (p <= 0) {
          p += this.DB;
          --i;
        }
      }
      if (d > 0) m = true;
      if (m) r += int2char(d);
    }
  }
  return m ? r : '0';
}

// (public) -this
function bnNegate() {
  var r = nbi();
  BigInteger.ZERO.subTo(this, r);
  return r;
}

// (public) |this|
function bnAbs() {
  return this.s < 0 ? this.negate() : this;
}

// (public) return + if this > a, - if this < a, 0 if equal
function bnCompareTo(a) {
  var r = this.s - a.s;
  if (r != 0) return r;
  var i = this.t;
  r = i - a.t;
  if (r != 0) return this.s < 0 ? -r : r;
  while (--i >= 0) if ((r = this[i] - a[i]) != 0) return r;
  return 0;
}

// returns bit length of the integer x
function nbits(x) {
  var r = 1,
    t;
  if ((t = x >>> 16) != 0) {
    x = t;
    r += 16;
  }
  if ((t = x >> 8) != 0) {
    x = t;
    r += 8;
  }
  if ((t = x >> 4) != 0) {
    x = t;
    r += 4;
  }
  if ((t = x >> 2) != 0) {
    x = t;
    r += 2;
  }
  if ((t = x >> 1) != 0) {
    x = t;
    r += 1;
  }
  return r;
}

// (public) return the number of bits in "this"
function bnBitLength() {
  if (this.t <= 0) return 0;
  return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));
}

// (protected) r = this << n*DB
function bnpDLShiftTo(n, r) {
  var i;
  for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i];
  for (i = n - 1; i >= 0; --i) r[i] = 0;
  r.t = this.t + n;
  r.s = this.s;
}

// (protected) r = this >> n*DB
function bnpDRShiftTo(n, r) {
  for (var i = n; i < this.t; ++i) r[i - n] = this[i];
  r.t = Math.max(this.t - n, 0);
  r.s = this.s;
}

// (protected) r = this << n
function bnpLShiftTo(n, r) {
  var bs = n % this.DB;
  var cbs = this.DB - bs;
  var bm = (1 << cbs) - 1;
  var ds = Math.floor(n / this.DB),
    c = (this.s << bs) & this.DM,
    i;
  for (i = this.t - 1; i >= 0; --i) {
    r[i + ds + 1] = (this[i] >> cbs) | c;
    c = (this[i] & bm) << bs;
  }
  for (i = ds - 1; i >= 0; --i) r[i] = 0;
  r[ds] = c;
  r.t = this.t + ds + 1;
  r.s = this.s;
  r.clamp();
}

// (protected) r = this >> n
function bnpRShiftTo(n, r) {
  r.s = this.s;
  var ds = Math.floor(n / this.DB);
  if (ds >= this.t) {
    r.t = 0;
    return;
  }
  var bs = n % this.DB;
  var cbs = this.DB - bs;
  var bm = (1 << bs) - 1;
  r[0] = this[ds] >> bs;
  for (var i = ds + 1; i < this.t; ++i) {
    r[i - ds - 1] |= (this[i] & bm) << cbs;
    r[i - ds] = this[i] >> bs;
  }
  if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;
  r.t = this.t - ds;
  r.clamp();
}

// (protected) r = this - a
function bnpSubTo(a, r) {
  var i = 0,
    c = 0,
    m = Math.min(a.t, this.t);
  while (i < m) {
    c += this[i] - a[i];
    r[i++] = c & this.DM;
    c >>= this.DB;
  }
  if (a.t < this.t) {
    c -= a.s;
    while (i < this.t) {
      c += this[i];
      r[i++] = c & this.DM;
      c >>= this.DB;
    }
    c += this.s;
  } else {
    c += this.s;
    while (i < a.t) {
      c -= a[i];
      r[i++] = c & this.DM;
      c >>= this.DB;
    }
    c -= a.s;
  }
  r.s = c < 0 ? -1 : 0;
  if (c < -1) r[i++] = this.DV + c;
  else if (c > 0) r[i++] = c;
  r.t = i;
  r.clamp();
}

// (protected) r = this * a, r != this,a (HAC 14.12)
// "this" should be the larger one if appropriate.
function bnpMultiplyTo(a, r) {
  var x = this.abs(),
    y = a.abs();
  var i = x.t;
  r.t = i + y.t;
  while (--i >= 0) r[i] = 0;
  for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);
  r.s = 0;
  r.clamp();
  if (this.s != a.s) BigInteger.ZERO.subTo(r, r);
}

// (protected) r = this^2, r != this (HAC 14.16)
function bnpSquareTo(r) {
  var x = this.abs();
  var i = (r.t = 2 * x.t);
  while (--i >= 0) r[i] = 0;
  for (i = 0; i < x.t - 1; ++i) {
    var c = x.am(i, x[i], r, 2 * i, 0, 1);
    if (
      (r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >=
      x.DV
    ) {
      r[i + x.t] -= x.DV;
      r[i + x.t + 1] = 1;
    }
  }
  if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);
  r.s = 0;
  r.clamp();
}

// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
// r != q, this != m.  q or r may be null.
function bnpDivRemTo(m, q, r) {
  var pm = m.abs();
  if (pm.t <= 0) return;
  var pt = this.abs();
  if (pt.t < pm.t) {
    if (q != null) q.fromInt(0);
    if (r != null) this.copyTo(r);
    return;
  }
  if (r == null) r = nbi();
  var y = nbi(),
    ts = this.s,
    ms = m.s;
  var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus
  if (nsh > 0) {
    pm.lShiftTo(nsh, y);
    pt.lShiftTo(nsh, r);
  } else {
    pm.copyTo(y);
    pt.copyTo(r);
  }
  var ys = y.t;
  var y0 = y[ys - 1];
  if (y0 == 0) return;
  var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);
  var d1 = this.FV / yt,
    d2 = (1 << this.F1) / yt,
    e = 1 << this.F2;
  var i = r.t,
    j = i - ys,
    t = q == null ? nbi() : q;
  y.dlShiftTo(j, t);
  if (r.compareTo(t) >= 0) {
    r[r.t++] = 1;
    r.subTo(t, r);
  }
  BigInteger.ONE.dlShiftTo(ys, t);
  t.subTo(y, y); // "negative" y so we can replace sub with am later
  while (y.t < ys) y[y.t++] = 0;
  while (--j >= 0) {
    // Estimate quotient digit
    var qd =
      r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);
    if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {
      // Try it out
      y.dlShiftTo(j, t);
      r.subTo(t, r);
      while (r[i] < --qd) r.subTo(t, r);
    }
  }
  if (q != null) {
    r.drShiftTo(ys, q);
    if (ts != ms) BigInteger.ZERO.subTo(q, q);
  }
  r.t = ys;
  r.clamp();
  if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder
  if (ts < 0) BigInteger.ZERO.subTo(r, r);
}

// (public) this mod a
function bnMod(a) {
  var r = nbi();
  this.abs().divRemTo(a, null, r);
  if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);
  return r;
}

// Modular reduction using "classic" algorithm
function Classic(m) {
  this.m = m;
}
function cConvert(x) {
  if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
  else return x;
}
function cRevert(x) {
  return x;
}
function cReduce(x) {
  x.divRemTo(this.m, null, x);
}
function cMulTo(x, y, r) {
  x.multiplyTo(y, r);
  this.reduce(r);
}
function cSqrTo(x, r) {
  x.squareTo(r);
  this.reduce(r);
}

Classic.prototype.convert = cConvert;
Classic.prototype.revert = cRevert;
Classic.prototype.reduce = cReduce;
Classic.prototype.mulTo = cMulTo;
Classic.prototype.sqrTo = cSqrTo;

// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
// justification:
//         xy == 1 (mod m)
//         xy =  1+km
//   xy(2-xy) = (1+km)(1-km)
// x[y(2-xy)] = 1-k^2m^2
// x[y(2-xy)] == 1 (mod m^2)
// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
// JS multiply "overflows" differently from C/C++, so care is needed here.
function bnpInvDigit() {
  if (this.t < 1) return 0;
  var x = this[0];
  if ((x & 1) == 0) return 0;
  var y = x & 3; // y == 1/x mod 2^2
  y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4
  y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8
  y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16
  // last step - calculate inverse mod DV directly;
  // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
  y = (y * (2 - (x * y) % this.DV)) % this.DV; // y == 1/x mod 2^dbits
  // we really want the negative inverse, and -DV < y < DV
  return y > 0 ? this.DV - y : -y;
}

// Montgomery reduction
function Montgomery(m) {
  this.m = m;
  this.mp = m.invDigit();
  this.mpl = this.mp & 0x7fff;
  this.mph = this.mp >> 15;
  this.um = (1 << (m.DB - 15)) - 1;
  this.mt2 = 2 * m.t;
}

// xR mod m
function montConvert(x) {
  var r = nbi();
  x.abs().dlShiftTo(this.m.t, r);
  r.divRemTo(this.m, null, r);
  if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);
  return r;
}

// x/R mod m
function montRevert(x) {
  var r = nbi();
  x.copyTo(r);
  this.reduce(r);
  return r;
}

// x = x/R mod m (HAC 14.32)
function montReduce(x) {
  while (
    x.t <= this.mt2 // pad x so am has enough room later
  )
    x[x.t++] = 0;
  for (var i = 0; i < this.m.t; ++i) {
    // faster way of calculating u0 = x[i]*mp mod DV
    var j = x[i] & 0x7fff;
    var u0 =
      (j * this.mpl +
        (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) &
      x.DM;
    // use am to combine the multiply-shift-add into one call
    j = i + this.m.t;
    x[j] += this.m.am(0, u0, x, i, 0, this.m.t);
    // propagate carry
    while (x[j] >= x.DV) {
      x[j] -= x.DV;
      x[++j]++;
    }
  }
  x.clamp();
  x.drShiftTo(this.m.t, x);
  if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);
}

// r = "x^2/R mod m"; x != r
function montSqrTo(x, r) {
  x.squareTo(r);
  this.reduce(r);
}

// r = "xy/R mod m"; x,y != r
function montMulTo(x, y, r) {
  x.multiplyTo(y, r);
  this.reduce(r);
}

Montgomery.prototype.convert = montConvert;
Montgomery.prototype.revert = montRevert;
Montgomery.prototype.reduce = montReduce;
Montgomery.prototype.mulTo = montMulTo;
Montgomery.prototype.sqrTo = montSqrTo;

// (protected) true iff this is even
function bnpIsEven() {
  return (this.t > 0 ? this[0] & 1 : this.s) == 0;
}

// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
function bnpExp(e, z) {
  if (e > 0xffffffff || e < 1) return BigInteger.ONE;
  var r = nbi(),
    r2 = nbi(),
    g = z.convert(this),
    i = nbits(e) - 1;
  g.copyTo(r);
  while (--i >= 0) {
    z.sqrTo(r, r2);
    if ((e & (1 << i)) > 0) z.mulTo(r2, g, r);
    else {
      var t = r;
      r = r2;
      r2 = t;
    }
  }
  return z.revert(r);
}

// (public) this^e % m, 0 <= e < 2^32
function bnModPowInt(e, m) {
  var z;
  if (e < 256 || m.isEven()) z = new Classic(m);
  else z = new Montgomery(m);
  return this.exp(e, z);
}

// protected
BigInteger.prototype.copyTo = bnpCopyTo;
BigInteger.prototype.fromInt = bnpFromInt;
BigInteger.prototype.fromString = bnpFromString;
BigInteger.prototype.clamp = bnpClamp;
BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
BigInteger.prototype.drShiftTo = bnpDRShiftTo;
BigInteger.prototype.lShiftTo = bnpLShiftTo;
BigInteger.prototype.rShiftTo = bnpRShiftTo;
BigInteger.prototype.subTo = bnpSubTo;
BigInteger.prototype.multiplyTo = bnpMultiplyTo;
BigInteger.prototype.squareTo = bnpSquareTo;
BigInteger.prototype.divRemTo = bnpDivRemTo;
BigInteger.prototype.invDigit = bnpInvDigit;
BigInteger.prototype.isEven = bnpIsEven;
BigInteger.prototype.exp = bnpExp;

// public
BigInteger.prototype.toString = bnToString;
BigInteger.prototype.negate = bnNegate;
BigInteger.prototype.abs = bnAbs;
BigInteger.prototype.compareTo = bnCompareTo;
BigInteger.prototype.bitLength = bnBitLength;
BigInteger.prototype.mod = bnMod;
BigInteger.prototype.modPowInt = bnModPowInt;

// "constants"
BigInteger.ZERO = nbv(0);
BigInteger.ONE = nbv(1);

function main() {
  var nums = readline().split(' ');
  var decimal = `${String(
    new BigInteger(Number(nums[0])).divide(new BigInteger(Number(nums[1]))),
  ).slice(2)}0`;
  var c = nums[2];

  // console.log('decimal', decimal);
  // console.log(decimal.indexOf(c));

  print(decimal.indexOf(c) + 1);
}

main();


function main() {
  var nums = readline().split(' ');
  var decimal = `${String(
    parseFloat(Number(nums[0])).toPrecision(12) /
      parseFloat(Number(nums[1])).toPrecision(12),
  ).slice(2)}0`;
  var c = nums[2];

  // console.log('decimal', decimal);
  // console.log(decimal.indexOf(c));

  print(decimal.indexOf(c) + 1);
}

main();


var a = readline().split(" ").map(function(firstLine) { return parseInt(firstLine); });

function calc (a, b) {
	var res = 0;

	for(var i=a; i<b+1; i++) {
    var str = '' + i;
    var str_len = str.length

    for(var j=0; j<str_len; j++) {
      var item = str[j];
    	if (item == 1) {
      	res += 2;
      } else if (item == 2) || (item == 3) || (item == 5) {
      	res += 5;
      } else if (item == 4) {
      	res += 4;
      } else if (item == 0) || (item == 6) (item == 9) {
      	res += 6;
      } else if (item == 7) {
      	res += 3;
      } else if (item == 8) {
      	res += 7;
      }
    }

  }
  return res;
}

print( calc(a[0], a[1]) );


var move =function (x, y) {
    return (
        Math.min(Math.abs(26 - (x.charCodeAt(0) - y.charCodeAt(0))),
        Math.abs(x.charCodeAt(0) - y.charCodeAt(0)),
        Math.abs(-x.charCodeAt(0) + y.charCodeAt(0)),
        Math.abs(26 - (-x.charCodeAt(0) + y.charCodeAt(0)))))
}
var x=readline();
var moves=0;
x[0]=="a"?'':x="a"+x;
for (let index = 0; index < x.length-1; index++) {
    moves+= move(x[index],x[index+1]);
}


var x=readline();
var moves=0;
x[0]=="a"?'':x="a"+x;
for (let index = 0; index < x.length-1; index++) {
    moves+= Math.min(Math.abs(26 - (x[index].charCodeAt(0) - x[index+1].charCodeAt(0))),
    Math.abs(x[index].charCodeAt(0) - x[index+1].charCodeAt(0)),
    Math.abs(-x[index].charCodeAt(0) + x[index+1].charCodeAt(0)),
    Math.abs(26 - (-x[index].charCodeAt(0) + x[index+1].charCodeAt(0))));
}


var x=readline();
var moves=0;
x[0]=="a"?'':x="a"+x;
for (let index = 0; index < x.length-1; index++) {
    moves+= Math.min(Math.abs(26 - (x[index].charCodeAt(0) - x[index+1].charCodeAt(0))),
    Math.abs(x[index].charCodeAt(0) - x[index+1].charCodeAt(0)),
    Math.abs(-x[index].charCodeAt(0) + x[index+1].charCodeAt(0)),
    Math.abs(26 - (-x[index].charCodeAt(0) + x[index+1].charCodeAt(0))));
}

print(moves)


var move =function (x, y) {
    return (
        Math.min(Math.abs(26 - (x.charCodeAt(0) - y.charCodeAt(0))),
        Math.abs(x.charCodeAt(0) - y.charCodeAt(0)),
        Math.abs(-x.charCodeAt(0) + y.charCodeAt(0)),
        Math.abs(26 - (-x.charCodeAt(0) + y.charCodeAt(0)))))
}
var x=readline();
var moves=0;
x[0]=="a"?'':x="a"+x;
for (let index = 0; index < x.length-1; index++) {
    moves+= move(x[index],x[index+1]);
}
print(moves)


class Node {
        constructor(val) {
          this.val = val;
          this.next = null;
        }
      }

      class SinglyLinkedList {
        constructor() {
          this.head = null;
          this.tail = null;
          this.length = 0;
        }

        push(val) {
          let newNode = new Node(val);
          if (!this.head) {
            this.head = newNode;
            this.tail = this.head;
          } else {
            this.tail.next = newNode;
            this.tail = newNode;
          }
          this.length++;
          return this;
        }

        reverse() {
          var node = this.head;
          this.head = this.tail;
          this.tail = node;
          var next;
          var prev = null;
          for (var i = 0; i < this.length; i++) {
            next = node.next;
            node.next = prev;
            prev = node;
            node = next;
          }
          return this;
        }

        print() {
          let arr = [];
          let current = this.head;
          while (current) {
            arr.push(current.val);
            current = current.next;
          }
          return arr;
        }
      }

      var fword = readline().split("");
      var sword = readline().split("");

      var list = new SinglyLinkedList();
      for (let j = 0; j < fword.length; j++) {
        list.push(fword[j]);
      }
      const placeholder = list.print();
      list.reverse();
      const reversedWord = list.print();

      if (
        fword.join("") == placeholder.join("") &&
        sword.join("") == reversedWord.join("")
      ) {
        print("YES");
      } else {
        print("NO");
      }


print(answer({
    t: readline(),
    s: readline()
}));

function answer({t, s}){
    return t.split('').reverse().join('') == s? 'YES':'NO';
}


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let first = prompt().split("");
      let second = prompt().split("");
      if (first == second.reverse()) {
        console.log("YES");
      } else {
        console.log("No");
      }
    </script>
  </body>
</html>


function main(){
    var n = readline();
    var s = readline();
    var ot = "YES"
    if n.length == s.length{
        for  (var j = 0; j < n.length; j++){
            if(s[i] != n[n.length - i-1])ot = "NO";
        }
    }
    else print("NO");
}
main();


var s1=readline();
var s2=readline();
var k=true;
 s2.reverse();
 for(var i=0;i<s1.length;i++)
  if(s1[i]!=s2[s1.length-1-i]) k=false;
 print(k===true)?"YES":"NO");


class Node {
        constructor(val) {
          this.val = val;
          this.next = null;
        }
      }

      class SinglyLinkedList {
        constructor() {
          this.head = null;
          this.tail = null;
          this.length = 0;
        }

        push(val) {
          var newNode = new Node(val);
          if (!this.head) {
            this.head = newNode;
            this.tail = this.head;
          } else {
            this.tail.next = newNode;
            this.tail = newNode;
          }
          this.length++;
          return this;
        }

        reverse() {
          var node = this.head;
          this.head = this.tail;
          this.tail = node;
          var next;
          var prev = null;
          for (var i = 0; i < this.length; i++) {
            next = node.next;
            node.next = prev;
            prev = node;
            node = next;
          }
          return this;
        }

        print() {
          var arr = [];
          var current = this.head;
          while (current) {
            arr.push(current.val);
            current = current.next;
          }
          return arr;
        }
      }

      var fword = readline().split("");
      var sword = readline().split("");

      var list = new SinglyLinkedList();
      for (var j = 0; j < fword.length; j++) {
        list.push(fword[j]);
      }
      const placeholder = list.print();
      list.reverse();
      const reversedWord = list.print();

      if (
        fword.join("") == placeholder.join("") &&
        sword.join("") == reversedWord.join("")
      ) {
        print("YES");
      } else {
        print("NO");
      }


function main()
{
    var nRr = readline();
    nRr = nRr.split(" ");
    var R = parseInt(nRr[1]);
    var r = parseInt(nRr[2]);
    if(r > R){print("NO");
    if(R == r && parseInt(nRr[0]) <= 1){print("YES"); return;}
    else if (R == r && parseInt(nRr[0]) > 1){print("NO"); return;}
    var max = (2*Math.PI) / Math.acos((-2*Math.pow(r, 2) + Math.pow((R-r), 2)) / Math.pow((R-r), 2));
    if(parseInt(nRr[0]) <= Math.floor(max)){print("YES");}
    else {print("NO");}
}
main();


function main()
{
    var nRr = readline();
    nRr = nRr.split(" ");
    var R = parseInt(nRr[1]);
    var r = parseInt(nRr[2]);
    if(r > R){print9"NO");
    if(R == r && parseInt(nRr[0]) <= 1){print("YES"); return;}
    else if (R == r && parseInt(nRr[0]) > 1){print("NO"); return;}
    var max = (2*Math.PI) / Math.acos((-2*Math.pow(r, 2) + Math.pow((R-r), 2)) / Math.pow((R-r), 2));
    if(parseInt(nRr[0]) <= Math.floor(max)){print("YES");}
    else {print("NO");}
}
main();


str = readline();
print(str);
let q = 0;
let qa = 0;
let qaq = 0;
for (let i=0; i < str.length; i++) {
	if (str[i] === 'Q') {
		q++;
	}
	if (q > 0 && str[i] == 'A') {
		qa+= q;
	}
	if (qa > 0 && str[i] === 'Q') {
		qaq+= qa;
	}
}
print(qaq);


str = readline();
let q = 0;
let qa = 0;
let qaq = 0;
for (let i=0; i < str.length; i++) {
	if (str[i] === 'Q') {
		q++;
	}
	if (q > 0 && str[i] == 'A') {
		qa+= q;
	}
	if (qa > 0 && str[i] === 'Q') {
		qaq+= qa;
	}
}
print(qaq);


function main(){

var line = readline().split('').map(Number);
var n = line[0];

var cancount = 1;
var person = 0;
var round = 1;
var roundcans = 0;
var ppround = 5;

while(cancount<=n){
    if(cancount === n){
	printf('Sheldon');
	return;
    }
    cancount+=ppround;
    round+=1;
    ppround *=2;
}

ppround /=2;
cancount-=ppround;
round-=1;
cancount-=1;
int cpr = 1;

for(i=1;i<round;i++){
    cpr*=2;
}

while(cancount<n){
    cancount+=1;
    roundcans+=1;
    if(roundcans>cpr){
	person+=1;
	roundcans=1;
    }
}

if(person===0){
    print('Sheldon');
    return;
}

if(person === 1){
    print('Leonard');
    return;
}

if(person === 2){
    print('Penny');
    return;
}

if(person === 3){
    print('Rajesh');
    return;
}

if(person === 4){
    print('Howard');
    return;
}

}

main();


function (){
    const z = readline().split().map(String);
    const x = readline().split().map(String);
    let y = 0;
    for (let i=0; i <= x.length - 1; i++){
        if(x[i][0] == n[0] || x[i][1] == n[1]){
            y = y + 1;
        }
    }
    if(y===0){
        print('NO');
    }else{
        print('Yes');
    }
    }


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

const solution = (cardOnTable, cardsInHand) => {
  if (cardsInHand.indexOf(cardOnTable[0]) >= 0 || cardsInHand.indexOf(cardOnTable[1]) >= 0){
	return "YES";
  } else {
	return "NO";
  }
};


var t = readline().split(" ");
var n = Number(t[0]);
var y = Number(t[1]);
if(n == y){
    print(n)''
}
else{
    print("1");
}


var p = function(a,b){
	for(i=0;i<b;i++{
		if(b % a == 0){
			return a;
		}
		else{
			if (b == 0)
				return a;
			return p(b, a % b);
		}
		a++;
	}
}
var y = readline().split(" ");
var g = y[0];
var u = y[1];
print(p(g,u));


function main(){

    /* Couldn't figure out how to get path for this brute forces recursion solution, ask Tigran */
    function solutionFirst(a, b){
        let startingNo = a;
        let targetNo = b;

        if(startingNo > targetNo){
            return false;
        }
        if(startingNo === targetNo){
            return true;
        }
        return solutionFirst(2*startingNo, targetNo) || solutionFirst(10*startingNo + 1, targetNo)
    }

    function lastDigitOne(someNo){
        let lastDigit = +someNo.toString().split('').pop();
        return lastDigit === 1;
    }

    let path = [];
    function solution(a, b){
        let c = b;
        while(c > a){
            if(c % 2 === 0) {
                path.push(c);
                c = c/2;
            } else if (lastDigitOne(c)){
                path.push(c);
                c = (c - 1)/10
            }
            else {
                return false;
            }
        }
        if(c === a){
            path.push(a);
            return true;
        } else {
            path = [];
            return false;
        }
    }

    const line1 = readline().split(" ");
    const a = parseInt(line1[0]);
    const b = parseInt(line1[1]);

    let s = solution(a, b);

    if(!s){
        print("NO");
    }
    else {
        print("YES");
        print(path.length);
        let someString = "";
        for(let i = 0; i < path.length; i++){
            someString += path[path.length - 1 - i];
            if(i < path.length - 1){
                someString += " ";
            }

        }
        print(someString);
    }
}

main();


function main(){

    /* Couldn't figure out how to get path for this brute forces recursion solution, ask Tigran */
    function solutionFirst(a, b){
        let startingNo = a;
        let targetNo = b;

        if(startingNo > targetNo){
            return false;
        }
        if(startingNo === targetNo){
            return true;
        }
        return solutionFirst(2*startingNo, targetNo) || solutionFirst(10*startingNo + 1, targetNo)
    }

    function lastDigitOne(someNo){
        let lastDigit = +someNo.toString().split('').pop();
        return lastDigit === 1;
    }

    let path = [];
    function solution(a, b){
        let c = b;
        while(c > a){
            if(c % 2 === 0) {
                path.push(c);
                c = c/2;
            } else if (lastDigitOne(c)){
                path.push(c);
                c = (c - 1)/10
            }
            else {
                return false;
            }
        }
        if(c === a){
            path.push(a);
            return true;
        } else {
            path = [];
            return false;
        }
    }

    const line1 = readline().split(" ");
    const a = parseInt(line1[0]);
    const b = parseInt(line1[1]);

    let s = solution(a, b);

    if(!s){
        print("NO");
    }
    else {
        print("YES");
        print(path.length);
        let someString = "";
        for(let i = 0; i < path.length; i++){
            someString += path[path.length - 1 - i];
            if(i < path.length - 1){
                someString += " ";
            }

        }
        print(someString);
    }
}


var values = readline().split(' ').map(Number);

var n = values[0];
var m = values[1];

var sum = 0;

for (let i = 1; i <= n; i++) {
    for (let j = 0; j <= 5; j++) {
        if ((i % 5) + j === 5) {
            sum += Math.floor((m - j) / 5) + 1;
        }
    }
}

print(sum);


var values = readline().split(' ').map(Number);

var n = values[0];
var m = values[1];

var first = Math.min(n, 4);
var fval;

var sum = 0;

for (let i = 1; i <= n; i++) {
    for (let j = 1; j <= first; j++) {
        if (i + j === 5) {
            fval = j;
            sum += Math.floor((m - fval) / 5) + 1;
        }
    }
}

print(sum);


var values = readline().split(' ').map(Number);

var n = values[0];
var m = values[1];

var first = n >= 4? 4: n; // pick upto max of 4
var fval;

var sum = 0;

for (let i = 1; i < n; i++) {
    for (let j = 1; j < first; j++) {
        if (i + j === 5) {
            fval = j;
            sum += Math.floor((m - fval) / 5) + 1;
            break;
        }
    }
}

print(sum);


var x = readline().trim(), y = readline();
for (let i = 0; i < x.length; i++) {
    if (x[i] < y[i]) {
        y = '-1';
        break
    }
}
print(y);


var t = readline().split(' ')
var y = t[0]
var b = t[1]
var r = t[2]
var res = r;

if b < (r-1) then res = b + 1;
res = res + b;

if y < (b-1) then res = y+1 + y+2;
res = res + y;

print(res);


var y, b, r;

y = readline();
b = readline();
r = readline();

var res;

res=r;

if b < (r-1) then res = b + 1;
res = res + b;

if y < (b-1) then res = y+1 + y+2;
res = res + y;

write(res);


let jt = Number(readline()) % 4;
if(jt === 0){
    write("1 A");
}
else if(jt == 1){
    write("0 A");
}
else if(jt == 2){
    write("1 B");
}
else
    write("2 A");


function div64(strn) {
  if (strn.length < 7)
    return 'no'
  // 1000000 === 64
  var zeros = 0
  for (let i = strn.length - 1; i >= 0; i--)
    if (strn[i] === '1' && zeros >= 6)
      return 'yes'
    else if (strn[i] === '0')
      zeros++
  return 'no'
}

function main() {
  var line = readline().split(' ')[0]
  print(div64(line))
}

main()


function binStr(bs) {
  if (bs.length < 7) return "no";
  let tot = 0;
  for (let i = bs.length-1, j = 0; i >= 0; i--, j++) {
    tot += bs[i] * Math.pow(2, j);
  }
  if (tot <= 64) return "no";
  return "yes";
}


let input = readline().split(' ');
let name = input[0];
let surname = input[1];

let i = 1;
for (; i < name.length && name.charCodeAt(i) < surname.charCodeAt(0); i++) {}
write(name.substr(0, i) + surname.charAt(0));


function main(){
  var line = readline().split(" ");
  var firstName = line[0];
  var lastName = line[1];

  var min_sub = firstName.concat(lastName);
  for(let i = 1; i < firstName.length + 1; i++) {
    for(let j = 1; j < lastName.length + 1; j++) {
      var str = firstName.substr(0,i).concat(lastName.substring(0,j));
      // print(str);
      if (str < min_sub) min_sub = str;
    }
  }

  print(min_sub);
  return 0
}

main()


function getAns(k,l,m,n,d){
    var dead = new Array(d+2);
    for (let i=1;i<=d;i++)
        dead[i]=false;
    var ans=0;
    for (let i=1;i<=d;i++){
        if (i%k===0||i%l===0||i%m===0||i%n===0){
            if (dead[i]===false){
                ans++;
                dead[i]=true;
            }
        }
    }
    return ans;
}

var r=readline;
var k=+r(),l=+r(),m=+r(),n=+r(),d=+r();
print(getAns(k,l,m,n,d));


function getAns(k,l,m,n,d){
    var dead = new Array(d+2);
    for (let i=1;i<=d;i++)
        dead[i]=false;
    var ans=0;
    for (let i=1;i<=d;i++){
        if (i%k===0||i%l===0||i%m===0||i%n===0){
            if (dead[i]===false){
                ans++;
                dead[i]=true;
            }
        }
    }
    return ans;
}

var input=+readline().split(' ');
var k=input[0],l=input[1],m=input[2],n=input[3],d=input[4];
print(getAns(k,l,m,n,d));


var k = parseInt(readline());
var l= parseInt(readline());
var m= parseInt(readline());
var n= parseInt(readline());
var d= parseInt(readline());
var arr= [k,l,m,d];
var output = [];
arr.forEach(e=>{
    Array.from({length:d}, (_,i)=>i+1).forEach(x=>{
        if(x%e === 0){
            output.push(x)
        }
    })

})

print((...output.filter((v,i,a)=>a.indexOf(v)===i)).reduce((a,b)=>a+b,0));


var n = readline();
var group_a = readline().split(' ');
var group_b = readline().split(' ');

funtion solve(a, b) {
    var rlt = {};

    a.forEach(str => {rlt[str] ++;})
    b.forEach(str => {rlt[str] --;})

    var r = 0;
    for (var key in rlt) {
        if (rlt[key]%2)
            return -1
        r += Math.abs(rlt[key])/2
    }
    return r
}

print(solve(group_a, group_b))


const line = readline().split(' ').map(_ => Number(_));
const log = () => {};

// const line = '6 10 2 4'.split(' ').map(_ => Number(_));
// const print = console.log;
// const log = console.log;

const [a, b, f, k] = line;

let count = k;
let position = 1;
let amount = b;
let refill = 0;

if (amount < f || amount < a - f) {
  // log("can't make it", { amount, f, a });
  print(-1);
} else {
  while (count > 0) {
    const needToTurnBack = count > 1;
    if (position === 1) {
      log('pos A:', { amount, count });
      position = 2;
      count--;
      if (needToTurnBack) {
        if (amount < 2 * a - f) {
          log('refill');
          refill += 1;
          amount = b - (a - f);
        } else {
          log('skip');
          amount -= a;
        }
      } else {
        if (amount < a) {
          log('last refill');
          refill += 1;
          amount = b - (a - f);
        } else {
          log('last skip');
        }
      }
      log('pos B:', { amount, count });
      continue;
    }
    if (position === 2) {
      log('pos B:', { amount, count });
      position = 1;
      count--;
      if (needToTurnBack) {
        if (amount < a + f) {
          log('refill');
          refill += 1;
          amount = b - f;
        } else {
          log('skip');
          amount -= a;
        }
      } else {
        if (amount < a) {
          log('last refill');
          refill += 1;
          amount = b - f;
        } else {
          log('last skip');
        }
      }
      log('pos A:', { amount, count });
    }
  }
  print(refill);
}


var  input=readline();

var m= input.split(' ')[0]
var n= input.split(' ')[1]

if(n%m!==0) {
print(-1)
return
}
var count= 0;
var divided =n/m
reqursion(divided)

function reqursion(divided) {
if(divided===1) {print(count) return}
if(divided%3===0) {
count++;
reqursion(divided/3)
return
}
if(divided%2===0) {
count++;
reqursion(divided/2)
return
}
print(-1)
return
}


var  input=readline();

var m= input.split(' ')[0]
var n= input.split(' ')[1]

if(n%m!==0) {
print(-1)

}
 let count= 0;
let divided =n/m
print(7)


function main(){
       var line = readline().split(' ');
       var a = line[0];
       var b = line[1];

       var one = parseInt(a);
       var two = parseInt(b);
       if(two > one){
              var [one,two] = [two,one];
       }
       if(one%two != 0 ){
            console.log(-1);
       }
      else{
            chuone(one/two,0);
       }
}

function chuone(a,sum){
    if(a == 1){
        //console.log(0);
        print(0);
        return;
    }
    if((a/2 == 1 && a%2 == 0) || (a/3 == 1 && a%3 == 0)){
        sum++;
        print(sum);
        //console.log(sum);
        return;
    }
    if(a%2 != 0 && a%3 != 0){
        print(-1);
        //console.log(-1);
    }
    else if(a%2 == 0){
        a = a/2;
        sum++;
        chuone(a,sum);
    }
    else if(a%3 == 0){
        a = a/3;
        sum++;
        chuone(a,sum);
    }
}


var  input=readline();

function reqursion(divided) {
if(divided===1) {return}
if(divided%3===0) {
count++;
reqursion(divided/3)
return
}
if(divided%2===0) {
count++;
reqursion(divided/2)
return
}
print(-1)
return
}
var m= input.split(' ')[0]
var n= input.split(' ')[1]

if(n%m!==0) {
print(-1)
return
}
 let count= 0;
let divided =n/m
reqursion(divided)
print(count)


var  input=readline();

var m= input.split(' ')[0]
var n= input.split(' ')[1]

if(n%m!==0) {
print(-1)
return
}
 let count= 0;
let divided =n/m
reqursion(divided)
print(count)

function reqursion(divided) {
if(divided===1) {return}
if(divided%3===0) {
count++;
reqursion(divided/3)
return
}
if(divided%2===0) {
count++;
reqursion(divided/2)
return
}
print(-1)
return
}


var  input=readline();
function reqursion(divided) {
if(divided===1) {print(count)}
if(divided%3===0) {
count++;
reqursion(divided/3)

}
if(divided%2===0) {
count++;
reqursion(divided/2)

}
print(-1)

}
var m= input.split(' ')[0]
var n= input.split(' ')[1]

if(n%m!==0) {
print(-1)

}
 let count= 0;
let divided =n/m
reqursion(divided)


var line = readline().split(' ');
var a = line[0];
var b = line[1];

// print(parseInt(a)+parseInt(b);

var one = parseInt(a);
var two = parseInt(b);
if(two > one){
    var [one,two] = [two,one];
}
if(one%two != 0 ){
    console.log(-1);
}
else{
    chuone(one/two,0);
}
function chuone(a,sum){
    if(a == 1){
        //console.log(0);
        print(0);
        return;
    }
    if((a/2 == 1 && a%2 == 0) || (a/3 == 1 && a%3 == 0)){
        sum++;
        print(sum);
        //console.log(sum);
        return;
    }
    if(a%2 != 0 && a%3 != 0){
        print(-1);
        //console.log(-1);
    }
    else if(a%2 == 0){
        a = a/2;
        sum++;
        chuone(a,sum);
    }
    else if(a%3 == 0){
        a = a/3;
        sum++;
        chuone(a,sum);
    }
}


var  input=readline();

var m= input.split(' ')[0]
var n= input.split(' ')[1]

if(n%m!==0) {
print(-1)

}
 let count= 0;
let divided =n/m
reqursion(divided)

function reqursion(divided) {
if(divided===1) {print(count)}
if(divided%3===0) {
count++;
reqursion(divided/3)

}
if(divided%2===0) {
count++;
reqursion(divided/2)

}
print(-1)

}


declare const process: any;

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

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

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

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

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

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

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

    console.log(ans);
});

// input helper

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


var num = readline().split(" ").map(x => parseInt(x)); // num will be an array [1,2,3]
var a = num[0];
var b = num[1];
var c = num[2];
var result = [];
var count = 0;

for (var i = 1; i < 81; i++) {
     if (i == ((b*i**a))+c) {
          result.push(i);
          count++;
     }
}

print(count);
result.forEach(element => print(count));


var num = readline().split(" ").map(x => parseInt(x)); // num will be an array [1,2,3]
var a = num[0];
var b = num[1];
var c = num[2];
var result = [];
var count = 0;

for (var i = 1; i < 81; i++) {
     var buf = (b * i ** a) + c;
     var sumBufNumbers = buf.toString().split('').reduce(function(a,b){
          return +a + +b;
     });
     if (buf > 0 && buf < (10 ** 9) && i == sumBufNumbers) {
          result.push(buf);
          count++;
     }
}

print(count);
result.forEach(element => print(element));


var num = readline().split(" ").map(x => parseInt(x)); // num will be an array [1,2,3]
var a = num[0];
var b = num[1];
var c = num[2];
var result = [];
var count = 0;

for (var i = 1; i < 81; i++) {
     var buf = (b * i ** a) + c;
     var sumBufNumbers = buf.toString().split('').reduce(function(a,b){
          return +a + +b;
     });
     if (buf > 0 && buf < (10 ** 9) && i == sumBufNumbers) {
          result.push(buf);
          count++;
     }
}
//
print(count);
result.forEach(element => print(element));


var num = readline().split(" ").map(x => parseInt(x)); // num will be an array [1,2,3]
var a = num[0];
var b = num[1];
var c = num[2];
var result = [];
var count = 0;

for (let i = 1; i < 81; i++) {
     var buf = (b * i ** a) + c;
     var sumBufNumbers = buf.toString().split('').reduce(function(a,b){
          return +a + +b;
     });
     if (buf > 0 && buf < (10 ** 9) && i == sumBufNumbers) {
          result.push(buf);
          count++;
     }
}
//
print(count);
result.forEach(element => print(element));


const len = parseInt(readline());
const numbers = readline().split(" ").map( x => parseInt(x));

let dict = {};

numbers.forEach((x, i) => {
  dict[i] = x;
});

print(dict);


ar count, i, j, k, l, m, n, o, p, palindrome, pp, q, ref, ref1, ref2, ref3, ref4;

readline(s);

n = s.length;

pp = [];

count = [];

for (l = j = 1, ref = n; 1 <= ref ? j <= ref : j >= ref; l = 1 <= ref ? ++j : --j) {
  count[l] = 0;
  for (i = m = 0, ref1 = n - l; 0 <= ref1 ? m <= ref1 : m >= ref1; i = 0 <= ref1 ? ++m : --m) {
    pp[l * n + i] = (l === 1 ? 1 : 0);
  }
}

count[1] += n;

palindrome = function(i, l) {
  return pp[l * n + i];
};

for (l = o = 2, ref2 = n; 2 <= ref2 ? o <= ref2 : o >= ref2; l = 2 <= ref2 ? ++o : --o) {
  for (i = p = 0, ref3 = n - l; 0 <= ref3 ? p <= ref3 : p >= ref3; i = 0 <= ref3 ? ++p : --p) {
    if (s[i] === s[i + l - 1] && (l === 2 || palindrome(i + 1, l - 2))) {
      k = 1 + palindrome(i, Math.floor(l / 2));
      pp[l * n + i] = k;
      count[k] += 1;
    }
  }
}

for (i = q = ref4 = n - 2; q >= 0; i = q += -1) {
  count[i] += count[i + 1];
}

print(count.slice(1).join(' '));


var tiles = readline().split(" ");

if (isKoutsu(tiles) || isShuntsu(tiles))
    print("0")
else {
    var koutsuRepairCount = correctForKoutsu(tiles);
    var shuntsuRepairCount = correctForShuntsu(tiles);

    print(Math.min(koutsuRepairCount, shuntsuRepairCount));
}

/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
function isKoutsu(tiles) {
    return (tiles[0] === tiles[1] && tiles[1] === tiles[2]);
}

function isShuntsu(tiles) {
    tiles.sort();
    return isSameSuit(tiles[0], tiles[1], tiles[2]) && isSequential(tiles[0], tiles[1], tiles[2]);
}

function isSameSuit(tile1, tile2, tile3) {
    return (tile1.charAt(1) == tile2.charAt(1) && tile2.charAt(1) == tile3.charAt(1));
}

function isSequential(tile1, tile2, tile3) {
    var diff1 = Math.abs(parseInt(tile1.charAt(0)) - parseInt(tile2.charAt(0))) == 1;
    var diff2 = Math.abs(parseInt(tile2.charAt(0)) - parseInt(tile3.charAt(0))) == 1;

    return diff1 && diff2;

}

function correctForShuntsu(tiles) {

    var groups = {};

    tiles.forEach(function (tile) {
        var suit = tile.charAt(1);
        var digit = parseInt(tile.charAt(0));

        if (!groups.hasOwnProperty(suit)) {
            groups[suit] = [];
        }
        groups[suit].push(digit);
        groups[suit].sort();
    });

    var consecutive = false;

    for (var [suit, digits] of Object.entries(groups)) {
        if (digits.length == 2) {
            consecutive = (Math.abs(digits[0] - digits[1]) == 1) || (Math.abs(digits[0] - digits[1]) == 2);
        }
    }

    return consecutive ? 1 : 2;
}

function correctForKoutsu(tiles) {

    var set = new Set(tiles);
    var len = set.size;

    return (len == tiles.length) ? 2 : (tiles.length - len);

}


var tiles = readline().split(" ");

if (isKoutsu(tiles) || isShuntsu(tiles))
    print("0")
else {
    var koutsuRepairCount = correctForKoutsu(tiles);
    var shuntsuRepairCount = correctForShuntsu(tiles);

    print(Math.min(koutsuRepairCount, shuntsuRepairCount));
}

/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
function isKoutsu(tiles) {
    return (tiles[0] === tiles[1] && tiles[1] === tiles[2]);
}

function isShuntsu(tiles) {
    tiles.sort();
    return isSameSuit(tiles[0], tiles[1], tiles[2]) && isSequential(tiles[0], tiles[1], tiles[2]);
}

function isSameSuit(tile1, tile2, tile3) {
    return (tile1.charAt(1) == tile2.charAt(1) && tile2.charAt(1) == tile3.charAt(1));
}

function isSequential(tile1, tile2, tile3) {
    var diff1 = Math.abs(parseInt(tile1.charAt(0)) - parseInt(tile2.charAt(0))) == 1;
    var diff2 = Math.abs(parseInt(tile2.charAt(0)) - parseInt(tile3.charAt(0))) == 1;

    return diff1 && diff2;

}

function correctForShuntsu(tiles) {

    var groups = {};

    tiles.forEach(function (tile) {
        var suit = tile.charAt(1);
        var digit = parseInt(tile.charAt(0));

        if (!groups.hasOwnProperty(suit)) {
            groups[suit] = [];
        }
        groups[suit].push(digit);
        groups[suit].sort();
    });

    var consecutive = false;

    for (const [suit, digits] of Object.entries(groups)) {
        if (digits.length == 2) {
            consecutive = (Math.abs(digits[0] - digits[1]) == 1) || (Math.abs(digits[0] - digits[1]) == 2);
        }
    }

    return consecutive ? 1 : 2;
}

function correctForKoutsu(tiles) {

    var set = new Set(tiles);
    var len = set.size;

    return (len == tiles.length) ? 2 : (tiles.length - len);

}


import java.util.*;
public Class A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] arr = new int[n];
        for(int i=0; i<m; ++i) {
            int x = sc.nextInt();
            if(arr[x-1]==0) arr[x-1]=x;
            else break;
        }
        for(int i=0; i<n; ++i) System.out.print(arr[i] + " ");
    }
}


// 535A     Тавас и Нафас

var n = parseInt(readline());

// var input_line = readline().split(' ').map(Number);

var out = '';
var arr = [];

arr[0] = 'zero';
arr[1] = 'one';
arr[2] = 'two';
arr[3] = 'three';
arr[4] = 'four';
arr[5] = 'five';
arr[6] = 'six';
arr[7] = 'seven';
arr[8] = 'eight';
arr[9] = 'nine';
arr[10] = 'ten';
arr[11] = 'eleven';
arr[12] = 'twelve';
arr[13] = 'thirteen';
arr[14] = 'fourteen';
arr[15] = 'fifteen';
arr[16] = 'sixteen';
arr[17] = 'seventeen';
arr[18] = 'eighteen';
arr[19] = 'nineteen';
arr[20] = 'twenty';
arr[30] = 'thirty';
arr[40] = 'forty';
arr[50] = 'fifty';
arr[60] = 'sixty';
arr[70] = 'seventy';
arr[80] = 'eighty';
arr[90] = 'ninety';

if ((n <= 20) or ((n % 10) == 0)) {
    out += arr[n] + '\n';
} else {
    var x = n.toString().substring(0, 1) + '0';
    x = parseInt(x);
    out += arr[x] + '-' + arr[n-x] + '\n';
}

print(out);


#!/usr/bin/rhino
importPackage(java.io);
var stdin = new BufferedReader( new InputStreamReader(java.lang.System['in']) );
var l0 = ["zero","one","two","three","four","five","six","seven","eight","nine","ten",
             "eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"];
var l1 =["twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];
n=parseInt(stdin.readLine());
if(n < 20){
    print(l0[n]);
}else{
    var m=n%10;
    var t=(n-m)/10;
    if(m==0){
	print(l1[t-2]);
    }else{
	print(l1[t-2]+"-"+l0[m]);
    }
}


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

let line = 0;
let count;
let years = [];
const calc = () => {
    let x = Math.max.apply(null, years.map(function(el) {
        return Math.min.apply(null, years.map(function(year) {
            let delta = Math.abs(parseInt(year) - parseInt(el));
            return delta > 0 ? delta : Infinity;
        }));
    }));
    console.log(years.filter(function(el) {
        let year = years.reduce(function(prev, cur) {
            if (Math.abs(el - parseInt(cur)) <= x) {
                return prev && true;
            } else {
                return prev && false;
            }
        }, true);
        if (year) return el;
    })[0]);
    process.exit();
};

rl.on('line', function(input) {
    if (line === 0) {
        count = input;
        line++;
    } else {
        years = input.split(' ');
        calc();
    }
});


/**
 * Created by lukask on 9/24/17.
 */
var readLine = require('readline');

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

function isPalindrome(number) {
  let i = 0;
  for (i = 0; i < number.length / 2; i++) {
    // console.log(number[i] + ' === ' + number[number.length - i - 1]);
    if (number[i] !== number[number.length - i - 1]) {
      return false;
    }
  }
  return true;
}

function isQuasiPalindrome(number) {
  if (isPalindrome(number)) {
    return 'YES';
  }
  let zeroesInFront = 0;
  let zeroesInBack = 0;
  let i = 0;
  while (number[i] === '0') {
    i++;
  }
  zeroesInFront = i;
  i = number.length - 1;
  while (number[i] === '0') {
    i--;
  }
  zeroesInBack = number.length - i - 1;
  if (zeroesInFront > zeroesInBack) {
    // console.log(zeroesInFront + '  ' + zeroesInBack);
    return 'NO';
  }
  number = number.substring(0, number.length - (zeroesInBack - zeroesInFront));
  // console.log(number);
  if (isPalindrome(number)) {
    return 'YES'
  }
  // console.log(zeroesInBack);
  return 'NO';
}

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


var s=String(readline());
var num=[];
var res=[];
for(let i=0;i<s.length;i++){
  num.push(parseInt(s[i]));
}
while(true){
  var tmps="";
  for(let i=0;i<num.length;i++){
      var v=num[i];
    if (v > 0){
      num[i]-=1;
      tmps+="1";
    }else{
      tmps+="0";
	}
  }
  res.push(parseInt(tmps));
  if(num.every(function(elem){return elem==0;})){
    break;
  }
}
print (res.length);
print (res.join(" "));


// const io = require('../lol-io.js');
// const readline = io.readline;
// const print = io.print;

function f(x) {
    x++;
    while (x % 10 === 0) {
        x /= 10;
    }

    return x;
}

let x = Number(readline());
const used = {};
let count = 0;

while (!used[x]) {
    used[x] = true;
    ++count;

    x = f(x);
};

print(count);


// const io = require('../lol-io.js');
// const readline = io.readline;
// const print = io.print;

function f(x) {
    x++;
    while (x % 10 === 0) {
        x /= 10;
    }

    return x;
}

let x = Number(readline());
const used = {};
let count = 0;

while (!used[x]) {
    used[x] = true;
    ++count;

    x = f(x);
};

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

// readline.on('line', (input) => {
//     print(input);
// });


const io = require('../lol-io.js');
const readline = io.readline;
const print = io.print;

function f(x) {
    x++;
    while (x % 10 === 0) {
        x /= 10;
    }

    return x;
}

let x = Number(readline());
const used = {};
let count = 0;

while (!used[x]) {
    used[x] = true;
    ++count;

    x = f(x);
};

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

// readline.on('line', (input) => {
//     print(input);
// });


print('white\n0 1' if int(input()) % 2 == 0 else 'black')


var input = parseint(readline());
var str = "":
for(int i=1; i<= input; ++i){
    s = s.concat(i);
}
print(s.charAt(n-1));


var input = parseInt(readline());
var str = "":
for(int i=1; i<= input; ++i){
    s = s.concat(i);
}
print(s.charAt(n-1));


#!/usr/bin/node
// Problem http://codeforces.com/contest/476/problem/B#_=_

"use strict";
const readline = require('readline');

function calculateProb(s1, s2) {
    var possibilties = [];
    calculatePossibilities(s2, 0, [], possibilties);

    var d = destinationNum(s1);
    var successCount = 0;
    for(var i = 0; i<possibilties.length; i++) {
        var dt = destinationNum(possibilties[i]);
        if(dt === d) {
            successCount ++;
        }
    }

    return ((successCount * 1.0) / (possibilties.length * 1.0));
}

function destinationNum(s1) {
    var current = 0;
    for(var i = 0; i<s1.length; i++) {
        current += s1.charAt(i) === "+" ? 1 : -1;
    }

    return current;
}

function calculatePossibilities(s2, i, soFar, posibilities) {
    if(s2.length === i) {
        posibilities.push(soFar.join(''));
        return;
    }

    if (s2.charAt(i) === "?") {
        soFar[i] = "+"
        calculatePossibilities(s2, i + 1, soFar, posibilities);
        soFar[i] = "-";
        calculatePossibilities(s2, i + 1, soFar, posibilities);
    } else {
        soFar[i] = s2.charAt(i);
        calculatePossibilities(s2, i + 1, soFar, posibilities);
    }
}

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

rl.on("line", (s1) => {
    rl.on("line", (s2)=> {
        rl.write(calculateProb(s1, s2)+ "");
        rl.close();
    })
})


#!/usr/bin/node
// Problem http://codeforces.com/contest/476/problem/B#_=_

"use strict";

function calculateProb(s1, s2) {
    var possibilties = [];
    calculatePossibilities(s2, 0, [], possibilties);

    var d = destinationNum(s1);
    var successCount = 0;
    for(var i = 0; i<possibilties.length; i++) {
        var dt = destinationNum(possibilties[i]);
        if(dt === d) {
            successCount ++;
        }
    }

    return ((successCount * 1.0) / (possibilties.length * 1.0));
}

function destinationNum(s1) {
    var current = 0;
    for(var i = 0; i<s1.length; i++) {
        current += s1.charAt(i) === "+" ? 1 : -1;
    }

    return current;
}

function calculatePossibilities(s2, i, soFar, posibilities) {
    if(s2.length === i) {
        posibilities.push(soFar.join(''));
        return;
    }

    if (s2.charAt(i) === "?") {
        soFar[i] = "+"
        calculatePossibilities(s2, i + 1, soFar, posibilities);
        soFar[i] = "-";
        calculatePossibilities(s2, i + 1, soFar, posibilities);
    } else {
        soFar[i] = s2.charAt(i);
        calculatePossibilities(s2, i + 1, soFar, posibilities);
    }
}

var s1 = readline();
var s2 = readline();

print(calculateProb(s1, s2));


let numbers = readline().split(" ").map(function(x) { return parseInt(x); });

// let numbers = [99]

let digits = String(numbers[0]).split("");

function check(digits) {
    let sum = digits.reduce((a, b) => +a + +b);
    return sum%4;
}

while (check(digits)) {
    let nun = parseInt(digits.join(""));
    nun++;
    digits = String(nun).split("");
}

let result = digits.join("");

// console.log(result);

print(result);


let numbers = readline().split(" ").map(function(x) { return parseInt(x); });

let digits = String(numbers[0]).split("");

function check(digits) {
    let sum = digits.reduce((a, b) => +a + +b);
    return sum%4;
}

while (check(digits)) {
    let nun = parseInt(digits.join(""));
    nun++;
    digits = String(nun).split("");
}

let result = parseInt(digits.join(""));

write(result);


// var numbers = readline().split(" ").map(function(x) { return parseInt(x); });

var numbers = [99];

let digits = String(numbers[0]).split("");

function check(digits) {
    let sum = digits.reduce((a, b) => {return (+a) + (+b)});
    return sum%4;
}

while (check(digits)) {
    var nun = parseInt(digits.join(""));
    nun++;
    digits = String(nun).split("");
}

var result = digits.join("");

console.log(result);

// print(result);


var numberStr = readline().split(" ")[0];

function check(numberStr) {
    let digits = numberStr.split("");
    let sum = digits.reduce((a, b) => {return (+a) + (+b)}, 0);
    return sum%4;
}

while (check(numberStr)) {
    var nun = +numberStr;
    nun++;
    numberStr = String(nun);
}

print(numberStr);


;(function () {

	var s = readline().split(' ');

	print( Math.min(+s[0] - s[1], +s[2] + 1);

}).call(this);


var valores = readline().split(" ");
var gente = valores[0];
var delante = valores[1];
var detras = valores[2];

print(Math.min((gente-delante),(detras+1));


var s = readline().trim(), cnt = 2;
for (let i = 0, j = s.length - 1; i < j; i++, j--) {
    if (s[i] != s[j]) {
        cnt -= 1;
        if (!cnt) {
            break
        }
    }
}
print((cnt) ? "YES" : "NO");


ar r = readline().split(' ').map(Number);
var r1 = r[0];
var r2 = r[1];
var c = readline().split(' ').map(Number);
var c1 = c[0];
var c2 = c[1];
var d = readline().split(' ').map(Number);
var d1 = d[0];
var d2 = d[1];

var list = {};
for (var i = 1; i <= 9; i++) {
  for (var j = 1; j <= 9; j++) {
    if (i === j) continue;
    var index = i + j;
    if (list.hasOwnProperty(index)) {
      list[index].push([i, j]);
    } else {
      list[index] = [[i, j]];
    }
  }
}

var line1;
var line2;
var find = false;
var length1 = (list[r1] || []).length
var length2 = (list[r2] || []).length

for (var i = 0; i < length1; i++) {
  line1 = list[r1][i]
  for (var j = 0; j < length2; j++) {
    line2 = list[r2][j]

    if (
      c1 === line1[0] + line2[0] &&
      c2 === line1[1] + line2[1] &&
      d1 === line1[0] + line2[1] &&
      d2 === line1[1] + line2[0] &&
      line1[0] !== line2[0] &&
      line1[0] !== line2[1] &&
      line1[1] !== line2[0] &&
      line1[1] !== line2[1]
    ) {
      find = true;
      break;
    }
  }

  if (find) {
    break;
  }
}
if (find) {
  print(line1.join(' '));
  print(line2.join(' '));
} else {
  print(-1);
}


var num = readline().split('');
var l = parseInt��num[0]��;
var r = parseInt��num[1]��;;
if(r - l >= 1){
	print(2);
}else{
	print(1);
}


var num = readline().split('');
var l = num[0];
var r = num[1];
if(r - l >= 1){
	document.write(2);
}else{
	document.write(�������ڡ�);
}


var num = readline().split('');
var l = num[0];
var r = num[1];
if(r - l >= 1){
	print(2);
}else{
	print(�������ڡ�);
}


(function () {
    var n = parseInt(readline()),
        array = readline().split(" "),
        i = 0,
        sum = 0;
    for (; i < n; i++) {
        sum += parseInt(array[i]);
    }

    function check100 (ln) {
        var i = ln;
        for (; i < n; i++) {
            if (parseInt(array[i]) === 100) {
                print("YES");
                return;
            }
        }
        print("NO");
    }

    sum /= 2;
    i = 0;
    while (sum >= 0) {
        sum -= array[i];
        i++;
        if (sum === 0) {
            print("YES");
            return
        }
        if (sum === 100) {
            check100(i);
            return
        }
        if
        print("NO");
    }
})();


function f(x)
{
	return (x*(x+1))/2;
}

var input = readline().split().map(Number);
var n = input[0];
var ans - f(n);

for(var x = n - 2; x >= 1; x--)
{
	ans += f(x);
}

print(ans);


<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        body{
            overflow: hidden;
        }
    </style>
</head>
<body>
<canvas id="my"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.5/dat.gui.min.js"></script>
<script>
    var canvas = document.getElementById('my');
    var w = window.innerWidth;
    var h = window.innerHeight;
    canvas.width = w;
    canvas.height = h;
    var ctx = canvas.getContext('2d');
    function getRandomInt(min, max) {
        return Math.floor(Math.random() * (max - min)) + min;
    }
    var radius = Math.min(w,h)/2 - 70;

    var maxAngles = 11;

    var centerX = w/2;
    var centerY = h/2;

    var varRadius, x, y , teta, figure;

    var settings = {
        theme: 'black',
        figure: getRandomInt(3, maxAngles+1),
        slow: 100,
        color: 0,
        period: 15,
        amp: 15,
        circles: radius/10,
        stroke: false,
        hsl: true
    };

    var gui = new dat.GUI();
    gui.add(settings, 'theme', ['black', 'white']);
    gui.add(settings, 'figure', 3, maxAngles).step(1);
    gui.add(settings, 'slow', 50, 1000).step(10);
    gui.add(settings, 'color', 0, 360).step(1);
    gui.add(settings, 'amp', 0, 50).step(1);
    gui.add(settings, 'period', 0, 40).step(1);
    gui.add(settings, 'circles', 1, settings.circles).step(1);
    gui.add(settings, 'stroke');
    gui.add(settings, 'hsl')

    function drawCircle(radius, color, offset){
        figure = (settings.figure < maxAngles) ? settings.figure : 400;
        ctx.fillStyle = color;
        ctx.beginPath();

        for (var i = 0; i <= figure; i++) {
            teta = i*2*Math.PI/figure;
            varRadius = radius + settings.amp*Math.sin(teta*settings.period + offset);
            x = centerX + varRadius*Math.cos(teta);
            y = centerY + varRadius*Math.sin(teta);

            if (i === 0) {
                ctx.moveTo(x, y);
            } else {
                ctx.lineTo(x, y);
            }
        }

        ctx.closePath();
        if(settings.stroke){
            ctx.fillStyle="#000000";
            ctx.strokeStyle = "#ffffff";
            ctx.stroke();
            ctx.fill();
        } else{
            ctx.fill();
        }
    }

    var time=0;
    function draw() {
        time++;
        ctx.clearRect(0, 0, w, h);
        ctx.fillStyle = settings.theme;
        ctx.fillRect(0, 0, w, h);
        for (var i = 0; i < settings.circles; i++) {
            var color = (i%2)?'black':'white';
            drawCircle(
                radius-i*10,
                settings.hsl ? 'hsl('+(settings.color + i*10)+', 50%, 50%)' : color,
                i*time/settings.slow)
        }
    }

    function render() {
        draw();
        window.requestAnimationFrame(render);
    }

    render();
</script>
</body>
</html>


By tea, contest: Educational Codeforces Round 36 (Rated for Div. 2), problem: (A) Garden, Accepted, #
 T=readline().split(' ').map(Number)
A=readline().split(' ').map(Number)
A.sort((l,r)=>r-l)

var a;
for (var i=0;i<A.length;++i) {
 if (!(T[1] % A[i])) {
   a=A[i]
   break;
 }
}

print(T[1]/a)


var y = readline();
var sB = readline();

var a = y.split(' ');
var aB = a[0];
var lG = a[1];

var x = calcH(l, sB);
console.log(x);

function cH(lG,sB) {
    var aSB = sB.split(' ');
    var res = Infinity;

    for (let i = 0 ; i<aSB.length; i++) {
        var hours = lG/aSB[i];
        if ((hours^0) === hours && 0 < hours && hours < result ) {
          res = hours;
        }
    }
    return res;
}


var y = readline();
var sB = readline();

var a = y.split(' ');
var aB = a[0];
var lG = a[1];

var aSB = sB.split(' ');
var res = 0;

for (let i = 0 ; i<aSB.length; i++) {
    var hours = lG/aSB[i];
    if ((hours^0) === hours && 0 < hours && hours < result ) {
    res = hours;
    }
}
print(res);


var amountBuckets = 3;
var lengthGarden = 6;
var speedBuckets  =  '2 3 5';

console.log(calculateHours(lengthGarden, speedBuckets));

function calculateHours(lengthGarden,speedBuckets) {
    var arrSpeedBuckets = speedBuckets.split(' ');
    var result = Infinity;

    for (let i = 0 ; i<arrSpeedBuckets.length; i++) {
        var hours = lengthGarden/arrSpeedBuckets[i];
        if ((hours^0) === hours && 0 < hours && hours < result ) {
          result = hours;
        }
    }
    return result;
}