'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

    let result = isTrue(theNum);

    if(result) {
        console.log('YES');
    } else {
        console.log('NO');
    }
}

function isTrue(theNum) {
    if(theNum == 2) {
        return false;
    }
    let secondNum = theNum - 2;
    for(let i = 2; i <= theNum; i+=2, secondNum-=2) {
        if(i + secondNum == theNum) {
            if(i % 2 == 0 && secondNum % 2 == 0) {
                return true;
            }
        }
    }
    return false;
}


function main() {
    // write code here:
    const n=Number(stdin[0]);
    var str=stdin[1];
    var arr=[];
    for(let i=0,j=0;i<n;i++,j=j+i){
        arr.push(str[j+i]);
    }
    console.log(arr.join(''));
}

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


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

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

  console.log(Math.floor(m*n/2));
});


'use strict'; /*jslint node:true, browser:true, es6:true*/
const print = console.log
const E = {};
const lines = []
if (!process.env.JEST_WORKER_ID){
  const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
  rl.on('line', line => {
      lines.push(line);
  });
  rl.on('close', main)
}
let rli = 0;
function readline() {
    return lines[rli++];
}

module.exports = E;

const ra = ()=>readline().split(' ').map(a=>+a)

const EPS = 1e-6;

const calc = n=>{
  return (1<<n)-1;
};

function main() {
    let T = +readline();
    while (T--){
      let n = +readline();
      print(calc(n));
    }
}

E.calc = calc;


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

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

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

function main() {
  let s1 = readline().toLowerCase();
  let s2 = readline().toLowerCase();
  console.log( s1.split('').reverse().join('') === s2 ? 'YES' : 'NO' );
}


// 58A - Chat room
// http://codeforces.com/problemset/problem/58/A

function main() {
    let s = read();
    if (s.match(/.*h.*e.*l.*l.*o.*/))
        writeline("YES");
    else
        writeline("NO");
    return 0;
}

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


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

// multi line input read nodejs function
readline.on('line', line => {
 let number = line
 console.log(matchs(number))
})

//it's a main function
function matchs(n) {
   return n.split(/\+/g).sort().join('+')
}


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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

const main=()=>{
	let x=parseInt(readLine())
	let blocks=readLine().split(" ").map(n=>+n)
	blocks.sort((a,b)=>a-b)
	console.log(...blocks)
}


'use-strict'

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

let data = '';
let currentLine = 0;

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

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

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

while(testCases--) {

const num = parseInt(readLine());
const res = a(num);
console.log(res)
}
});

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

function a(s){
    let ans = 0;
    for(let i = 0; i*i <= s ; i++) ans++;
    for(let i = 0; i*i*i <= s ; i++) ans++;
    for(let i = 0; i*i*i*i*i*i <= s ; i++) ans--;
    return ans - 1;
}

module.exports = a;


function main() {
    // write code here:
    const nk = stdin[0].split(' ').map(Number);
    var i = 0,
        sum = 0;
    while (nk[0] > 0) {
        nk[0]--;
        i++;
        sum += i;
        if (sum >= nk[1] && nk[0] === sum - nk[1]) {
            break;
        }
    }
    console.log(nk[0]);
}

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


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

rl.on('line', (d) => {
  const [w1, h1, w2, h2] =  d.split(' ').map(Number);
  const ans = ((w1 + 2) * 2 + (h1 + h2 + 2) * 2) - 4;

  console.log(ans);
});


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

const input = [];
readLine.on('line', line => input.push(line));
const substract = () => {
    let [n,k] =  input[0].split(' ').map(x => +x);
    let count = 0;
    while (count < k) {
        let last = n % 10;
        if (last !== 0) {
            n--;
        }
        else {
            n /= 10;
        }
        count++;
    }
    console.log(n);

};

readLine.on('close', substract);


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

function tanyaEraser(number, iterations){
    while (iterations != 0) {
        if (number % 10 == 0){
            number /= 10;
            //console.log(number, typeof number);
        } else {
        number--;
        }
        iterations--;
    }
    //console.log(`number is ${number} and typeof number is ${typeof number}`);
    console.log(number);

}

rl.on('line', (line) => {
    [inputNum, iterations] = line.split(' ', 2).map(Number);
    //console.log('inputNum', inputNum, typeof inputNum, iterations, typeof iterations);
    tanyaEraser(inputNum, iterations);
    process.exit();
});


const readline = require('readline');

let inputs = [];

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

// Read Inputs
rl.on('line', inputLine => {
    let seq = [];
    const n = parseInt(inputLine.split(' ')[0]);
    const k = parseInt(inputLine.split(' ')[1]);
    const evens = Math.floor((n / 2));

    if (n % 2 === 0) {
        const base = ((k - 1) * 2);
        if (k <= (n / 2)) {
            return console.log(base + 1);
        } else if (k > (n / 2) && k <= n) {
            return console.log((base + 2) - n);
        }
    }
    else {
        const lastOdd = evens + 1;
        const base = ((k - 1) * 2);

        if (k <= lastOdd) {
            return console.log(base + 1);
        } else if (k > lastOdd && k <= n) {
            return console.log((base + 2) - n - 1);
        }

    }

});


let input = [];

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

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

RL.on('close', () => {
    let n = parseInt(input[0]);
    let a = n%4, b = (n+1)%4, c = (n+2)%4;
    //console.log(`a = ${a}; b = ${b}; c = ${c}`);
    if(a == 1){
        console.log('0 A');
    } else if(a != 1 && (b == 1 || b == 3)){
        console.log('1 '+(b===1 ? 'A' : (b === 2) ? 'C' : (b === 3) ? 'B' : 'D'));
    } else {
        console.log('2 '+(c===1 ? 'A' : (c === 2) ? 'C' : (c === 3) ? 'B' : 'D'));
    }
});


const input = [];

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

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

RL.on('close', () => {
  const [n, m, a] = input[0];

  console.log( parseInt(Math.ceil(m/a) * Math.ceil(n/a)) );
});


function main(stdin) {
  const [n, m, a] = stdin.split(" ").map(v => parseInt(v));
  console.log(Math.ceil(n / a) * Math.ceil(m / a));
}

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


const main = data => {
  const n = data[0];
  const winnerArr = data[1].split(' ');
  const looserArr = data[2].split(' ');

  const winCount = winnerArr.filter((x, i) => looserArr[i] !== x && +x !== 0).length;
  const looseCount = looserArr.filter((x, i) => winnerArr[i] !== x && +x !== 0).length;

  if (winCount === 0) {
    console.log('-1')
  } else {
    let i = 1;
    while (winCount * i <= looseCount) {
      i++
    }
    console.log(i);
  }
};

let data = '';

process.stdin.on('data', input => data += input);
process.stdin.on('end', () => {
  data = data.split('\n');

  main(data);
});


"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    let ans = true;
    if (arr[n - 1] !== 0) {
      if (arr[arr[n - 1] - 1] === 0) ans = false;
    } else ans = false;
    console.log(`${ans === true ? "YES" : "NO"}`);
  }
};
solve();


let input = ''
process.stdin.on('data', c => input += c)
process.stdin.on('end', () => {
const { EOL } = require('os')
const lines = input.split(EOL)
s = lines[0]
right = s.length - 1
left = 0
ans = ""
if (s.length %2 == 1){
    ans += s[left]
    left += 1
}
while (left < right){
    ans += s[right]
    ans += s[left]
    right -= 1
    left += 1
}
finalans = ""
for (i = ans.length-1; i>= 0; i--){
    finalans += ans[i]
}
console.log(finalans)
})


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let [n, len] = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  arr.sort((a, b) => a - b);
  let min = Number.MAX_SAFE_INTEGER;

  for (let i = 0; i <= len - n; i++) {
    const [low, high] = [arr[i], arr[i + n - 1]];
    min = Math.min(min, high - low);
  }

  console.log(min);
}


const readline = require('readline');

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

function readLines(number, cb) {
    const lines = [];
    rl.on('line', function(line) {
        lines.push(line);
        if (lines.length === number) {
            rl.close();
            cb(lines);
        }
    });
};

function doIt(lines) {
    const n = parseInt(lines[0]);
    if (n === 0)
        console.log(n)
    else
        console.log(calc(n, 1));
}

function calc(next, acc) {
    if (next === 0)
        return acc;
    let unit1 = next%10;
    let rest1 = Math.floor(next/10);
    let ret1 = calc(rest1, unit1*acc);
    let ret2 = 0;
    if (unit1 < 9 && rest1>0) {
        let unit2 = 9;
        let rest2 = Math.floor(next/10) -1;

        ret2 = calc(rest2, unit2*acc);
    }
    return Math.max(ret1, ret2);
}

readLines(1, doIt);


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

let currentLine = 0
let inputString = ''

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

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

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

// function main() {
//     /**
//      * INPUT TECHNIQUES
//      */

//     // Simple String Input
//     const strInput = readLine()

//     // Array Input
//     const arrInput = readLine().split(' ')

//     // Array Destructuring and Three variable input from a single line, separated by a space
//     const [a, b, c] = readLine.split(' ')

//     // If you need number separated by space just map each element of the array this way
//     const [x, y, z] = readLine.split(' ').map(Number)

//     /**
//      * OUTPUT TECHNIQUES
//      */

//     //  End by a new line "\n"
//     console.log("Hi")

//     // Don't end by new line character "\n"
//     process.stdout.write("Hi")

// }

function main() {
    let t = readLine();
    t = parseInt(t);

    while (t--) {
        solve()
    }
}

function solve() {
    let N = readLine();
    N = parseInt(N);

    let res = ((Math.floor(Math.sqrt(N)) + Math.floor(Math.cbrt(N))) - Math.floor(Math.sqrt(Math.floor(Math.cbrt(N)))));
    console.log(res);
}


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

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

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

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

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

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

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

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

    count++;
});

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

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

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

    console.log(ans);
});


// Sample code to perform I/O:

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

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

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

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

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

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

    let inputs = str.trim().split(' ');
    let questions = +inputs[0];
    let minutesToTake = +inputs[1];
    let totalHours = 240;

    for (var index = 1; index <= questions; index++) {

        let mul = 5 * index;
        let diff = totalHours - mul;

        if (diff < minutesToTake) {
            index--;
            break;
        }
        else if (diff == minutesToTake) {
            break;
        }
        totalHours = diff;
    }

    if (index > questions) {
        index--;
    }

    return index.toString();
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    let place = [];

    for (let row = 0; row < 5; row++) {
        let found = readline().split(" ").indexOf('1');
        if (found > -1) {
            place = [row, found];
            break;
        }

    }

    let num1 = Math.abs(2- place[0]) >= 0 ?  Math.abs(2- place[0]) : 0;
    let num2 = Math.abs(2- place[1]) >= 0 ?  Math.abs(2- place[1])  : 0;
    console.log(num1 + num2);

    return;
}


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

const ans = (text) => {
  console.log(text);
};

rl.on('line', function (w) {
  if (w < 3) {
    ans('NO');
  }
  else if (w % 2 === 0) {
    ans('YES');
  }
  else {
    ans('NO');
  }
})


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

readline.on('line', s => {
  let i = 0;

  const n = s.length;

  while (i < n) {
    if (s[i] == 'h') {
      i++;
      while (i < n) {
        if (s[i] == 'e') {
          i++;
          while (i < n) {
            if (s[i] == 'l') {
              i++;
              while (i < n) {
                if (s[i] == 'l') {
                  i++;
                  while (i < n) {
                    if (s[i] == 'o') {
                      console.log('YES');
                      return;
                    }
                    i++;
                  }
                }
                i++;
              }
            }
            i++;
          }
        }
        i++;
      }
    }
    i++;
  }

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


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

rl.on('line', (d) => {
  const [s, v1, v2, t1, t2] = d.split(' ').map(Number);
  const p1 = 2 * t1 + s * v1;
  const p2 = 2 * t2 + s * v2;

  if (p1 < p2) {
    console.log('First');
  }
  else if (p1 > p2) {
    console.log('Second');
  }
  else {
    console.log('Friendship');
  }
});


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
   const matrix = [];
   let minNumOfSwap;
   for( let i = 0 ; i < 5 ; i++){
       matrix[i] = readline().split(' ').map(x => parseInt(x))
   }

   for (let i=0 ; i <5 ;i++){
       for (let j =0 ; j < 5 ; j++){
           if (matrix[i][j] === 1 ){
               minNumOfSwap = Math.abs( i - 2) + Math.abs(j -2);
               break;
           }
       }
       if (minNumOfSwap > 0) break;
   }
    console.log(minNumOfSwap)

}


function solve() {
   var k = BigInt(read());
   var str = 'codeforces';
   var n = str.length;

   var step = 0;
   var mul = 0n;

   while (mul <= k) {
      step++;
      mul = st(step, n);
   }

   step--;
   mul = st(step, n);
   var c = 0;

   while(mul < k) {
      c++;
      mul += mul / BigInt(step);
   }

   var ans = '';
   for (var i = 0; i < n; ++i) {
      ans += str[i].repeat(i < c ? step + 1 : step);
   }
   write(ans);
}

function st(n, k) {
   n = BigInt(n);
   var p = BigInt(1);
   for (var i = 0; i < k; ++i) {
      p *= n;
   }
   return p;
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         solve();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

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

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

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}


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

rl.on('line', (d) => {
  console.log(+d / 2 * 3);
  c++;
});


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

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

  const arr = d.split(' ').map(Number);
  arr.sort((a, b) => a - b);

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

  c++;
});


const readline = require('readline')
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
})
let input = []
rl.on('line', line => {
  input = line.split(' ').map(x => parseInt(x))
  const output = solution(input[0], input[1])
  console.log(output)
})
rl.on('close', () => {

})

const solution = (n) => {
	let intQuotient = Math.floor(n/5);
	let reminder = n % 5;
	let res = intQuotient + (reminder ? 1 : 0);
	return res;
};


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

//Don't have to see. end------------------------------------------
function Main(){
	var one = nextIntArray();
  var n = one[0];
  var k = one[1];
  for(var i = 0; i < k; i++){
    if(n % 10 == 0){
      n /= 10;
    }else{
      n--;
    }
  }
  myout(n);
}


let i = ''

function main(n,m,a) {
    if( (1 <= n && n <= Math.pow(10,9)) && ( 1 <= m && m <= Math.pow(10,9))  && (1 <= a && a <= Math.pow(10,9)) ){
        let x = n/a;
        let y = m/a;
        let num = 0;
        if(n == 1 && m == 1 && a == 1 ){
            console.log(1);
        }
        else if(n == 1 || m == 1){
            let x = Math.ceil((n * m) / a);
            console.log(x);
        }
        else if(x <= 1 && y <= 1){
            console.log(1);
        }
        else if(x < 1){
            console.log(Math.ceil(y));
        }
        else if(y < 1){
            console.log(Math.ceil(x));
        }
        else{
            let x = Math.ceil(n/a) ;
            let y = Math.ceil(m/a);
            num = x*y;
            console.log(num);
        }
    }

}
// main(1000000000,1000000000,1);

process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL)
    const line1Array = lines[0].split(' ').map(x => parseInt(x))
    const n = line1Array[0];
    const m = line1Array[1];
    const a = line1Array[2];
    main(n,m,a);
})


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

let currentLine = 0;
let inputString = "";

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

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

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

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

function main() {
  var s = readLine().split("").map(Number);

  var count = 0;
  for (var i = 0; i < s.length; i++) {
    if (s[i] === 7 || s[i] === 4) {
      count++;
    }
  }
  if (count == 4 || count == 7) {
    console.log("YES");
  } else {
    console.log("NO");
  }
}


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

let stdin = '';

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

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

  let counter = 0;
  let current;

  for (let i = 0; i < data.length; i++) {
    if (data[i] === current) counter++;
    else current = data[i];
  }

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


let data = '';
process.stdin.on('data', c => data += c);
const sol = () => {
	let x = Number(data);
	while(x%10 === 0) x /= 10;
	let a = x, b = 0;
	while(x > 0){
		b *= 10;
		b += x%10;
		x = Math.trunc(x/10);
	}
	console.log(a === b?'YES':'NO');
};
process.stdin.on('end', sol);


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

rl.on('line', (d) => {
  let [t, s, x] = d.split(' ').map(Number);
  let ans = 'NO';
  let val = t;

  if (val === x) {
    ans = 'YES';
  }

  let idx = 1;
  while (val <= x) {
    val = t + (idx * s);

    if (val === x) {
      ans = 'YES';
      break;
    }

    val = t + (idx * s) + 1;

    if (val === x) {
      ans = 'YES';
      break;
    }

    idx++;
  }

  console.log(ans);
  c++;
});


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


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

  const tableCard = lines[0];
  const handCards = lines[1].trim().split(' ');

  for (const card of handCards) {
    if (tableCard[0] === card[0] || tableCard[1] === card[1]) {
      console.log('YES');
      return;
    }
  }

  console.log('No');
});


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

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

process.stdin.on('end', () => {
  input = input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  const l = readInt()
  let s = readString()
  let max = 0
  let count = 0
  let len = l
  for(let c = 1; c < l; c++) { // l -1 times
    let f = false
    for(let i = 1; i < len; i++) {
      if(s[i] > s[max]) max = i
    }
    // console.log(s, max, s[max], count)
    if(max !== 0 && s.charCodeAt(max) - 1 === s.charCodeAt(max - 1)) {
      s = cut(max)
      len--
      count++
      f = true
    }
    else {
      for(let x = max; x < len - 1; x++) {
        if(s[x] === s[max] && s.charCodeAt(x) - 1 === s.charCodeAt(x + 1)) {
          // console.log('x', x, s[x])
          s = cut(x)
          len--
          count++
          f = true
          break
        }
      }
    }
    if(!f) s = put(max)
    max = 0
  }

  wr(count)

  function cut(i) {
    i++
    return s.substring(0, i - 1) + s.substring(i)
  }
  function put(i) {
    i++
    return s.substring(0, i - 1) + 'A' + s.substring(i)

  }
}


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

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var x = one[0];
  var y = one[1];
  var z = one[2];
  one = nextIntArray();
  var a = one[0];
  var c = one[1];
  var b = one[2];
  if(a < x){
    myout("NO");
    return;
  }
  a -= x;
  if(a + c < y){
    myout("NO");
    return;
  }
  var ac = a + c;
  ac -= y;
  if(ac + b < z){
    myout("NO");
    return;
  }else{
    myout("YES");
    return;
  }
}


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

let first = true;

rl.on('line', line => {
    if (first) {
        first = false;
    } else {
        solution(line);
    }
});

function solution(line) {
    let previous = line[0];
    let repeat = 0;
    for (let i = 1; i < line.length; i++) {
        while (line[i] === previous) {
            repeat++;
            i++;
        }
        previous = line[i];
    }

    console.log(repeat);
}


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

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

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

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

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


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

let l = 0;
rl.on('line', (input) => {
    if (l === 0) { l++ }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        let sum = 0
        for (let i = 0; i < arr.length; i++) {
            sum += arr[i]*2*(2*(Math.max((i+1),1)-1))
        }

        console.log(sum)
        return 0;
    }
})


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

    process.stdin.on('data', inputStdin => {
        if (inputStdin % 2 === 0 && inputStdin > 2) {
          console.log('YES');
        } else console.log('NO');
    });


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

readline.on('line',main);

function main(line) {
    const str = line.split(' ');
    const n = str[0];
    const m = str[1];
    const a = str[2];

    console.log(
        Math.ceil(n / a) * Math.ceil(m / a)
    )
}


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

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

const teams = () => {
    const n = +input.shift();
    let ar1  = [];
    let ar2 = [];
    let count = 0;
    for (const x of input) {
        let [z,y] = x.split(' ').map(x => +x);
        ar1.push(z);
        ar2.push(y);
    }
    for (const k of ar1) {
        for (const s of ar2) {
            if (k === s) {
                count++
            }
        }

    }

    console.log(count);
};
readLine.on('close', teams);


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

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

function main() {
  // input
  const n = readline();
  let result = 0;
  let t = [];
  for (let i = 0; i < n; i++) {
    const c = readline().split(' ');
    t.push(c);
  }
  for (let i = 0; i< n; i++) {
    const [h,] = t[i];
    for (let j = 0; j < n; j++) {
      if (j === i) {
        continue;
      }
      const [,a] = t[j];
      if (h === a) {
        result++;
      }
    }
  }
  // output
  print(result);
}


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

    let first = lines[0].toLowerCase();
    let second = lines[1].toLowerCase();
    let flag = true;

    for (let i = 0; i < lines[0].length; i++) {
        if (first[i] < second[i]) {
            flag = false;
            console.log('-1');
            break;
        } else if (first[i] > second[i]) {
            flag = false;
            console.log('1');
            break;
        }
    }

    if (flag) {
        console.log('0');
    }

});


const readline = require('readline');

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

var check = function (x, y, z) {
    if (x + y > z && x + z > y && y + z > x)
        return 'T';
    if (x + y == z || x + z == y || y + z == x)
        return 'S';

    return 'I';
}

rl.on('line', (input) => {
    var cont = input.split(' ').map(item=>parseInt(item));

    var a = cont[0], b = cont[1], c = cont[2], d = cont[3];
    if (check(a, b, c) == 'T' ||
        check(a, b, d) == 'T' ||
        check(a, d, c) == 'T' ||
        check(d, b, c) == 'T')
        console.log("TRIANGLE")
    else if (check(a, b, c) == 'S' ||
        check(a, b, d) == 'S' ||
        check(a, d, c) == 'S' ||
        check(d, b, c) == 'S')
        console.log("SEGMENT");
    else
        console.log("IMPOSSIBLE");
    rl.close();
});


function nextInt() {
    return parseInt(nextString());
}

function nextFloat() {
    return parseFloat(nextString());
}

let input_stdin = "";
let input_cursor = 0;

function nextString() {
    let next_string = "";
    clearWhitespaces();
    while (input_cursor < input_stdin.length && !isWhitespace(input_stdin[input_cursor])) {
        next_string += input_stdin[input_cursor];
        input_cursor += 1;
    }
    return next_string;
}

function nextChar() {
    clearWhitespaces();
    if (input_cursor < input_stdin.length) {
        return input_stdin[input_cursor++];
    } else {
        return '\0';
    }
}

process.stdin.resume();
process.stdin.setEncoding('ascii');
process.stdin.on('data', function (data) { input_stdin += data; });
process.stdin.on('end', function () { main(); });

function isWhitespace(character) {
    return ' \t\n\r\v'.indexOf(character) > -1;
}

function clearWhitespaces() {
    while (input_cursor < input_stdin.length && isWhitespace(input_stdin[input_cursor])) {
        input_cursor += 1;
    }
}

function main() {
    let x = nextInt();
    if (x % 2 === 1 || x === 2)console.log("NO"); else console.log("YES");
}


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

rl.on('line', line => {
    const input = line.split(' ').map(char => Number(char));        // Array of two numbers
    console.log(solution(input[0], input[1]));
});

// If n % 10 !== 0 (n is not divisible by 10) then n = n - 1 (subtract 1)
// If n % 10 === 0 (n is divisble by 10) then then n = n / 10 (divide by 10)

// There are k operation
// [?] Does dividing by 10 count as an operation?
function solution(n, k) {
    let num = n;
    let numberOfOperations = k;
    for (let i = 0; i < numberOfOperations; i ++) {
        if (num % 10 !== 0) {
            num -= 1
        } else {
            num = num / 10;
        }
    }

    return num;
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    const str1=  readline();
    const str2=  readline();
    let result =0;
    for (let i=0;i<str1.length;i++){
        if(str1[i].toLowerCase() > str2[i].toLowerCase()){
            result=1;
            break;
        }
        else if (str1[i].toLowerCase() < str2[i].toLowerCase()){
            result=-1;
            break;
        }
    }

    console.log(result);
    return;
}


readline = require('readline')
let stdinInput = '';

// //file
//     var fs = require('fs');
//    const inputfile = '_in.txt';
//    const outputfile = '_out.txt';
//    fs.writeFileSync(outputfile, '');
//    var myInterface = readline.createInterface({
//      input: fs.createReadStream(inputfile),
//    });
//    myInterface.on('line', function (line) {
//       stdinInput += line+'\n';
//     }).on('close', () => {
//            main();
//         process.exit(0);
//     })
   /*
   *  Api Scanner
   */
  class Scanner {
    constructor() {
      this.index = -1;
      this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
    }

    nextLine() {
      this.index += 1;
      return this.lines[this.index].trim();
    }
    nextArray(fn) {
      const array = this.nextLine().split(' ');
      return fn === String ? array : array.map(fn);
    }

    hasNext() {
      return this.index < this.lines.length;
    }
  }

  process.stdin.resume();
  process.stdin.setEncoding('utf-8');
  process.stdin.on('data', (input) => { stdinInput += input; });
  process.stdin.on('end', () => { main(); });

var n;
function main() {
    const is = new Scanner();

    // const s = is.nextArray(Number);
    // const t = is.nextArray(Number);
    // // const k = is.nextArray();

    n = parseInt(is.nextLine());
    // console.log(n);
    if(kt()==1)
        console.log("YES");
		else
        console.log("NO");
  }

  function kt(){
    for(var i=2; i<n; i=i+2)
	{
		if((n-i)%2==0)
			return 1;
	}
	return 0;
}


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

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

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

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

  for (let i = 1; i < 1000; i += 1) {
    let sum = (i*(i+1))/2;
    prev += sum;

    if (prev > n) {
      console.log(i-1); return;
    }
  }
});


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

let stdinInput = '';

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

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

function main(data) {
  data = data.split('\n');
  let count = 0;
  let idx = 0;
  let i;
  for (i = 0; i < data.length; i += 1) {
    idx = data[i].indexOf(1);
    if (idx >= 0) {
      idx /= 2;
      break;
    }
  }
  count = Math.abs(idx - 2) + Math.abs(i - 2);
  process.stdout.write(count + '');
}


'use strict'

const {EOL} = require('os')

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

  let r = 1
  let g1, g2

  const cast = (r, a, b) => {
    if (a == 0 && b == 0) {
      return 0
    }
    else if (a == 0) {
      return Infinity
    }
    return r / a * b
  }

  r = cast(r, a, b)
  r = cast(r, c, d)
  g1 = r
  r = cast(r, e, f)
  r = cast(r, a, b)
  r = cast(r, c, d)
  g2 = r

  console.log(g2 == Infinity || g2 > g1 ? 'Ron' : 'Hermione')
})


let total_input = 6;
let cur_input = 0;
let data = [];
process.stdin.resume();
process.stdin.setEncoding('utf8');
let inputString = '';
let currentLine = 0;

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

process.stdin.on('end', _ => {
    data_get(inputString);
});

function data_get(data) {
    data = data.trim().split('\n').map(string => {
        return string.trim();
    });
    data.forEach((d,i) => {
        data[i] = parseInt(d)
    });
    if (data[4] > data[5]){
        s1 = Math.min(data[0],data[3]);
        data[3] -= s1;
        s2 = Math.min(data[1],data[2],data[3]);
    } // tie first
    else {
        s2 = Math.min(Math.min(data[1],data[2]),data[3]);
        data[3] -= s2;
        s1 = Math.min(data[0],data[3]);
    }

    console.log(s1* data[4] + s2*data[5])
}


const readline = require('readline');

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

let matrix = [], location = [];

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

    console.log(Math.abs(location[0] - 2) + Math.abs(location[1] - 2));
    rl.close();
  }
});


'use strict';

var fs = require('fs');

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

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

function solve(read) {
  const [rn, rb, rns, re, rbs] = convertInput(read);
  const n = rn(),
        k = rn();
  const MOD = 10 ** 9 + 7;
  const f = new Array(n);
  f[0] = f[1] = 1;
  for (let i = 2; i <= n; i++) {
    f[i] = mul(f[i - 1], i);
  }
  const g = new Array(n);
  g[n] = power(f[n], MOD - 2);
  g[0] = 1;
  for (let i = n; i >= 2; i--) {
    g[i - 1] = mul(g[i], i);
  }
  let res = 0,
      max = Math.min(n, k);
  for (let i = 0; i <= max; i++) {
    res = (res + mul(f[n], g[i], g[n - i])) % MOD;
  }
  return res;
}
const MOD = 10 ** 9 + 7;
function power(a, b) {
  let res = 1;
  while (b) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b = b >> 1;
  }
  return res;
}
function mul(...args) {
  if (args.length === 0) throw new Error('参数不能为空');
  if (args.length === 1) return args[0];
  const [a, b] = args;
  if (args.length > 2) return mul(mul(a, b), ...args.slice(2));
  return (Math.floor(a / 65536) * b % MOD * 65536 + (a & 65535) * b) % MOD;
}
function convertInput(read) {
  const rn = () => Number(read());
  const rb = () => BigInt(read());
  const rns = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rn();
    return res;
  };
  const re = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rn() - 1;
    return res;
  };
  const rbs = n => {
    let res = new Array(n);
    for (let i = 0; i < n; i++) res[i] = rb();
    return res;
  };
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  try {
    let t = 1;
    let res = new Array(t);
    let limit = 100;
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < limit) {
        process.stdout.write(s.toString());
        process.stdout.write('\n');
      }
    }
    if (t >= limit) ; else {
      return '';
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split(/\s+/);
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(output);
}();


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

const solve = () => {
  let ans = 0;
  let hasFruits = true;

  while (hasFruits) {
    a -= 1;
    b -= 2;
    c -= 4;

    if (a > -1 && b > -1 & c > -1) {
      ans += 7;
    }
    else {
      hasFruits = false;
    }
  }

  console.log(ans);
};

rl.on('line', (d) => {
  if (count === 0) {
    a = +d;
  }
  else if (count === 1) {
    b = +d;
  }
  else {
    c = +d;

    solve();
  }

  count++;
});


'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  let [p1, p2, p3, p4, a, b] = ipt.split(EOL)[0].split(' ').map(v => parseInt(v))
  let c = 0
  for (let i = a; i <= b; i++) {
    i % p4 % p3 % p2 % p1 == i && c++
  }

  console.log(c)
})


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    const nn = readline();
    var n = nn[0];
    let arr = readline().split(' ');
    n = parseInt(n);

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

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

function flip (n, arr) {
    let total =  0;
  for(let i = 0; i < arr.length; i ++){
    total += arr[i];
  }

 let max = 0;

 for (let i = 0; i < arr.length; i++) {
   for (let j = arr.length -1; j >= i; j--) {
       let sub = arr.slice(i, j + 1);
       let subSum = 0;
       for(let k = 0; k < sub.length; k++) {
           subSum += sub[k] === 0 ? 1 : -1;
       }
       let subRes = total + subSum;
       max = Math.max(max, subRes);
   }
 }
 return max;
}


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function getArray(str) {
    return str.split(' ').map(x => Number(x));
}

function getInt(str) {
    return Number(str);
}

function getStrArray(str) {
    return str.split(' ').map(x => x);
}
// ---------------------------------------

function main() {
    let t = getInt(readline());
    let dp = [];
    dp[0] = 1;
    dp[1] = 0;
    for(let i=2; i<=t; i++) {
        dp[i] = 2* dp[i-2];
    }
    console.log(dp[t]);
}


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

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

readline.on('close', () => {
    const [word, drow] = input;
    if (word == drow.split('').reverse().join('')) console.log('YES');
    else console.log('NO');
})


var n = parseInt(readline());
var arr = readline().split(' ').map(Number);

var max = arrayMax(arr);
var min = arrayMin(arr);

var startIndex = 0;
var endIndex = 0;

	var startCounting = false;

	for (var i = 0; i < n; i++) {
		if ((arr[i] == max || arr[i] == min) && !startCounting)
		{
			startCounting = true;
			startIndex = i;
			i++;
		}
		if ((arr[i] == max || arr[i] == min) && startCounting)
		{

			startCounting = false;
			endIndex = i;
			break;
		}
	}

var maxarr = [];
maxarr.push(endIndex - startIndex);
maxarr.push(endIndex);
maxarr.push(startIndex);
maxarr.push(arr.length - 1 - startIndex);
maxarr.push(arr.length - 1 - endIndex);

function arrayMin(array) {
  var len = array.length, min = Infinity;
  while (len--) {
    if (array[len] < min) {
      min = array[len];
    }
  }
  return min;
};

function arrayMax(array) {
  var len = array.length, max = -Infinity;
  while (len--) {
    if (array[len] > max) {
      max = array[len];
    }
  }
  return max;
};

print(arrayMax(maxarr));


'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    readline();
    let s = readline();
    let n = 0;
    for (let i = 0 , c = s.length -1 ; i<c ; i++){
        if (s[i] == s[i+1])  n++
    }

    console.log(n)

}


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

function main() {
    let firstNumberString = readLine();
    let secondNumberString = readLine();
    let finalStringArray = [];
    for (let i = 0; i < firstNumberString.length; i++) {
        if (firstNumberString[i] !== secondNumberString[i]) {
            finalStringArray.push('1');
        } else {
            finalStringArray.push('0');
        }
    }
    let finalString = finalStringArray.map(Number);
    let finalNumber = finalString.join('');
    console.log(finalNumber);
}


//Nearly Lucky Number

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

let inp = '';

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

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

    let count = 0;
    for(let i in lines)  {
    	if((lines[i] == '4') || (lines[i] == '7'))  {
    		count++;
    	}
    }

    count += '';
    for(let i in count)  {
    	if(!((count[i] == '4') || (count[i] == '7')))  {
    		process.stdout.write("NO");
    		return;
    	}
    }

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


function main() {
  const is = new Scanner();
  const [n, m] = is.nextArray().map(Number);
  const word = is.nextLine().split('');
  word.forEach((item, index, array) => {
    array[index] = item.charCodeAt() - 'a'.charCodeAt() + 1;
  });
  word.sort((a, b) => a - b);

  let answer = word[0];
  let pre = 0;
  let number = 1;
  for (let i = 1; i < n; i += 1) {
    if (number === m)
      break;
    if (word[i] - word[pre] >= 2) {
      answer += word[i];
      pre = i;
      number += 1;
    }
  }

  console.log(number !== m ? -1 : answer);
}

/*
 *  Api Scanner
 */

class Scanner {
  constructor() {
    this.index = 0;
    this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
  }

  nextLine() {
    return this.lines[this.index++]; // eslint-disable-line
  }

  nextInt() {
    return parseInt(this.nextLine(), 10);
  }

  nextDouble() {
    return parseFloat(this.nextLine());
  }

  nextArray() {
    return this.nextLine().split(' ');
  }

  hasNext() {
    return this.index < this.lines.length;
  }
}

let stdinInput = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', (input) => { stdinInput += input; });
process.stdin.on('end', () => { main(); });


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

const f1 = (a, b, c) => a**2 + b === c;
const f2 = (a, b, c) => a + b**2 === c;

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

  for (let i = 0; i <= n; i++) {
    for (let j = 0; j <= m; j++) {
      if (f1(i, j, n) && f2(i, j, m)) {
        ans++;
      }
    }
  }

  console.log(ans);
});


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

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

readLine.on('close', () => {
  let [a, b] = input[0].split(' ').map(x => +x);
  let k = 0;
  while (a <= b) {
    a *= 3;
    b *= 2;
    k++;
  }
  console.log(k);
});


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

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var s = one[0];
  var v1 = one[1];
  var v2 = one[2];
  var t1 = one[3];
  var t2 = one[4];
  var L = t1 * 2 + v1 * s;
  var R = t2 * 2 + v2 * s;
  if(L < R){
    myout("First");
  }else if(L > R){
    myout("Second");
  }else{
    myout("Friendship");
  }
}


const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
let a, b, c;
rl.on('line', (line) => {
    [a, b, c] = line.split(' ').map(i => parseInt(i));
}).on('close', () => {
    process.stdout.write("" + Math.ceil(a / c) * Math.ceil(b / c));
});


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

    function process(str) {
        str = str.toLowerCase();
        var arr = str.split("");
var value = "i";
  var value2 = "a";
  var value3 = "u";
  var value4 = "o";
  var value5 = "y";
  var value6 = "e";
  arr = arr.filter(function(item) {
    return (item !== value && item!== value2 && item!== value3 && item!== value4 && item!== value5 && item!== value6);

});

  arr.forEach(function(element,index,array) {
    array[index] = "." + element;
  })

  var newString = arr.join("");
  console.log(newString);

    }

process(lines[0]);

})


const readline = require('readline');

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

rl.on("line", (answer) => {
	rl.close();
	console.log(/[HQ9]/g.test(answer) ? "YES" : "NO");
});


let input = [];
let readline=require('readline');
let RL=readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let TC=RL.on('line', (line)=>{
  input.push(line.trim());
});
RL.on('close', ()=>{
  let [n, m, a] = input[0].split(" ");
  let row=Math.ceil(parseInt(n)/parseInt(a));
  let col=Math.ceil(parseInt(m)/parseInt(a));

  console.log(row*col);
});


// readline = require('readline')
let stdinInput = '';

// //file
//     var fs = require('fs');
//    const inputfile = '_in.txt';
//    const outputfile = '_out.txt';
//    fs.writeFileSync(outputfile, '');
//    var myInterface = readline.createInterface({
//      input: fs.createReadStream(inputfile),
//    });
//    myInterface.on('line', function (line) {
//       stdinInput += line+'\n';
//     }).on('close', () => {
//            main();
//         process.exit(0);
//     })
   /*
   *  Api Scanner
   */
  class Scanner {
    constructor() {
      this.index = -1;
      this.lines = stdinInput.trim().split('\n'); // eslint-disable-line
    }

    nextLine() {
      this.index += 1;
      return this.lines[this.index].trim();
    }
    nextArray(fn) {
      const array = this.nextLine().split(' ');
      return fn === String ? array : array.map(fn);
    }

    hasNext() {
      return this.index < this.lines.length;
    }
  }

  process.stdin.resume();
  process.stdin.setEncoding('utf-8');
  process.stdin.on('data', (input) => { stdinInput += input; });
  process.stdin.on('end', () => { main(); });

var n;
function main() {
    const is = new Scanner();

    // const s = is.nextArray(Number);
    // const t = is.nextArray(Number);
    // // const k = is.nextArray();

    n = parseInt(is.nextLine());
    // console.log(n);

    if(kt()==1)
        console.log("YES");
		else
        console.log("NO");
  }

  function kt(){
    for(var i=2; i<n; i=i+2)
	{
		if((n-i)%2==0)
			return 1;
	}
	return 0;
}


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

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

readLine.on('close', () => {
  let row = 0;
  let col = 0;
  input.forEach((item, index) => {
    const findOne = item.split(' ')
    const findCol = findOne.indexOf('1')
    if (findCol !== -1) {
      col = findCol + 1
      row = index + 1
    }
  })
  let _result = 0
  let _difRow = 0
  if (row !== 3) {
    if (row > 3)
      _difRow = row - 3
    else if (row < 3)
      _difRow = 3 - row
  }
  let _difCol = 0
  if (col !== 3) {
    if (col > 3)
      _difCol = col - 3
    else if (col < 3)
      _difCol = 3 - col
  }
  _result = _difRow + _difCol
  console.log(_result)
})


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

rl.on('line', line => {
	const [n, m] = line.split(' ').map(i => parseInt(i));
	console.log(Math.floor(n * m / 2));
	rl.close();
});


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

readline.question("", (a) => {
    readline.question("", (b) => {
        readline.question("", (c) => {
            a=parseInt(a)
            b=parseInt(b)
            c=parseInt(c)
            console.log(Math.max(a + b + c, a + b * c, (a + b) * c, a * b + c, a * (b + c), a * b * c))
            readline.close();
        })
    })
})


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

rl.on('line', (d) => {
  if (count === 0) {
    friends = d.split(' ').map(Number);
  }
  else {
    grapes = d.split(' ').map(Number);
  }

  count++;
});

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

  let [x, y, z] = friends;
  let [a, b, c] = grapes;

  a -= x;

  if (a < 0) {
    ans = 'NO';
  }

  let temp = (a + b) - y;

  if (temp < 0) {
    ans = 'NO';
  }

  temp += c;

  if (temp - z < 0) {
    ans = 'NO';
  }

  console.log(ans);
});


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

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


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

  for (let i = 0; i < str.length; i++) {
    const num = +str[i];

    if (num === 0) {
      count0++;
      max1 = Math.max(count1, max1);
      max0 = Math.max(count0, max0);
      count1 = 0;
    } else {
      count1++;
      max1 = Math.max(count1, max1);
      max0 = Math.max(count0, max0);
      count0 = 0;
    }
  }
  if (max0 >= 7 || max1 >= 7) console.log("YES");
  else console.log("NO");
}


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

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}

function main() {
  const n = +readLine();

  function countAlmostPrimes(n) {
    const primes = getAllPrimesUpto(n);
    let almostPrimeCount = 0;

    for (let i = 1; i <= n; i++) {
      let count = 0;
      let j = 0;
      while (primes[j] < i && j < n) {
        if (i % primes[j] === 0) count++;
        j++;
      }
      if (count === 2) almostPrimeCount++;
    }
    return almostPrimeCount;
  }

  console.log(countAlmostPrimes(n));
}

function getAllPrimesUpto(n) {
  const primes = [];
  for (let i = 2; i <= n; i++) {
    let isPrime = true;
    for (let j = 2; j <= Math.floor(Math.sqrt(i)); j++) {
      if (i % j === 0) {
        isPrime = false;
        break;
      }
    }
    if (isPrime) primes.push(i);
  }

  return primes;
}


process.stdin.setEncoding('utf8');
process.stdin.on('readable',()=>{
    let input = process.stdin.read();
    if(input){
    input = input.toString().trim();
    let startValue = +input.split(" ")[0];
    let iterations = +input.split(" ")[1];

    for(let i = 0; i < iterations; i++){
        if(startValue % 10 === 0){
            startValue /= 10;
        }else{
            startValue-=1;
        }
    }
    process.stdout.write(startValue.toString());
}
})


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

let y = 1;

rl.on('line', (m) => {
    let x = m.split(' ').map(Number).indexOf(1);

    if (x !== -1) {
        console.log(Math.abs(x + 1 - 3) + Math.abs(y - 3));
    }

    y++;
});


// 479A - Expression
// http://codeforces.com/problemset/problem/479/A

function main() {
    let a = [];
    for (let i = 0; i < 3; i++) {
        a.push(parseInt(read()));
    }
    writeline(Math.max(
        a[0] + a[1] + a[2],
        a[0] * (a[1] + a[2]),
        (a[0] + a[1]) * a[2],
        a[0] * a[1] * a[2]));
    return 0;
}

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


const readline = require('readline');

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

var myArr = [];

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

    /*for (var i = 0; i < myArr.length; i++)
        console.log(myArr[i]);*/
  /*  myArr.forEach(element => {
        console.log("element = " + element + " type of = " + typeof(element));
    });
*/
var n = myArr[0];
var m = myArr[1];
var a = myArr[2];
var x = !(m%a) ? m/a : parseInt((m/a).toFixed(2))+1;
var y = !(n%a) ? n/a :  parseInt((n/a).toFixed(2))+1;

console.log(x*y);

    rl.close();
})


var line = readline().split(" "),
    digits = [],
    a = line[0],
    count = a.length,
    maxDigit = count-1, // крайнее число с которого надо начать
    countD = 0,
    newLine = a.split("");

function sumDigits(number) {
    var s = 0;
    for (var c in number) {
        s += +number[c];
    }
    return s;
};

digits.push(a);
while (countD < count) {
    for (var i = 0; i < count; i++) {
        newLine[maxDigit] = 9; // заменили на 9 текущую 48 -> 49
        countD++; // счётчик девяток
        newLine[(maxDigit-1)] = (new Number(newLine[maxDigit - 1]) > 0 ? --newLine[maxDigit - 1] : 0); // 49 -> 39
        --maxDigit; // перешли от крайнего числа к следующему с края
        var n = newLine.join("");
        (n <= line ? digits.push(n.replace(/^0+/img, "")) : "");
    }
}

var max = sumDigits(digits[0]), maxValue = digits[0];
for (var i = 1, l = digits.length; i < l; ++i) {
    var item = sumDigits(digits[i]);
    if (max < item) {
        max = item;

        maxValue = digits[i];
    }
}

print(maxValue);


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

function main()
{
    const [n,k]=readLine().trim().split(' ').map(a=>{return +(a.trim());});
    let arr=readLine().trim().split(' ').map(a=>{return +(a.trim());});
    let ans=0;
    for(let i=0;i<n;++i)
    {
        if(arr[i]>k)
        {
            break;
        }
        ans++;
        if(i==n-1)
        {
            console.log(ans);
            return;
        }
    }
    for(let i=n-1;i>=0;--i)
    {
        if(arr[i]>k)
        {
            break;
        }
        ans++;
    }
    console.log(ans);
}


//Ultra-Fast Mathematician

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

let inp = '';

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

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

    for(let i = 0; i < lines[0].length; i++)  {
    	process.stdout.write((lines[0][i] == lines[1][i]) ? '0' : '1');
    }

    return;
});


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

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

readLine.on('close', () => {
  let [_num, _del] = input[0].split(' ')
  for (let i = 0; i < _del; i++) {
    if (_num % 10 === 0) {
      _num = _num / 10
    } else {
      _num -= 1;
    }
  }
  console.log(_num)
});


const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        output[i] = solve(n)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n) {
    return 2 - n * n
}


const readline = require('readline');

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

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

const solve = (equation) => {
    let res = '';
    let onesCounter = 0;
    let twosCounter = 0;
    let threesCounter = 0;

    for (let i = 0; i < equation.length; i++) {
        if (equation[i] === '1') onesCounter++;
        else if (equation[i] === '2') twosCounter++;
        else if (equation[i] === '3') threesCounter++;
    }

    while (onesCounter != 0) {
        res += '1+'
        onesCounter--;
    }

    while (twosCounter != 0) {
        res += '2+'
        twosCounter--;
    }

    while (threesCounter != 0) {
        res += '3+'
        threesCounter--;
    }

    if (res[res.length - 1] === '+') return res.slice(0, res.length - 1);
    else return res;
}


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

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

readLine.on('close', () => {
  let nums = input[0].split(' ').map(x => parseInt(x));
  nums.sort((a, b) => a - b);
  console.log( Math.abs(nums[1]-nums[0]) + Math.abs(nums[2]-nums[1]) );
});


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

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

const horseShoe = () => {
    let ar = input[0].split(' ');
    let ar2 = new Set(ar);

    console.log(4 - ar2.size);
};

readLine.on('close', horseShoe);


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

rl.on('line', (line) => {
    const x = Number(line);
    const r = x % 5;
    const q = (x - r) / 5;
    const z = r ? 1 : 0;
    console.log(q + z);
});


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

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

  return gcd(b, a % b);
}

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

  if (n % 2 === 1) {
    a = Math.floor(n / 2);
    b = Math.ceil(n / 2);
  }
  else {
    const mid = n / 2;
    a = mid - 1;
    b = mid + 1;
  }

  while (gcd(a, b) !== 1) {
    a--;
    b++;
  }

  console.log(a, b);
});


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

const isPalindrome = (s) => {
  return s === [...s].reverse().join('');
}

const getLexicalLarger = (a, b) => {
  const arr = [a, b];
  const [r] = arr.sort().reverse();

  return r;
}

rl.on('line', (str) => {
  let best = '';
  const len = 2 ** str.length;

  for (let i = 0; i < len; i++) {
    const seq = i.toString(2).padStart(str.length, 0);
    let curr = '';

    for (let j = 0; j < seq.length; j++) {
      if (seq[j] === '1') {
        curr += str[j];
      }
    }

    if (isPalindrome(curr)) {
      best = getLexicalLarger(best, curr);
    }
  }

  console.log(best);
});


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

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var s = next();
  var output = "";
  var count = 1;
  var index = 0;
  while(index < N){
  	output += s[index];
  	index += count;
  	count++;
  }
  myout(output);
}


process.stdin.setEncoding('ASCII');

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

process.stdin.on('end', () => {
    const array = string.trim().split('\n');
    const line = array[0].split(' ').map(Number);

    let n = line[0], d = line[1];
    let cost = array[1].split(' ').map(Number);
    let visitors = Number(array[2]);

    cost.sort((a, b) => a - b);

    let profit = 0;
    for (let i = 0; i < cost.length; ++i) {
        if (visitors == 0) break;
        profit += cost[i];
        visitors--;
    }

    profit -= (visitors * d);
    console.log(profit);
});


var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const n = rn();

		const s = new Set();
		for (let i = 1; i*i <= n; i++)
			s.add(i*i);

		for (let i = 1; i*i*i <= n; i++)
			s.add(i*i*i);

		console.log(s.size);
	}
}


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

let input = [];

rl.on("line", (line) => {
  input.push(line);
});

rl.on("close", () => {
  console.log(solution(input[0].split(" "), input[1]));
});

const solution = ([n, k], numbers) => {
  let res = 0;
  numbers = numbers.split(" ").map((num) => parseInt(num));
  n = parseInt(n);
  k = parseInt(k);
  for (let i = 0; i < n; i++) {
    if (numbers[i] >= numbers[k-1] && numbers[i] > 0) {
      res += 1;
    } else {
      break;
    }
  }
  return res;
};


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

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

readLine.on('close', () =>
{
    // const nums = input[1].split(' ').map(x => parseInt(x));

    let myString = input[0];

    const dis = function (s)
    {
        let arr = new Set()

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

            for (let j = 0; j < s.length; j++)
            {
                if (s[i] == s[j] && i != j)
                {

                    arr.add(s[j])
                    break
                }

            }
        }
        return arr
    }

    let count=0

    let mySet = dis(myString)

    for (let i = 0; i < myString.length; i++) {
        if (!mySet.has(myString[i])) {
            count++
        }

    }
        count= count + mySet.size
    if (count%2==0) {
        console.log('CHAT WITH HER!');

    }else {
        console.log('IGNORE HIM!')
    }

});


"use strict";

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

let inputString = "";
let currentLine = 0;

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

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

  main();
});

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

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

  fn(x);
}

function fn(str) {
   let upperCaseCount = 0;
  let lowerCaseCount = 0;

  for (let char of str) {
    if (/[A-Z]/.test(char)) {
      upperCaseCount++;
    } else {
      lowerCaseCount++;
    }
  }

  console.log(
    upperCaseCount > lowerCaseCount ? str.toUpperCase() : str.toLowerCase()
  );

  return upperCaseCount > lowerCaseCount
    ? str.toUpperCase()
    : str.toLowerCase();
}


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

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

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

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

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

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

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

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

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

var n;
function main() {
    for(let r = 0; r < 15; r++) {
        for(let c = 0; c < 15; c++) {
            if (lines[r][c] === '1') {
                print(Math.abs(3-1-r)+Math.abs(3-1-c))
                exit()
            }
        }
    }
}


let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  var [n, k] = readLine().split(" ").map(Number);
  for (let i = 0; i < k; i++) {
    if (n % 10 === 0) {
      n = n / 10;
    } else {
      n = n - 1;
    }
  }
  console.log(n);
}


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

    this.solveCase = function() {
        var res , i , j , fl , cn , a , b , c ;
        res = 26 ;
        cn = this.s.length ;
        for( i = 0 ; i < cn ; i++ ) {
            res += 25 ;
        }
        print( res ) ;
    } ;

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

    this.getInput = function( irObj ) {
        var hasMoreInput , i ;
        hasMoreInput = true ;
        try {
            this.s = irObj.nextString() ;
        }
        catch( ex ) {
            hasMoreInput = false ;
        }
        return hasMoreInput ;
    } ;

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

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

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

    this.init() ;
}

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

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

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

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

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

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

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

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData ;
        fsObj = require( 'fs' ) ;
        currentDirectory = __dirname ;
        if( currentDirectory.indexOf( 'D:' ) != -1 ) {
            //on windows
            inputFilePath = currentDirectory + '\\' + inputFileName ;
        }
        else {
            //on linux
            inputFilePath = currentDirectory + '/' + inputFileName ;
        }
        rawData = fsObj.readFileSync( inputFilePath , "utf8" ) ;
        this.parseRawData( rawData ) ;
    } ;

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

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

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

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

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

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

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

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

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath ;
        res = '' ;
        sz = this.resultantStringArray.length ;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += '\n' ;
            }
            res += this.resultantStringArray[ i ] ;
        }
        fsObj = require( 'fs' ) ;
        currentDirectory = __dirname ;
        if( currentDirectory.indexOf( 'D:' ) != -1 ) {
            //on windows
            outputFilePath = currentDirectory + '\\' + outputFileName ;
        }
        else {
            //on linux
            outputFilePath = currentDirectory + '/' + outputFileName ;
        }
        fsObj.writeFileSync( outputFilePath , res ) ;
        this.clearPercase() ;
    } ;
}

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

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

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

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

    this.configureStreamsAndReadInput() ;
}

new CodeExecutioner() ;


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
const points = {
  q: 9,
  r: 5,
  b: 3,
  n: 3,
  p: 1
};
let white = 0;
let black = 0;

rl.on('line', (str) => {
  for (let i = 0; i < str.length; i++) {
    if (['Q', 'R', 'B', 'N', 'P'].includes(str[i])) {
      white += points[str[i].toLowerCase()];
    }

    if (['q', 'r', 'b', 'n', 'p'].includes(str[i])) {
      black += points[str[i]];
    }
  }
  c++;
});

rl.on('close', () => {
  if (white > black) {
    console.log('White');
  }
  else if (white < black) {
    console.log('Black');
  }
  else {
    console.log('Draw');
  }
})