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

var k = Number(g[0]);
var n = Number(g[1]);
var s = Number(g[2]);
var p = Number(g[3]);

print(Math.ceil(Math.ceil(n/s)*k/p))


function main() {
	var capi = "ABCD"
	var choi = []
	var good = []

	for (var i = 0; i < 4; i++) {
		choi[i] = readline().substr(2)
	}

	for (var i = 0; i < 4; i++) {
		var flag = 2
		for (var j = 0; j < 4; j++) {
			if (i != j && choi[i].length < choi[j].length * 2) {
				flag--;
				break
			}
		}
		for (var j = 0; j < 4; j++) {
			if (i != j && choi[i].length * 2 > choi[j].length) {
				flag--;
				break
			}
		}
		if (flag > 0) {
			good.push(capi[i])
		}
	}

	//print(good)
	if (good.length == 1)
		print(good[0])
	else
		print('C')
}

main()


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

rl.on('line', (str) => {
  str = str.replace(/--/g, 2);
  str = str.replace(/-\./g, 1);
  str = str.replace(/\./g, 0);

  console.log(str);
});


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

const distance = (x1, x2, y1, y2) => {
  return (x1 - x2)**2n + (y1 - y2)**2n;
}

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

  const [x, y] = d.split(' ').map(BigInt);
  const white = distance(1n, x, 1n, y);
  const black = distance(m, x, m, y);

  if (black < white) {
    console.log('Black');
  }
  else {
    console.log('White');
  }

  c++;
});


var tmp = readline().split(' ');
var n = tmp[0];
var k = parseInt(tmp[1]);
var r = 0;
for(var i = n.length - 1; i >= 0; i -= 1) {
  if(n[i] === '0') {
    k -= 1;
  } else {
    r += 1;
  }
  if(k === 0) {
    break;
  }
}

if(k > 0) {
  r = n.length - 1;
}

print(r);


/**
 * Problem - http://codeforces.com/contest/1084/problem/A
 */

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

var input_stdin = '';
var input_stdin_array = '';
var input_currentline = 0;

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

process.stdin.on('end', function () {
  input_stdin_array = input_stdin.split('\n');
  main();
});

function readLine() {
  return input_stdin_array[input_currentline++];
}

function main() {
    let numFloors = Number(readLine());
    let floors = readLine().split(' ').map(Number);
    let minCost = Number.POSITIVE_INFINITY;

    for ( let i = 0 ; i < numFloors ; i++ ) {
        let currentX = i;
        let currentCost = 0;
        floors.forEach( function( numPeople, currentFloor ) {
            currentCost = currentCost + numPeople * 2 * ( Math.abs ( currentX - currentFloor ) + Math.abs( currentFloor ) + Math.abs( -currentX ) );
        } );
        if ( currentCost < minCost ) {
            minCost = currentCost;
        }
    }
    process.stdout.write(String(minCost));
    process.exit();
}


const CODEFORCES_NODE = "cf";
const CODEFORCES_V8 = "cf-v8";
const BEAKJOON = "bj";
const TEST = "test";
var SITE = CODEFORCES_NODE;
process.argv.forEach(function(val, index, array) {
  // console.log(index + ': ' + val);
  if (val.startsWith("site")) {
    switch (val.split("=")[1]) {
      case "test":
        // console.log('change site to test')
        SITE = TEST;
        break;
      case "cf-node":
        // console.log('change site to cf')
        SITE = CODEFORCES_NODE;
        break;
      case "cf":
        // console.log('change site to cf')
        SITE = CODEFORCES_NODE;
        break;
      case "cf-v8":
        // console.log('change site to cf')
        SITE = CODEFORCES_V8;
        break;
      case "bj":
        // console.log('change site to bj')
        SITE = BEAKJOON;
        break;
    }
  }
});

const DEBUG = SITE == "test";
const newLine = '\n';
if(CODEFORCES_NODE){  //NODE doesn't have readline so make it
  var readline;
  var print;
  print = console.log;
  var it;
}
var ans;
var text = "";
var lineCount = 0;
var lines;
function solve() {
  const [n,b] = readInts();
  const arr = readInts();
  it(n, b);
  it(arr);
  //먼저 홀짝 쌍을 전부 세면서 동시에 cost도 셀 수 있나?
  //그렇다면 각 cuttable point에 대해 세자!
  var countingGroup = false;
  var balance = 0;
  var cutpoints = [];
  for (let i = 0; i < arr.length; i++) {
    const el = arr[i];
    if(el % 2 == 0)
      balance += 1;
    else
      balance -= 1;
    if(!countingGroup){
      //balance는 당연히 안맞을 것.
      it('counting started', i);
      countingGroup = true;
    }
    else if(countingGroup && balance == 0){
      if(i+1 == arr.length){
        break;
      }
      countingGroup = false;
      cutpoints.push({'pos': i+1, 'price': Math.abs(arr[i+1] - arr[i])});
      it('counting stopped', i);
    }
  }
  it(cutpoints);
  cutpoints.sort((x,y)=>{
    return x.price - y.price;
  });
  if(cutpoints.length == 0){
    print(0);
    return;
  }
  const prices = cutpoints.map((x)=>{return x.price;});
  it(prices);
  var cost = 0;
  var cur = 0;
  while (cost < b) {
    cost += prices[cur];
    cur++;
    if(cost > b){
      cur-=1;
      break;
    }
    if(cur == prices.length){
      break;
    }
  }
  print(cur);
}
function* getlines(text) {
  var lines = text.split(/\r?\n/);
  for (let line of lines) {
    yield line + newLine;
  }
}
function readline() {
  return lines.next().value.trim();
}
function readInts() {
  return readline()
    .split(" ")
    .map(function(x) {
      return parseInt(x);
    });
}
var input;
if (DEBUG) {
  var fs = require("fs");
  input = fs.createReadStream("input.txt", {encoding:"utf8"});
  it = print;
  // lines = getlines(fs.readFileSync("input.txt", "utf8"));
  // let data = "";
  // data += readline().toString();

  // data += readline().toString();
  // require("fs").writeFile("output.txt", data, "utf8", function(err) {
  //   console.log("비동기적 파일 쓰기 완료");
  // });
  // console.log(process.stdin);
}
else {
  input = process.stdin;
  it = function it(params) {
    return 0;
  }
}
if (CODEFORCES_NODE) {
  function inputListener(line) {
    if (!line) {
      closing();
    }
    lineCount++;
    text += line + "\r\n";
  }
  function closing(){
    lines = getlines(text);
    solve();
    process.exit();
  }
  function readlines() {
    const readline = require("readline");
    const rl = readline.createInterface({
      input,
      output: process.stdout,
      terminal: false
    });
    rl.on("line", inputListener);
    rl.on('close', closing);
  }
  readlines();
}
// console.log('hallo!!!')


var params = readline().split(' ').map(Number);
var a = params[0];
var b = params[1];
var c = params[2];

if((a === b) || (c !== 0 && ((b - a) % c === 0) && ((b - a) / c > 0)))
	print("YES");
else
	print("NO");


var tiles = readline().split(" ").map(function(x) { return (x) });
tiles.sort();

var first = tiles[0][1];
var second = tiles[1][1];
var third = tiles[2][1];

var firstNo = tiles[0][0];
var secondNo = tiles[1][0];
var thirdNo = tiles[2][0];

if (first != second && first != third && second != third){
    print (2);
}
else if (first == second && first == third && second == third){
    if ((firstNo == secondNo && firstNo == thirdNo && secondNo == thirdNo) || (secondNo - firstNo == 1 && thirdNo - secondNo == 1)){
        print(0);
    }
    else if ((secondNo - firstNo > 2 && secondNo != thirdNo) && (thirdNo - secondNo > 2 && firstNo != secondNo)){
        print(2);
    }
    else {
        print(1);
    }
}
else if (first == second){
    if(secondNo - firstNo < 3){
        print(1);
    }
    else {
        print(2);
    }
}
else if (second == third){
    if(thirdNo - secondNo < 3){
        print(1);
    }
    else {
        print(2);
    }
}
else if (first == third){
    if(thirdNo - firstNo < 3){
        print(1);
    }
    else {
        print(2);
    }
}


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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {

    const friends = readLine().split(' ').map(aTemp => parseInt(aTemp, 10));

 let distance = 0;

  for (let i = 1; i < friends.length; i++) {
    let current = friends[i];

    let index = i;

    while (index >= 0 && current < friends[index - 1]) {
      friends[index] = friends[index - 1];
      index--

    }
    friends[index] = current;
  }
  distance = friends[2] - friends[0];
  console.log(distance);

}


var n = +readline(), result = n;

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

write(result);


var n = parseInt(readline());
var s = readline();
var arr = [];
var result = "";
var subArr;

for(var i = 0; i < n; i++)
{
    arr.push(s[i]);
}

for(var i = 1; i < n + 1; i++)
{
    if(n % i == 0)
    {
        subArr = arr.slice(0, i);
        subArr.reverse();

        for(var j = 0; j < i; j++)
        {
            arr[j] = subArr[j];
        }
    }
}

for(var i = 0; i < n; i++)
{
    result += arr[i];
}

print(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*/
    let count = lines[0];

   	let putted = 0;

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

	console.log(putted);
})


(function main() {
    var s = readline();
    var re = /^(http|ftp)(.+)ru(.*)$/;
    var res = re.exec(s);
    var rs = res[1] + '://' + res[2] + '.ru';
    if (res[3])
        rs += '/' + res[3];
    print(rs)
})();


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

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

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


/**
 *
A word or a sentence in some language is called a pangram if all the characters of the alphabet of this
language appear in it at least once. Pangrams are often used to demonstrate fonts in printing or test the output devices.

You are given a string consisting of lowercase and uppercase Latin letters.
 Check whether this string is a pangram. We say that the string contains a letter of the Latin alphabet
 if this letter occurs in the string in uppercase or lowercase.

 */
'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();
    });

    pangram(inputString[0], inputString[1]);
});

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

function pangram(stringLength, word) {

    let line = readline()
    let alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
    let stringToMap = {};
    let occurance = {};
    word = word.toLowerCase();

    for (let index = 0; index < stringLength; index++) {
        stringToMap[word[index]] = 1;
    }

    for (let index = 0; index < alphabet.length; index++) {
        if (stringToMap[alphabet[index]])
            occurance[alphabet[index]] = 1
    }

    if (Object.keys(occurance).length == alphabet.length)
        console.log('YES');

    else
       console.log('NO');
}


'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', 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 [Limak , Bob] = readline().split(" ");
    let years =1;
    while (true){

        Limak*=3;
        Bob*=2;
        if (Limak > Bob)
            break;

        years++
    }
    console.log(years);
    return ;
}


"use strict";

var n = parseInt(readline());

var m = parseInt(readline());

var arr = [];
for(let i = 0; i<n; i++) {
    arr.push(parseInt(readline()));
}
function sortnum(a,b) {
    return a - b;
}
arr.sort(sortnum);
var maxppl = arr[n-1];

var maxk = maxppl+m;
for(let i = 0; i<n; i++) {
    if(m===0) break;
    let remain = maxppl-arr[i];
    m -= Math.min(m, remain);
}
var mink = maxppl;
mink += parseInt(m/n);
if(m%n>0) {
    mink += 1;
}
print(`${mink} ${maxk}`);


'use strict'

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

if(b.indexOf(a[0])!==-1||b.indexOf(a[1])!==-1)
    print('YES');
else
    print('NO');


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

  for (let i = 1; i <= 5; i++) {
    if ((sum + i) % len !== 1) count++;
  }
  console.log(count);
}


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

rl.on('line', (data) => {
  let [a, b, c, d] = data.split(' ').map(Number);
  let p1Points = Math.max(3*a/10, a - (a / 250) * c);
  let p2Points = Math.max(3*b/10, b - (b / 250) * d);

  if (p1Points === p2Points) {
    console.log('Tie');
  }
  else if (p1Points > p2Points) {
    console.log('Misha');
  }
  else {
    console.log('Vasya');
  }

  count++;
});


;(function () {

	print(function (x, y, n) {
		x = [x, y, y - x, -x, -y, x - y][n % 6]; y = 1000000007;
		while (x < 0) { x = y + x;}
		return x % y;
	}.apply(0, readline().split(' ').map(Number).concat(+readline() - 1)));

}).call(this);


main(readline());

function parseNMA(n, m, a){
  return Math.ceil(n/a) * Math.ceil(m/a);
}

function main(line){
  var nma = line.split(" ");
  var n = parseInt(nma[0]);
  var m = parseInt(nma[1]);
  var a = parseInt(nma[2]);
  print(parseNMA(n, m, a));
}


// Plate Game - https://codeforces.com/problemset/problem/197/A

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

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

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


var numbers = readline().split(' ').map(Number)

var ref = {}
for (var i = 1; i <= numbers[0]; i++) {
  var n = 5 - (i % 5)
  if (ref.hasOwnProperty(n)) {
    ref[n] += 1
  } else {
    ref[n] = 1
  }
}

var nbOfPair = 0
for (var i = 1; i <= numbers[1]; i++) {
  var n = i % 5
  if (ref.hasOwnProperty(n)) {
    nbOfPair += ref[n]
  } else if (n === 0 && ref[5]) {
    nbOfPair += ref[5]
  }
}

print(nbOfPair)


var arr = readline().split(' ');
var n = parseInt(arr[0]);
var k = parseInt(arr[1]);
var arr = readline().split(' ');
var sum = 0;
for (var i = 0; i < arr.length; i ++)
{
    sum += parseInt(arr[i]);
}
var i = 0;
while(sum/(n+i) < (k-0.5))
{
    i ++;
    sum += k;
}
print(i);


function main()
{
    var tmp = readline().split(" ").map(function (x){ return parseInt(x); });
    var x = tmp[0],
        t = tmp[1],
        a = tmp[2],
        b = tmp[3],
        da = tmp[4],
        db = tmp[5];
    if ( x == 0 )
    {
        print("YES");
        return;
    }
    for ( var i = 0; i < t; i++ )
    {
        for ( var j = 0; j < t; j++ )
        {
            if ( a+b == x || a == x || b == x )
            {
                print("YES");
                return;
            }
            b -= db;
        }
        a -= da;
        b = tmp[3];
    }
    print("NO");
}

main();


function pd(x) {
    for (var i = 2; i <= x; i++) {
        if (i * i > x) break;
        if (x % i === 0) return 0;
    }
    return 1;

}

t = +readline();

if (t % 2 === 0) {
    if (pd(t) == 1) {
        print("1");
    }
    else {
        print("2");
    }
}
else {
    if (pd(t)) {
        print("1");
    }
    else if (pd(t - 2) === 1) {
        print("2");
    }

    else if (pd(t - 2) === 0) {
        print("3")
    }

}


var n=+readline();
var a=readline().split(' ').map(Number);
var sum=a.reduce(function(a, b){return a+b;});

var s0=0;
var s1=0;
var a0=[];
var a1=[];
for(var i=0; i<n+2; i++){
	if(a[i]==1){
		s1++;
	}else{
		s0++;
	}
	a0[i]=s0;
	a1[i]=s1;
}
var ans=-100;
for(var i=0; i<n; i++){
	var left1=a1[i-1]||0;
	var left0=a0[i-1]||0;
	for(var j=i; j<n; j++){
		ans=Math.max(ans, left1+a0[j]-left0+a1[n-1]-(a1[j]||0));
	}
}
print(ans);


;(function () {

	var m = [];
	for (var i = 0; i < 5; i++) m.push(readline().split(' ').map(Number));

	var t = 0, k = [];
	for (var a = 0; a < 5; a++)
		for (var b = 0; b < 5; b++)
			for (var c = 0; c < 5; c++)
				for (var d = 0; d < 5; d++)
					for (var e = 0; e < 5; e++)
						if (dif(a, b, c, d, e))
							t = Math.max(t, sum(a, b, c, d, e));

	print(t);

	function sum (a, b, c, d, e) {
		return 0
			+ m[a][b] + m[b][a] + m[c][d]
			+ m[d][c] + m[c][b] + m[b][c]
			+ m[d][e] + m[e][d] + m[c][d]
			+ m[d][c] + m[d][e] + m[e][d];
	}

	function dif (a, b, c, d, e) {
		var m = {}; m[a] = true; m[b] = true;
		m[c] = true; m[d] = true; m[e] = true;
		return Object.keys(m).length === 5;
	}

}).call(this);


var line = readline().split(' ');
var w = line[0];
var h = line[1];
var k = line[2];
var ans = 0;
for (var i = 1; i <= k; i++) {
    var a = w - 4*(i -1);
    var b = h - 4*(i -1);
    ans += 2*a + 2*(b-2);
}
write(ans);


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

t.reverse();

if(s == t.join('')) {
    write('YES');
} else {
    write('NO');
}


var num = readline().split(" ").map(x => parseInt(x));
var n,m,count;
n=num[0],m=num[1],count=0;
for(var i = 0;i<=n+m;i++){
    for(var j = 0;j<=n+m;j++){
        if(i*i+j == n &&j*j+i ==m){
            count =count+1;
        }
    }
}

print(count);


function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i], 10);
	};
	return tokens;
}

function main() {
	var data = tokenizeIntegers(readline()),
		ballNum = data[0], colorNum = data[1], ball = data[2],
		balls = tokenizeIntegers(readline()),
		maxDestroyed = 0;
	for (var pos = 1; pos < ballNum; ++pos) {
		var countDestroyed = -1,
			destroy = [];
		for (var i = 0; i < ballNum; ++i) {
			if (i == pos) {
				destroy.push(ball);
			}
			destroy.push(balls[i]);
		}
		while (destroy.length != 0) {
			var color = destroy[0], count = 1;
			for (var i = 1; i < destroy.length; ++i) {
				if (destroy[i] == color) {
					++count;
					if (count == 3) {
						var begin = i-2, end = i;
						while (end+1 < destroy.length && destroy[end+1]==color){
							++end;
						}
						countDestroyed += end-begin+1;
						var newDestroy = [];
						for (var j = 0; j < destroy.length; ++j) {
							if (j < begin || j > end) {
								newDestroy.push(destroy[j]);
							}
						}
						destroy = newDestroy;
						break;
					}
				} else {
					color = destroy[i];
					count = 1;
				}
			}
			if (count < 3) {
				break;
			}
		}
		maxDestroyed = Math.max(maxDestroyed, countDestroyed);
	}
	print(maxDestroyed);
}

main();


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

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

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

  let sum = 0;
  let days = 0;
  while (k > 0 && days < n) {
    sum += arr[days];
    let maxCandies = Math.min(8, sum);

    k -= maxCandies;
    sum -= maxCandies;
    days++;
  }

  if (k > 0) {
    console.log(-1);
  }
  else {
    console.log(days);
  }

  c++;
});


var row = readline().split(" ").map(function(x) { return parseInt(x); });
var n = row[0];
var k = row[1];

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

var b = [];
b = readline().split(" ").map(function(x) { return parseInt(x); });

var result = true;
var max = 0;

//Check unique
for(var i = 0; i < b.length; i++) {
	for(var j = 0; j < a.length; j++) {
		if(parseInt(b[i]) == parseInt(a[j]))
			result = false;
	}
}

if(result) {
	//Check increase
	b.sort();
	b.reverse();
	var bNum = 0;

	for(var i = 0; i < a.length; i++) {
		if(parseInt(a[i]) == 0) {
			a[i] = b[bNum];
			bNum++;
		}
	}

	for(var i = 0; i < a.length - 1; i++) {
		if(parseInt(a[i]) > parseInt(a[i+1]))
			result = false;
	}

	if(!result)
		print("YES");
	else
		print("NO");
}


var line=readline().split(" ");
n=parseInt(line[0]) - 1;
m=parseInt(line[1]);

a=n%(m-1);
b=(n-a)/(m-1)*m;
print(a+b+1);


var n = readline();
var s = readline().split('').map(Number);
var s1 = s.slice(0, n);
var s2 = s.slice(n);
s1.sort((a,b) => a-b);
s2.sort((a,b) => a-b);
var count = 0;
var ans = '';
for (var i=0; i<n; i++){
	if (s1[i] > s2[i]) count++;
	else if (s1[i] == s2[i]) ans = 'NO';
}
if ((count == 0 || count == n) && ans != 'NO') print ('YES');
	else print ('NO');


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

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

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

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

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

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

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

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

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

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


var points = [];
var input = readline().split( " " ).map( i => parseInt( i, 10 ) );
points[ 0 ] = { x: input[ 0 ], y: input[ 1 ] };
input = readline().split( " " ).map( i => parseInt( i, 10 ) );
points[ 1 ] = { x: input[ 0 ], y: input[ 1 ] };
input = readline().split( " " ).map( i => parseInt( i, 10 ) );
points[ 2 ] = { x: input[ 0 ], y: input[ 1 ] };

var variants = [];
for ( var i = 0; i < points.length; ++i ) {
  var anglePoint = points[ i ];
  var nextPoint = points[ (i + 1) % points.length ];
  var shiftPoint = points[ (i + 2) % points.length ];
  var shift = { x: nextPoint.x - anglePoint.x, y: nextPoint.y - anglePoint.y };
  variants.push( { x: shiftPoint.x + shift.x, y: shiftPoint.y + shift.y } );
}

var result = "";
for ( var i = 0; i < variants.length; ++i ) {
  result += variants[ i ].x + " " + variants[ i ].y + "\n";
}
print( variants.length );
print( result  );


"use strict";

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

let inputString = "";
let currentLine = 0;

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

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

  main();
});

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

function main() {

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

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

function carrotCakes(n, t, k, d) {

  let t1 = (n * t) / k;

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

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

    tt1++;
  }

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

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

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

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

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

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

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

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

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


var n = parseInt(readline());

print(Math.round(n / 10) * 10);


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

rl.on('line', (str) => {
  let letters = 'abcdefghijklmnopqrstuvwxyz';
  let ans = 0;

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

    let idx = 0;
    while (letters[idx] !== c) {
      idx = (idx + 1) % 26;

      if (letters[idx] === c) {
        ans += Math.min(idx, 26 - idx);
        break;
      }
    }

    letters = letters.slice(idx) + letters.slice(0, idx);
  }

  console.log(ans);
});


function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var pointNum = parseInt(readline());
	var points = tokenizeIntegers(readline());

	for (var i = 3; i < pointNum; ++i) {
		var leftA = Math.min(points[i-1], points[i]),
			rightA = Math.max(points[i-1], points[i]);
		for (var j = i-2; j > 0; --j) {
			var leftB = Math.min(points[j-1], points[j]),
				rightB = Math.max(points[j-1], points[j]);
			if (Math.min(rightA, rightB) <= Math.max(leftA, leftB)) {
				continue;
			}
			if (leftA >= leftB && rightA <= rightB) {
				continue;
			}
			if (leftB >= leftA && rightB <= rightA) {
				continue;
			}
			print("yes");
			return;
		}
	}

	print("no");
}

main();


var s = +readline(),
    max = 0,
    res

for (var i = 1 ; i < s/2 ; i++) {
    if ((i/(s-i)) > max && pgcd(s-i,i) == 1) {
        max = i/(s-i)
        res = i
    }
}

print([res, s-res].join(' '))

function pgcd(a, b) {
    if (b === 0) return a
    return pgcd(b,a%b)
}


var strN = readline(),
			numN = parseInt(strN);

			for(var i = 1;; i++)	{
				var temp = numN + i;

				if(temp.toString().indexOf('8') >= 0)	{
					print(i);
					break;
				}
			}


var getNums = function() {
	return readline().split(' ').map(function(a) {return parseInt(a)});
};

var d = getNums();

var n = d[0];
var x1 = d[1];
var y1 = d[2];
var x2 = d[3];
var y2 = d[4];

function getZ(x, y, n) {
	if (y === 0) {
		z = x;
	} else if(x === n) {
		z = n + y;
	} else if (y == n) {
		z = 2 * n + (n - x);
	} else {
		z = 3 * n + (n - y);
	}
	return z;
}

var z1 = getZ(x1, y1, n);
var z2 = getZ(x2, y2, n);

var s1 = Math.abs(z1 - z2);
var s2 = Math.min(z1, z2) + 4 * n - Math.max(z1, z2);

print(Math.min(s1, s2));


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

var ans = [];

for (var i = 2; i * i <= n; ++i) {
	var cnt = 0;

	while (n % i == 0 && ans.length + 1 < k) {
		ans[ans.length] = i;
		n /= i;
	}
}

if (n > 1) {
	ans[ans.length] = n;
}

if (ans.length != k) {
	print(-1);
} else {
	var ansstr = ans.join(' ');
	print(ansstr);
}


var g = Number(readline());

var str = "";
for(i=1;i<=g;i++){
    str += String(i);
}

print(str[g-1]);


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

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

function main() {
	const exp = readLine().split('+').sort().join('+');
	console.log(exp);
}


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

if ( n <= 1 ) print(0);
else if ( n === 2 ) print(Math.min(a,b));
else print(Math.min(a,b) + Math.min(a, Math.min(b,c)) * (n-2))


// triangleNumbers[44722] < 10^9 (max input given in problem)
const MAX_INPUT_SIZE = 44722;
const triangleNumbers = new Array(MAX_INPUT_SIZE);
var sum = 0;

for(var i = 0; i < MAX_INPUT_SIZE; i++){
    sum = sum + i;
    triangleNumbers[i] = sum;
}

function binarySearch(arr, searchVal){
    var low = 0;
    var high = arr.length - 1;

    while(low <= high) {
        var midpoint = low + Math.floor((high-low)/2);
        if(arr[midpoint] === searchVal){
            return midpoint;
        }
        else if(arr[midpoint] < searchVal){
            low = midpoint + 1;
        }
        else if(arr[midpoint] > searchVal){
            high = midpoint - 1;
        }
    }
    return -(low + 1);
}

function solution(n){
    // returns how deep in triangleNumbers array to search until
    var limit = Math.abs(binarySearch(triangleNumbers, n));

    for(var i = 1 ; i < limit; i++){
        var someIndex = binarySearch(triangleNumbers, n-triangleNumbers[i]);
        if(someIndex > 0) {
            print("YES");
            return;
        }
    }
    print("NO");
}

const n = readline();
solution(parseInt(n));


function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i], 10);
	};
	return tokens;
}

function main() {
	var n = parseInt(readline()), apples = tokenizeIntegers(readline()),
		counts = { 100: 0, 200: 0 };
	for (var i = 0; i < n; ++i) {
		counts[apples[i]] += 1;
	}
	if (counts[200] % 2 == 0) {
		print(counts[100] % 2 == 0 ? "YES" : "NO");
	} else {
		if (counts[100] < 2) {
			print("NO");
		} else {
			print((counts[100] - 2) % 2 == 0 ? "YES": "NO");
		}
	}
}

main();


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

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

  const arr = d.split(' ').map(Number);
  let idx = 1;
  let ans = Infinity;

  while (idx < arr.length - 1) {
    let height = -Infinity;

    for (let i = 0; i < arr.length - 1; i++) {
      if (idx === i) {
        continue;
      }

      const nextItem = i + 1 === idx ? i + 2 : i + 1;
      height = Math.max(height, arr[nextItem] - arr[i]);
    }

    ans = Math.min(ans, height);
    idx++;
  }

  console.log(ans);

  c++;
});


"use strict";
var input = '';
var inputResolve;
var inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => {
    inputResolve();
});
(async () => {
    // var time = Date.now();
    await inputPromise;
    var inputs = input.split(/\r?\n/);
    var n = +inputs[0];
    var s = 0;
    for (let i = 1; i <= 1024; i++) {
        if (+i.toString(2) <= n)
            s++;
    }
    console.log(s);
})();


var line = readline()
var total = [];
for (var i = 0; i < line.length; i++) {
    total.push(0);
}

function add(index, v) {
    total[index] += v;
    if (index >= 1) {
        total[index - 1] += v;
    }
    if (index < total.length - 2) {
        total[index + 1] += v;
    }
}

for (var i = 0; i < line.length; i++) {
    if (line[i] === 'A') {
        add(i, 1);
    }
    if (line[i] === 'B') {
        add(i, 2);
    }
    if (line[i] === 'C') {
        add(i, 4);
    }
}

var ok = false;

for (var i = 0; i < line.length; i++) {
    if (total[i] === 7) {
        ok = true;
    }
}
print(ok ? 'YES' : 'NO');


var arr = readline().split(' ').map(function (i) {
    return parseInt(i);
}),
n = arr[0],
m = arr[1],
z = arr[2];

function UCLN (a, b) {
    var temp;
    while (b !== 0) {
         temp = a % b;
         a = b;
         b = temp;
     }
     return a;

}

function BCNN (x, y) {
    return x * y / UCLN(x, y);
}

print(Math.floor(z / BCNN(n, m)));


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

var r = 0;

for (var index in m){

	var i = m[index];

    if('0123456789'.indexOf(i) != -1){
        if(i % 2 == 1){
            r++;
        }
        continue;
    }

    if('aeiou'.indexOf(i) != -1){
        r++;
    }
}

print(r);


'use strict'
const n = parseInt(readline())
const s = readline().split('')

let out = Array(n).fill(-1)
let ok = true

for (let i = n - 1; i >= 0; --i) {
  if (out[i] === -1) {
    out[i] = 1
  }

  for (let j = i - 1; j >= 0; --j) {
    if (s[j] > s[i]) {
      if (out[j] === -1) {
        out[j] = 0
      } else if (out[j] === out[i]) {
        ok = false
        break
      }
    }
  }
}

print(ok ? 'YES' : 'NO')
print(ok ? out.join(''): '')


// My first java script code :D
if(readline()==2) print(2); else print(1);


var in1 = readline().split(' ');
in1.forEach(function(e, i, arr){
  in1[i] = parseInt(e);
});
var in2 = readline().split(' ');
in2.forEach(function(e, i, arr){
  in2[i] = parseInt(e);
});
in1[0] -= in2[0];
in1[1] -= in2[1];
in1[2] -= in2[2];
if(in1[0] > 0) in1[0] = parseInt(in1[0]/2);
if(in1[1] > 0) in1[1] = parseInt(in1[1]/2);
if(in1[2] > 0) in1[2] = parseInt(in1[2]/2);
if(in1[0]+in1[1]+in1[2] >= 0) print("YES");
else print("NO");


var n = parseInt(readline());
var floor = (n / 2) | 0;
var ceil = n - floor;
var ways = ceil * (ceil + 1 - n % 2);
print(ways);


var getVals = function () { return readline().split(' '); };

var getNums = function () {
	return readline().split(' ').map(function (a) { return parseInt(a) });
};

var inp = getNums();

var igroki = inp.slice(0, 2);
var n = inp[2];

function gcd(a, b) {
	if (a === 0 || b === 0) {
		return(Math.max(a, b));
	}
	for (var i = Math.min(a, b); i >= 0; i--) {
		if (a % i === 0 && b % i === 0) {
			return i;
		}
	}
}

function nextIgrok(a) {
	return a === 0 ? 1 : 0;
}

function printWinner(igrok, n) {
	var min = gcd(igroki[igrok], n);
	var nextIgrokOrWinner = nextIgrok(igrok);
	if (min <= n) {
		n -= min;
		printWinner(nextIgrokOrWinner, n)
	} else {
		print(nextIgrokOrWinner);
		return;
	}
}

printWinner(0, n);


function hasBlackItem(line) {
  var count = 0;
  for(var i = 0; i < line.length; i++) {
    if(line[i] === 'B') {
      count++;
    }
  }
  if(count < 8) {
    return count;
  }
  else {
    return 1;
  }
}
var count = 0;
var lineres = 0;
while((lineres = readline())) {
  lineres = hasBlackItem(lineres);
  count += lineres;
  if(lineres > 1) {
    break;
  }
}
while((lineres = readline())) {
  lineres = hasBlackItem(lineres);
  if(lineres === 1) {
    count++;
  }
}
print(count);


print(function() {
	var i, ans = 'YES';
	for (i = 0; i < 8; i++)
		readline().split('').reduce(function(a, b) {
			if (a === b) ans = 'NO';
			return b;
		});
	return ans;
}());


function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i], 10);
	};
	return tokens;
}

function solve() {
	function foundIn(a, b) {
		var pos = 0;
		for (var i = 0; i < b.length; ++i) {
			if (a.charAt(pos) == b.charAt(i)) {
				if (++pos == a.length) {
					return true;
				}
			}
		}
		return false;
	}
	var s = trim(readline()),
		t = trim(readline());
	if (foundIn(t, s)) {
		return 'automaton';
	}
	s = s.split('').sort().join('');
	t = t.split('').sort().join('');
	if (s == t) {
		return 'array';
	}
	if (foundIn(t, s)) {
		return 'both';
	}
	return 'need tree';
}

print(solve());


// 620B - Brooks Mershon
function segments(r) {
  var a = r[0], b = r[1],
      count = 0,
      digits = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6];

  for (var i = a; i <= b; i++) {
    var display = i.toString().split('');
    for (var k = 0; k < display.length; k++) {
      count += digits[display[k]];
    }
  }

  return count;
}
var range = readline().split(" ").map(function(x) { return parseInt(x); });
print(segments(range));


var count = readline();
var sorted = readline().split(' ').map(s => parseInt(s)).sort((a, b) => {
    return a - b;
});

var minSum = 25000;

for (var first = 0; first < sorted.length; first++) {
    for (var second = first + 1; second < sorted.length; second++) {
        var sum = 0;
        var i = 0;
        while (i < sorted.length) {
            if (i === first || i === second) {
                i++;
                continue;
            }

            var next = i + 1;
            while (next === first || next === second) {
                next++;
            }

            sum += sorted[next] - sorted[i];
            if (sum >= minSum) {
                break;
            }

            i = next + 1;
        }

        if (sum < minSum) {
            minSum = sum;
        }
    }
}

print(minSum);


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


s=readline()
s=s.replace(/Danil/g,"1")
s=s.replace(/Olya/g,"1")
s=s.replace(/Slava/g,"1")
s=s.replace(/Ann/g,"1")
s=s.replace(/Nikita/g,"1")
res=0
for (i=0;i<s.length;i++)
{
    if (s[i]=='1')
    {
        res++
    }
}
if(res==1)
    print("Yes")
else
    print("No")


var input = readline().split(' ');
var inputString = String(input[0]);
var degree = inputString.length;
var result = degree === 1 ? 0 : Math.ceil(degree / 2);
if (result && degree % 2 && !/1/.test(inputString.substring(1))) {
  result -= 1;
}
print(result);


// var _i = 0;
//
// function readline() {
//     _i ++;
//
//     switch (_i) {
//         case 1: return '4000 1 2 3';
//     }
// }
//
// function write(value) {
//     console.log(value);
// }

var list = readline().split(' ').map(function(currentValue) {
    return parseInt(currentValue);
});

var n = parseInt(list[0]);
var a = parseInt(list[1]);
var b = parseInt(list[2]);
var c = parseInt(list[3]);

var max = 0;
var k;

for (var i = 0; i <= Math.floor(n / a); i ++) {
    for (var j = 0; j <= Math.floor(n / b); j ++) {
        if (n - a*i - b *j >= 0 && (n - a*i - b *j) % c == 0) {
            k = (n - a*i - b *j) / c;
            max = Math.max(max, i + j + k);
        }
    }
}

write(max);


var x = readline().split(" ").map( function (x) { return parseInt(x); } );
var n = 0, ans = -1;

for (var i = 0, str = readline(); i < str.length; i++)
    if (str.charAt(i) == '1') n++;

for (var i = 1; i <= n; i++) {
    var nm = parseInt(x[0] / i);
    var cost = (i - x[0] % i) * (x[1] + x[2] * Math.pow(nm - 1, 2)) +
        (x[0] % i) * (x[1] + x[2] * nm * nm);
    if (ans == -1 || cost < ans)
        ans = cost;
}

print(ans);


var readline = require('readline');

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

var lines = [];
let i = 0;
rl.on('line', (line) => {
  lines.push(line);
  i++;
  if(i>lines[0]){
      rl.close();
  }
});

rl.on('close', () => {
  for (let i = 1;i<=lines[0];i++){
      let g = lines[i];
      let e = 0,w=0;
      let p = 0;
      while(p!=g){
        if (p>g)
            w++;
        else
            e++;
        p = getP(e,w);
      }
      console.log(e+w);
  }
});
function getP (e,w){
    return (100*e/(w+e));
}


const readline = require('readline')

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

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

function count(candies,freinds){

	let residue	=	candies%freinds
	let temp	=	[]
	let val = Math.floor(candies/freinds)

	for(let i = 0; i< freinds;i++){
		temp.push(val)
	}

	if(residue != 0){
		let lengthTemp = temp.length
		lengthTemp--
		residue--
		for(let i = residue; i >= 0; i--)	temp[lengthTemp-i]++

	}

	console.info(temp.join(' '))
	rl.close()

}

async function main(){
	let data = await getData()

	data = data.trim().split(' ').map((el)=>{
		return parseInt(el,10)
	})

	count(...data)
}

main()


'use strict'

let s = readline()
let c = +readline()
let ms = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

print(ms[(ms.indexOf(s) + c) % 12])


;(function () {

	var n = +readline();
	var a = readline().split(' ').map(Number);

	function finish() {
		var f = a[0];
		for (var i = 1; i < n; i++) if (a[i] != f) return false;
		return true;
	}

	while (!finish()) {
		var min = Math.min.apply(null, a);
		for (var i = 0; i < n; i++) {
			if (a[i] / min > 1) a[i] -= Math.floor(a[i] / min) * min;
			if (!a[i]) a[i] = min;
		}
	}

	print(a.reduce(function (p, e) { return p + e; }, 0));

}).call(this);


var s=readline();
var c="CODEFORCES";
var ls=s.length;
var isok=false;
for(var i=0;i<ls;i++){
    for(var j=i+1;j<ls+1;j++){
	if(s.substring(0,i)+s.substring(j) == c){
	    isok=true;
	}
    }
}
print(isok?"YES":"NO");


// Alternative
// https://www.npmjs.com/package/competitive-programming-js
"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 input() { return inputString[currentLine++]; }
const println = (x = "") => process.stdout.write(String(x) + "\n");
const print = x => { process.stdout.write(String(x)); }
// >>>>>>>>>>>>> Main starts here <<<<<<<<<<<<<<

function main() {
    let n = input();
    if (n[0] === '-') {
        if (n.length >= 3) {
            if (parseInt(n[n.length-1]) > parseInt(n[n.length-2])) {
                n = n.substr(0, n.length-1);
            } else {
                n = n.substr(0, n.length-2) + n[n.length-1];
            }
        } else {

        }
    };
    n = parseInt(n);
    println(n);
}


var arr=[];
var str=readline().split(" ");
for(var i in str){
	arr.push(Number(str[i]));
}
var fin=new Array(10);
for(var i=0;i<fin.length;i++){
	fin[i]=0;
}
arr.forEach(function(i){
	fin[i]++;
});
var tani=false;
var spilo=false;
var datvi=false;
for(var i=0;i<fin.length;i++){
	if(fin[i]>=4){
		tani=true;
	}
	if(fin[i]==2){
		spilo=true;
	}
	if(fin[i]==1){
		datvi=true;
	}
}
if(tani){
	if(datvi)
		print("Bear");
	else
		print("Elephant");
}else{
	print("Alien");
}


/* TEST CASE
input
6
URLLDR
output
2
input
4
DLUU
output
0
input
7
RLRLRLR
output
12
 */
function main() {
	var n = parseInt(readline());
	var s = readline();
	var answer = 0;

	for (var i = 0; i < n; i++) {
		var x = 0;
		var y = 0;
		for (var j = i; j < n; j++) {
			var c = s.charCodeAt(j);
			if (c == 0x55 /*'U'*/) {
				y--;
			} else if (c == 0x44 /*'D'*/) {
				y++
			} else if (c == 0x4C /*'L'*/) {
				x--;
			} else if (c == 0x52 /*'R'*/) {
				x++;
			}
			if (x == 0 && y == 0) {
				answer++;
			}
		}
	}

	print(answer);
}

main();


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

    B();
});

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

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function A(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());
        let ans = '';
        for(let i = 0; i < n; i++){
            ans += '1 ';
        }
        console.log(ans);
    }
}

function B(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());

        if(n%2===0){
            console.log(n/2, n/2);
            continue;
        }

        let sq = Math.floor(Math.sqrt(n));
        let min = 999999999999999;
        let minPair = [];
        for(let i = 1; i <= sq; i++){
            if(n % i === 0){
                let j = n/i;
                let x = n-i;
                let y = n-j;

                if(x % i === 0){
                    if(min > Math.max(x,i)){
                        min = Math.max(x,i);
                        minPair = [i,x]
                    }
                }

                if(y % j === 0){
                    if(min > Math.max(j,y)){
                        min = Math.max(j,y);
                        minPair = [j,y]
                    }
                }
            }
        }
        console.log(minPair[0], minPair[1]);
    }
}

function C(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());
        let a = ti(readline().split(' '));
        let map = new Array(600000);

        let b = JSON.parse(JSON.stringify(a));
        b.sort((a,b) => a-b);
        for(let i = 0; i < n; i++)
            map[b[i]] = i;

        let preCount = 0;
        let count = 0;
        let flag = false;
        for(let i = 0; i < n; i++){
            if(i === map[a[i]]){
                if(preCount === 1){
                    if(!flag)
                        count += 1;
                    flag = true;
                }else if(preCount !== 0){
                    count += 1;
                    preCount = 0;
                }
            }else{
                preCount += 1;
                flag = false;
            }
        }
        console.log(count);
    }
}


var input = readline().split(' ');
var maxNumber = parseInt(input[0]);
var selectedByMisha = parseInt(input[1]);
var numbersToTheRightOfMisha = maxNumber - selectedByMisha;
if (maxNumber == 1) {
	print(1);
}
else if (numbersToTheRightOfMisha > selectedByMisha - 1) {
	print(selectedByMisha + 1);
} else {
	print(selectedByMisha - 1);
}


function main()
{
  var n, m;

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

  n = parseInt(rr[0]);
  m = parseInt(rr[1]);

  var l = 0;

  while( m!=n)
  {
    if(m>n)
    {
      if(m%2==0)
      {
        m/=2;
      }
      else
      {
        m++;
      }
      l++;
    }
    else
    {
      l = l+(n-m);
      m = n;
    }
  }

  print(l);
}

main();


(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var input = rdArN();
    var n = input[0];
    var k = input[1];
    var A = rdArN();

    var M = {0: []};
    for (var i = 0; i < n; ++i) {
        var a = A[i];
        var pr = 0;
        while (a > 0) {
            if (!M[a]) {
                M[a] = [];
            }
            M[a].push(pr);

            a = (a >> 1);
            ++pr;
        }
        M[0].push(pr);
    }
    //prOb(M)
    //return;
    var res = Infinity;
    for (var key in M) {
        //print(key)
        var ar = M[key];
        //print(ar.length, k)
        if (ar.length >= k) {
            var fullPrice = 0;
            ar.sortLt();
            for (var i = 0; i < k; ++i) {
                fullPrice += ar[i];
            }
            res = Math.min(res, fullPrice);
        }
    }
    print(res);
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();


var s = readline().split(' ').map(Number).sort((a,b)=>a-b);
var m = (x,y)=>{var fun =(a)=>{var r=2*Math.floor(a/3); if (a%3==2){r++;} return r}; if (x<y) {var mi =Math.min(y-x,x); return (mi+fun(x-mi));} else {return fun(x);}};
var p = m.apply(null,s);
print(p);


var nums = readline().split(' ').map(function(x) { return parseInt(x); });
var first = (nums[0] -nums[2])
var second = (nums[1] - nums[2])
var cel = (first + second + nums[2])

print((first < 0 || second < 0) ? -1 : nums[3] > cel ? nums[3] - cel : -1 )


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

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

// var n = 10;
// var p = new Array(50).fill(0);

// p = p.map(function(x, i) {
// 	return Number(i*2 + 2);
// })

var b = 0,
	w = 0;

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

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

print(b > w ? w : b);


var n = Number(readline());
var s = readline();
var a = ["vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon"];
for (var i = 0; i < 8; i++) {
    var t = false;
    if (a[i].length !== n) continue;
    for (var j = 0; j < n; j++) {
        if (s[j] !== '.' && s[j] !== a[i][j]) break;
        if (j === n - 1) {
            print(a[i]);
            t = true;
        }
    }
}


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

const dict = {};
const sortable = [];

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

for (var x in dict) {
  sortable.push([x, dict[x]]);
}

var sorted = sortable.sort(function(a, b) {
  return a[1] - b[1];
});

const res = sorted.map( x => parseInt(x[0])).join(" ");

print(sorted.length);
print(res);


readline();
var a = readline().split( " " ).map( i => parseInt( i, 10 ) );
var i,
  sum,
  answer;
sum = 0;
for ( i = 0; i < a.length; ++i ) {
  sum += a[ i ];
}

if ( sum != 0 ) {
  answer = "YES\n1\n1 " + a.length;
} else {
  for ( i = 0; i < a.length && a[ i ] === 0; ++i ) { }
  if ( i != a.length ) {
    ++i;
    answer = "YES\n2\n1 " + i + "\n" + (i + 1) + " " + a.length;
  } else {
    answer = "NO";
  }
}

print( answer );


function main() {

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

    var k = arr[0], a = arr[1], b = arr[2], v = arr[3];

    var max_nuts = k * v;
    var res = 0;
    if (b < k - 1) {
        var remain = a - (b + 1) * v;
        res++;
        while (remain >= v) {
            remain -= v;
            res++;
        }
        if (remain > 0) {
            res++;
        }
    } else if (b >= k - 1) {

        if (Math.ceil(a / max_nuts) <= Math.floor(b / (k - 1))){
            res = Math.ceil(a / max_nuts);
        } else {

            var full_boxes = Math.floor(b / (k - 1));
            res += full_boxes;
            var left = a - full_boxes * max_nuts;
            var left_divisor = b - full_boxes * (k - 1);
            if (left_divisor > 0) {
                left = left - (left_divisor + 1) * v;
                res++;
            }

            while (left >= v) {
                left -= v;
                res++;
            }

            if (left > 0) {
                res++;
            }
        }
    }

    print(res);

}

main();


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

var n = input[0];
var a = input[1] % n;
var b = (input[2] % n + n) % n;

var k = (b + a) % n;

if (k === 0) {
	k = n;
}

print(k);


//var input = readline()

var ar = readline().split(' ').map(x => parseInt(x));
var a = ar[0], b = ar[1];

if(a < b  &&  Math.abs(a-b) == 1) {
    print(a +' '+ b);
}
else if(a == 9 && b == 1) {
    print(9 +' '+ 10);
}
else print(a == b ? a+'1' +' '+ b+'2' : -1);

//


const readline = require('readline');

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

/*
       012345678910
str = "abcdZZZefgh"

strart = 4
len = 3

       012345
input="///one"
       01234
input="//one"
*/
var eraseAt = function (str, start, len) {
    return str.substring(0, start) + str.substring(start + len);
}

rl.on('line', (input) => {
    /*
    method I.
      for(let i=0; i<input.length-1; i++){
          if(input[i]=='/' && input[i+1]=='/'){
               input=eraseAt(input, i, 1);
               i--;
          }
      }

      if(input.length > 1 && input[input.length-1] == '/')
           input = eraseAt(input ,input.length-1, 1);

      console.log(input);
      rl.close();
      */
    let ans = "", len = input.length, met = false;
    for (let i = 0; i < len - 1; i++) {
        if (input[i] == '/' && input[i + 1] != '/')
            ans += '/';
        else if (input[i] != '/') {
            ans += input[i];
            met = true;
        }
    }
    if (!met || input[len - 1] != '/')
        ans += input[len - 1];

    console.log(ans);

    rl.close();
});


var numbers = readline().split(' ');
var a = numbers[0];
var b = numbers[1];
var c = numbers[2];

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

if(b+c<a && a>b){print('+')}
else if(a<b && a+c<b){print('-')}
  else if( c>0 ||  b+c<a || a+c<b || a===b && b+c===a && a+c===b && a===b===c){print('?')}
    else if(a===b && a>=c && b>=c){print('0')}

   else print('?')


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


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

var count = Number(a[0]);
var place = Number(a[1]);
var diff = place > count / 2 ? count - place : place - 1;

print(count*2 + 1 + count - 1 + diff)


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

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

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


var input = readline().split(" "), n = +input[0], a = +input[1], b = +input[2],
cnt = 0;

for(i = 1; i <= n; i++){
	if((n-i >= a) && (i-1 <= b)){
		cnt++;
	}
}

write(cnt);


const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
let input = [];
rl.on('line', function (line) {input.push(line);});
rl.on('close', function() {
    input.forEach((row, index) => {
        input[index] = row.split(' ').map(i => Number(i));
    })

    let matrix = [[1,1,1], [1,1,1], [1,1,1]];

    for(let i = 0; i < input.length; i++) {
        for(let j = 0; j < input[i].length; j++) {
            if (input[i][j] != 0) {
                for (let n = 0; n < input[i][j]; n++) {
                    matrix[i][j] = (matrix[i][j]) ? 0 : 1;

                    // top
                    if (matrix[i-1]) matrix[i-1][j] = (matrix[i-1][j]) ? 0 : 1;
                    // bottom
                    if (matrix[i+1]) matrix[i+1][j] = (matrix[i+1][j]) ? 0 : 1;

                    // left
                    if (matrix[j-1]) matrix[i][j-1] = (matrix[i][j-1]) ? 0 : 1;
                    // right
                    if (matrix[j+1]) matrix[i][j+1] = (matrix[i][j+1]) ? 0 : 1;
                }
            }
        }
    }

    let result = ''
    matrix.forEach((row) => result += row.join('') + '\n');

    console.log(result);

});


X=readline().split(' ').map(Number)
n=X[0],x=X[1]
A=0
for (i=1;i<=n;++i) {
    if (x % i == 0 && x/i<=n) A++
}
print(A)


function myFunc(n) {
  var result = n/3;
      result = parseInt(result);
      result *= 2;
  var ostatok = n%3;

  switch (ostatok) {
    case 1:
    case 2:
      result += 1;
      break;
    case 3:
      result += 2;
  }
  return result;
}

print(myFunc(readline()));


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


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


var arr = readline().split(' ').map(item => +item);
var n = arr[0]; k = arr[1];
var i = 0;
var sum = 0;

while(n > 0) {
  i++;
  n--;
  sum += i;
  if(sum >= k && n === sum - k) {
    break;
  }
}

print(n);


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


var numBooks = parseInt(readline(), 10);

var numTmp = numBooks;
var maxDigits = 1;
while ((numTmp = (numTmp / 10)) >= 1) {
	maxDigits++;
}

var numDigits = 0;

for (var i = 1; i < maxDigits; i++) {
	var range = Math.pow(10, i) * 0.9;
	numDigits += range * i;
}

numDigits += (numBooks - (Math.pow(10, maxDigits - 1) - 1)) * maxDigits;

print(numDigits);


n = +readline();
if (n < 10){
    print(n);
} else {
    ar = (n+'').split('').map(Number);
    acc = 9;
    digit = 1;
    while (acc < n){
        acc *= 10;
        acc += 9;
        digit++;
    }
    if (acc === n){
        print(digit*9);
    } else {
        acc = ar[0]-1;
        digit--;
        while (digit-->0){
            acc *= 10;
            acc +=9;
        }
        sum = 0;
        ((n - acc)+'').split('').map(Number).forEach(x=>sum+=x);
        (acc+'').split('').map(Number).forEach(x=>sum+=x);
        print(sum);
    }
}


const DEBUG = false;
const { EOL } = require('os');
const fs = require('fs');

let r = process.stdin;
if (DEBUG) {
  r = fs.createReadStream('input');
}
let data = '';
r.on('data', c => (data += c));
r.on('end', () => {
  const lines = data.split(EOL);
  let arr = [];
  let d;
  [arr[0], arr[1], arr[2], d] = lines[0].split(' ');
  arr[0] = parseInt(arr[0]);
  arr[1] = parseInt(arr[1]);
  arr[2] = parseInt(arr[2]);
  d = parseInt(d);
  arr = arr.sort(function(a, b) {
    return a - b;
  });
  let res = Math.max(0, d - (arr[1] - arr[0]));
  res += Math.max(0, d - (arr[2] - arr[1]));
  console.log(res);
});


'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 output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

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

    for (let test = 0; test < N; test++) {
        let f = readline().split(' ').map(Number);
        let s = readline().split(' ').map(Number);

        let result = 2;
        if (f[0] === 0 && f[1] === 0 && s[0] === 0 && s[1] === 0) {
            result = 0;
        } else if (f[0] + f[1] + s[0] + s[1] === 4) {
            result = 2;
        } else {
            result = 1;
        }

        output(result);
    }
}


function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var pans = readline().trim().split('|');
	var left = pans[0], right = pans[1];
	var leftLen = left.length, rightLen = right.length;
	var spare = readline().trim(), spareLen = spare.length;
	if ((leftLen + rightLen + spareLen) % 2 == 1) {
		print("Impossible");
	}
	else if (Math.abs(leftLen - rightLen) > spareLen) {
		print ("Impossible");
	}
	else {
		if (leftLen < rightLen) {
			left += spare.substring(0, rightLen-leftLen);
		}
		else {
			right += spare.substring(0, leftLen-rightLen);
		}
		spare = spare.substring(Math.abs(leftLen-rightLen));
		if (spare.length > 0) {
			left += spare.substring(0, spare.length/2);
			right += spare.substring(spare.length/2);
		}
		print(left+'|'+right);
	}
}

main();


const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  let [h, m] = ipt.split(EOL).slice(0, -1)[0].split(':').map(v => parseInt(v))
  if (h >= 12) h -= 12

  let y = m * 6
  let x = h * 30 + y / 12

  console.log(x, y)
})


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[0].split(' ').map(x => parseInt(x));
  let [k, n, w] = nums;
  let realSum = 0, i = 1;

  while (w > 0) {
    realSum += k*i;
    i += 1; w -= 1;
  }

  if (n >= realSum) console.log(0)
  else console.log(realSum - n);
});


var n = +readline(),
	c = ('0 ' + readline()).split(' ').map(Number),
	x, y;

readline().split(' ').map(Number).reduce(function(a, b) {
	x = a;
	y = b;
});

var sum = c.reduce(function(a, b) {
	return a + b;
});

print(function() {
	var b = 0;
	for (var i = 1; i <= n; i++) {
		if (b >= x && b <= y && sum - b >= x && sum - b <= y) {
			return i;
		}
		b += c[i];
	}
	return 0;
}());


function zeros(num) {
    var z = 1;
    while (num % 10 === 0) {
        z *= 10;
        num /= 10;
    }

    return z;
}

var inp = readline().split(' '), n = parseInt(inp[0]), k = Math.pow(10, parseInt(inp[1])), x = n, zerosx = zeros(x);

while (zerosx < k) {
    if ((x / zerosx) % 10 === 5) {x *= 2}
    else if (((x / zerosx) % 10) % 2 == 0) {x *= 5}
    else {x *= 10}

    zerosx = zeros(x)
}

print(x);


n=+readline()
a=readline().split(' ').map(function(x){return +x;})
var d=a[1]-a[0]
var keks=1;
for (var i=2;i<n;i++)
{
    if (a[i]-a[i-1]!=d)
    {
        keks=0;
        break;
    }
}
if (keks){print(d+a[n-1]);}else{print(a[n-1]);}


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

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


function main() {
    var data = readline().split(' ').map(Number);
    if(data[0] == 0 && data[1] == 0){
        return print("NO");
    }
    if(Math.abs(data[0] - data[1]) <= 1){
        return print("YES");
    }
    return print("NO");
}

main()


var a = readline().split(' ');
var n1 = parseInt(a[0]);
var n2 = parseInt(a[1]);

var s = (n1 > n2 ? "First" : "Second");

print(s);


;(function () {

	print((function (a, b) {
		return +(+a + +b).toString().replace(/0/g, '') === (+a.replace(/0/g, '') + +b.replace(/0/g, '') ) ? 'YES' : 'NO';
	}).apply(this, [readline(), readline()]));

}).call(this);


m=Number(readline()) ;
arr=readline() ;
ans="1"
for(j=0;j<m;j++)
    if(arr[j]=="0")
          ans+="0"
if(m>1)
    print(ans);
else
    print(arr)


var input = readline();
function count(str){
	f = 0;
	s = 0;
	first = 0;
	for (i = 0; i < str.length; i++){
		if (str[i] == '4')
			f += 1;
			if (first == 0)
				first = 4
		if (str[i] == '7')
			s += 1;
			if (first == 0)
				first = 7
	}
	if (f==0 && s==0)
		return -1;
	if (f == s)
		return first
	return (f > s) ? 4 : 7;
}

print(count(input));


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

rl.on("line", (d) => {
  console.log(25);
});


var ln = readline().split(' ').map(e => +e);
var std = ln[0], TIME = ln[1];

var ln = readline().split(' ').map(e => +e);
var dp = Array(std);

dp[0] = ln[0];
for (var i=1; i<ln.length; i++) dp[i] = ln[i] + dp[i-1];
for (var i=0; i<ln.length; i++){
  var count = 0;
  if (dp[i] > TIME) {
    var sub = ln.slice(0, i).sort((a, b) => a - b);
    while (sub.length) {
      if (dp[i] > TIME) count ++, dp[i] -= sub.pop();
      else break;
    }
  }

  write(String(count) + ' ');
}


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

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

  const arr = [...d];
  const obj = {};

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

  const countArr = Object.values(obj);

  if (countArr.some((x) => x > k)) {
    console.log('NO');
  }
  else {
    console.log('YES');
  }

  c++;
});


var n = parseInt(readline());
if (3 >  n)
  print(-1);
else for (var i=n; i>0; i--)
  print(i, ' ');


function trim(s) {
    return s.replace(/^\s+|\s+$/gm, '')
}
function tokenizer(s) {
    return trim(s).split(/\s+/);
}
function integers(s) {
    var tokens=tokenizer(s);
    for(var i=0; i<tokens.length; ++i) {
        tokens[i]=parseInt(tokens[i]);
    }
    return tokens;
}
function main() {
    var data=integers(readline());
    var n=data[0], m=data[1];
    var arr=new Array(n+1);
    var b=integers(readline());
    for(var i=0; i<m; ++i) {
        var x=b[i];
        for(var j=x; j<=n; ++j) {
            if(arr[j]==undefined) arr[j]=x;
        }
    }
    print(arr.slice(1).join(" "));
}
main();


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', line => {
    var n = Number(input[0]);
    var source = input[1].split(" ").map((i) => {
        return Number(i);
    });
    var arr = source.slice();
    var f = [];
    var sum = 0;
    for (var i = 0; i < arr.length; i++) {
        sum += arr[i];
    }
    if (sum % 2 === 1) {
        console.log(0);
        return;
    }
    f[0] = [];
    for (var j = 0; j < arr.length; j++) {
        f[0][j] = true;
    }
    for (var i = 1; i <= sum / 2; i++) {
        f[i] = [];
        for (var j = 0; j < arr.length; j++) {
            f[i][j] = f[i][j - 1]
            if (i - arr[j] >= 0) {
                f[i][j] = f[i][j] || f[i - arr[j]][j - 1];
            }
        }
    }
    if (!f[sum / 2][arr.length - 1]) {
        console.log(0);
        return;
    }
    for (var j = 0; j < arr.length; j++) {
        f[0][j] = true;
    }
    var index = -1;
    while (index === -1) {
        sum = 0;
        for (var i = 0; i < arr.length; i++) {
            sum += arr[i];
            if (arr[i] % 2 === 1) {
                index = i;
            } else {
                arr[i] /= 2;
            }
        }
    }
    if (sum % 2 === 1) {
        console.log(0);
    } else {
        console.log(1);
        console.log(index + 1);
    }
});


var a = +readline()
if(a % 2 === 0){
    print(Math.pow(2, a/2));
}
else{
    print(0);
}


'use strict';
let n = parseInt(readline()),
    array = [4, 7, 47, 74];

for(let i = 4; i<=7; i+=3) {
    for(let j = 4; j<=7; j+=3) {
        for(let k = 4; k<=7; k+=3) {
               array.push(i*100 + j*10 + k);
        }
    }
}

array.map(function(happyNumber) {
    if(n % happyNumber === 0) {
        write('YES');
        n = undefined;
    }
})

if(n) {
    write('NO');
}


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

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
	var list = nextIntArray();
	var max = Math.max.apply(null, list);
	for(var i = max; i <= 300; i++){
		var L = 0;
		var R = 0;
		for(var j = 0; j < N; j++){
			L += list[j];
			R += i - list[j];
		}
		if(L < R){
			myout(i);
			return;
		}
	}
}


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

rl.on('line', (data) => {
  let [a, b, c, d] = data.split(' ').map(Number);
  let x = Math.min(a, c, d);

  a -= x;
  c -= x;
  d -= x;

  let y = Math.min(a, b);

  console.log(x*256 + y*32);
});


'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();
    var line2 = readline();

    // console log function here
    console.log(removeAdjacent(x, line2));
}

// function here

function removeAdjacent(l, s) {

	let sArr = Array.from(s);

	// create a dictionary where every letter in associated the its positions in the string,
	// and a linkde list where every element has a reference in the dictionary near the position here stored

	let sll = {value:s[0], prev: null, next: null};
	let lettersDict = {[s[0]]: [{position: 0, elem: sll}]};
	let start = sll;
	let currElemLinkedList = sll;

	for (let i = 1; i < l; i++) {
		let curr = s[i];

		currElemLinkedList.next = {value:curr, prev: currElemLinkedList, next: null};
		if (curr in lettersDict) {
			lettersDict[curr].push({position: i, elem: currElemLinkedList.next});
		}
		else {
			lettersDict[curr] = [{position: i, elem: currElemLinkedList.next}];
		}

		currElemLinkedList = currElemLinkedList.next;
	}

	let end = currElemLinkedList;

	// order the keys of the dictionary by ascii value
	const keys = Object.keys(lettersDict);
	keys.sort((a, b) => {
		return b.charCodeAt(0) - a.charCodeAt(0)
	});

	// for every entry in keys check the string for adjacents
	return keys.reduce((acc, curr) => {
		let nEliminated = 0;

		for (let i = 0; i < lettersDict[curr].length; i++) {
			let elem = lettersDict[curr][i].elem;
			if (elem) {
				let position = lettersDict[curr][i].position;

				let leftComparable = elem.prev && elem.prev.value;
				let rightComparable = elem.next && elem.next.value;

				if ((leftComparable && (leftComparable.charCodeAt(0) - elem.value.charCodeAt(0) == -1)) ||
					(rightComparable && (rightComparable.charCodeAt(0) - elem.value.charCodeAt(0) == -1))) {
					nEliminated++;

					lettersDict[curr][i].elem = null;
					if (leftComparable === elem.value) {
						i -= 2
					}
					let prev = elem.prev;
					let next = elem.next;
					if (prev) {
						prev.next = next;
					}
					if (next) {
						next.prev = prev;
					}

				}

			}
		}

		return acc + nEliminated;
	}, 0)
}


;(function () {
	print(function (n, m) {
		var k = 0;

		var p = [];
		while (n--) p.push(readline().split(''));
		n = p.length;

		for (var i = 0; i < n; i++) {
			for (var j = 0; j < m; j++) {
				if (p[i][j] === 'P' && isHaveWolf(i, j)) {
					k++;
				}
			}
		}

		return k;

		function isHaveWolf (i, j) {
			if (i > 0 && p[i-1][j] === 'W') { p[i-1][j] = '.'; return true; }
			else if (i < n-1 && p[i+1][j] === 'W') { p[i+1][j] = '.'; return true; }
			else if (j > 0 && p[i][j-1] === 'W') { p[i][j-1] = '.'; return true; }
			else if (j < m-1 && p[i][j+1] === 'W') { p[i][j+1] = '.'; return true; }

			return false;
		}
	}.apply(null, readline().split(' ').map(Number)));
}.call(this));


var N = parseInt(readline());
var q = [], tail, newTail;
for (var i = N; i--; ){
  newTail = 1;
  while (tail = q.pop()) {
    if (tail === newTail) {
      newTail += 1;
    } else {
      q.push(tail);
      break;
    }
  }
  q.push(newTail);
}
print(q.join(' '));


var s = readline();
  s = s.split('e');
  var nm = s[0].split('.');
  var a = nm[0];
  var b = nm[1];
  var c = parseInt(s[1]);
  var res = a;
  if(c >= b.length) {
    res += b;
    while(c > b.length) {
      c -= 1;
      res += '0';
    }
  } else {
    res += b.substr(0, c) + '.' + b.substr(c);
  }

  while(res[0] === '0') {
    res = res.substr(1);
  }
  if(res[0] === '.') {
    res = '0' + res;
  }
  if(res.indexOf('.') !== -1) {
    while(res[res.length - 1] === '0') {
      res = res.substr(0, res.length - 1);
    }
  }
  while(res[res.length - 1] === '.') {
    res = res.substr(0, res.length - 1);
  }
  print(res);


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

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

process.stdin.on('end', () => {
  const n = parseInt(arr)
  const sq = Math.sqrt(n)
  let k = 0
  for(let i = 1; i <= sq; i++) {
    if(n % i == 0) {
      if(n / i == i) k ++
      else k +=2
    }
  }
  console.log(k)

})


readline();
var s = readline();
var ans = s.length;
for(var i = 1;i < s.length;i++)
    if(s.substr(0, i) == s.substr(0 + i, i)) {
        ans = s.length - i + 1;
    }
print(ans);


//var result = num => Math.floor(Number(num));
var n = readline(), str = readline();
var cnt = 0, max = 1;
for(var i = 0; i < str.length; i++) {
  str[i] === '0' ? cnt++ : cnt = 0;
  max = Math.max(max, cnt);
  if(str[i] === str[i + 1] && str[i] === '1') {
    max = 0;
    break;
  }
}
if(str[0] === str[1] && str[0] === '0') max = 0;
if(str[n - 1] === str[n - 2] && str[n - 1] === '0') max = 0;
if(n == 1 && str[0] === '0') max = 0;
print(max !== 0 && max <= 2 ? 'Yes' : 'No');


function main() {
    var fl = readline().split(/\s/gi).map(Number),
        sl = readline().split(/\s/gi).map(Number),
        a = fl[0], b = fl[1],
        c = sl[0], d = sl[1],
        result = -1;

	var r = rick(a, b), m = morty(c, d);

	for(var n = 0; n <= 1e4; n++)	{
		var s = r(n) - m(0);

		if(s >= 0 && s % (m(1) - m(0)) == 0)	{
			result = r(n);
			break;
		}
	}

    print(result);
};

function rick(a, b)	{
	return function(n)	{
		return b + (a * n);
	};
};

function morty(c, d)	{
	return function(n)	{
		return d + (c * n);
	};
};

main();


var total = parseInt(readline())
var cards = readline().split(' ');
var sum = 0;

cards.map(function(a) {
	sum += (+a);
})

var one = sum * 2 / total;
var map = [];
for (var i = 0; i < total; ++i) {
	if (map[i]) continue;
	for (var j = i + 1; j < total; ++j) {
		if (!map[j] && (+cards[i]) + (+cards[j]) == one) {
			map[i] = map[j] = 1;
			print((i+1) + ' ' + (j+1));
			break;
		}
	}
}


var str = readline().split(":", 2);
var hours = Number(str[0]);
var minutes = Number(str[1]);
var num = Number(readline());

minutes += num;
if (minutes >= 60) {
    hours += (minutes - minutes % 60) / 60;
    minutes %= 60;
}
if (hours >= 24) {
    hours %= 24;
}

function toTime(num) {
    if (num >= 10) {
        return String(num);
    } else {
        return "0" + String(num);
    }
}

print(toTime(hours) + ":" + toTime(minutes));


var n = parseInt(readline());
var s=0;
var a = new Array(n);
for(var i = 0;i<n;i++){
    a[i]= readline();
    a[i] = a[i].split(" ");
}
for(var i =0;i<n;i++){
    for(var j=0;j<n;j++){
        if(i == j){continue;}
        if(a[i][0] == a[j][1]){s++;}
    }
}
print(s);


"use strict";

function main()
{
  var n = parseInt(readline(), 10);

  var a = new Array(n);
  var b = new Array(n);
  var c = new Array(n);

  for (var size of readline().split(" "))
  {
    size = parseInt(size, 10);

    a[size+0] = true;
    b[size+1] = true;
    c[size+2] = true;
  }

  var ok = false;
  for (var i=3 ; i<=1003 ; i++)
  {
    if (a[i] && b[i] && c[i])
    {
      ok = true;
      break;
    }
  }

  print(ok ? "YES" : "NO");
}

main();


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);
  let ans = Math.max(0, arr[arr.length - 1] - 25);

  console.log(ans);

  c++;
});


let input = [];

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

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

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

    if(code.length == 1){
        console.log(code.charAt(0)); process.exit();
    }

    let answer = ''
    let j = 0;
    for(let i = 0; i < n; i++, j+=i){
        answer += code.charAt(j);
    }
    console.log(answer);
});


function main() {
    let s = stdin[0];
    let r = '';

    let n = s.length;
    let start_index = parseInt( (n-1)/2 );

    r += s[start_index];

    let current_difference=1;
    while( 0 <= start_index+current_difference && start_index+current_difference < n ) {
        r += s[start_index+current_difference];
        if( current_difference>0 ) {
            current_difference = -current_difference;
        } else {
            current_difference = -current_difference + 1;
        }
    }

    console.log(r);
};

const readline = require('readline');
const rl = readline.createInterface(process.stdin, process.stdout, null);

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
});
let c = 0;
let n, m, k;

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

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

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

    L--;
    R++;
  }

  console.log(ans);

  c++;
});


'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, m] = rns();
  let pre = 1,
      M = mod(m),
      res = 0,
      ans = M,
      ans1 = M;
  const p = getPrimes(n + 10);
  for (let i = 2; i <= n; i++) {
    if (pre <= m && p[i]) pre = pre * i;
    if (pre > m) {
      ans = 0;
    } else {
      ans = mul(ans, Math.floor(m / pre));
    }
    ans1 = mul(ans1, M);
    res = mod(res + ans1 - ans);
  }
  return res;
}
function getPrimes(n) {
  const nums = new Array(n + 1).fill(1);
  nums[0] = nums[1] = 0;
  const primes = [];
  for (let i = 2; i <= n; i++) {
    if (nums[i]) primes.push(i);
    for (let j = 0; primes[j] <= n / i; j++) {
      nums[primes[j] * i] = 0;
      if (i % primes[j] === 0) break;
    }
  }
  return nums;
}
const MOD = 998244353;
function mod(num) {
  if (num >= MOD) return num % MOD;else if (num < 0) return (num % MOD + MOD) % MOD;
  return num;
}
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 = () => read().split(/\s+/).map(Number);
  const re = () => read().split(/\s+/).map(s => Number(s) - 1);
  const rbs = () => read().split(/\s+/).map(BigInt);
  return [rn, rb, rns, re, rbs];
}
function main(r) {
  try {
    let t = 1;
    let res = new Array(t);
    let limit = 0;
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < limit) ; else {
        res[i] = s;
      }
    }
    if (t >= limit) {
      return res.join('\n');
    }
  } catch (error) {
    console.log(error);
  }
}

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


var input = readline().split(" "), t = +input[0], s = +input[1], q = +input[2];

for(i = 1; ; i++){
	s += Math.round(s * (q - 1));
	if(t <= s){
		break;
	}
}
write(i);


var a = [
	'O-|-OOOO',
	'O-|O-OOO',
	'O-|OO-OO',
	'O-|OOO-O',
	'O-|OOOO-',
	'-O|-OOOO',
	'-O|O-OOO',
	'-O|OO-OO',
	'-O|OOO-O',
	'-O|OOOO-'
];

print(readline().split('').reverse().map(function(v){
	return a[v];
}).join('\n'));


var ln = readline().split(' ').map(e => +e);
var n = ln[0];
var mn = Math.min(ln[1], ln[2]);

write(n <= mn ? 'Yes' : 'No');


var t=+readline();
while(t--){
    var input= readline();
    var arr= input.split(" ").map(x=>+x);
    var a=arr[0];
    var b=arr[1];
    var res=1;
    for(var i=0; i<b; i++){
        res=res*a%(1000000000+7);
    }
    print(res);
}


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

    return num;
}

var x = readline().split(' ').map((x) => Number(x));
var used = {};
var count = 0;

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

    x = f(x);
};

print(count);


var n = Number(readline());
var res = 1;

for (var i=2; i<n; i++){
	if (n%i==0)
	res++;
}
print(res);


var A = +readline()

function toSys (n, b) {
	var c = n
	var d = 0
	var r = []
	while (c) {
		d = c % b
		c = c / b | 0
		r.push(d)
	}
	//return r.reverse()
	return r
}

var s = 0
for (var i = 2; i < A; i++) {
	s += toSys(A, i).reduce(function (s, v) {return s + v})
}

s = toSimple(s)
var a = A - 2

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

print(s.reduce(function (r, a) {return a * r}, 1) +  '/' +  a)

function toSimple (n) {
	var r = []
	var i = 2
	while (n != 1) {
		if (!(n % i)) {
			r.push(i)
			n = n / i
			i = 1
		}
		i++
	}
	return r
}


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

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

const store = {};

function main() {
	let n = readLine() >> 0;

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

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


const readline = require('readline');

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

rl.on('line', d => {
    let arr = d.split("");
    arr[0] = arr[0].toUpperCase();
    console.log(arr.join(""));
})


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 num = +readLine();

  if (num === 0) console.log(`${0} ${0} ${0}`);
  else if (num === 1) console.log(`${0} ${0} ${1}`);
  else if (num === 2) console.log(`${0} ${1} ${1}`);
  else {
    const fib = [0, 1];
    let i = 2;
    let prevSum = fib[0] + fib[1];
    while (prevSum < num) {
      prevSum = fib[i - 1] + fib[i - 2];
      fib[i] = prevSum;
      i++;
    }
    i--;
    console.log(`${fib[i - 1]} ${fib[i - 3]} ${fib[i - 4]}`);
  }
}


var bessi = readline()
.split('')
.concat(readline().split('').reverse())
.filter(function (v) {
    return v !== 'X'
})

var elsi = readline()
.split('')
.concat(readline().split('').reverse())
.filter(function (v) {
    return v !== 'X'
})

var friends = true

var b = bessi.indexOf('A')
var e = elsi.indexOf('A')

for (var i = 0 ; i < 3; i++) {
    if (bessi[b] !== elsi[e]) {
        friends = false
        break
    }

    b = ++b % 3
    e = ++e % 3

}

print(friends ? "YES" : "NO")


;(function () {

	var s = readline().split(' ').map(Number);
	var n = s[0], x = s[1], y = s[2];

	var r = Math.ceil(n * (y / 100)) - x;

	print( ( r > 0 ) ? r : 0 );

}).call(this);


var n = parseInt(readline());
	var a = readline().split(" ");
	//var a = s.split(" ");
	var len = a.length;
	var flag;
	if(n == 1)
	{
		if(a[0] == 0)
            print("UP");
           /* {
            	flag = "UP";
            	return flag;
            }*/
		else if(a[0] == 15)
			print("DOWN");
			/*{
				flag = "DOWN";
				return flag;
			}*/
		else{
			flag = -1;
			//return flag;
			print(flag);
		}
	}
	else {
		if(a[len-2] == 14 && a[len-1] == 15){
			flag = "DOWN";
			print(flag);
			//return flag;
		}
		else if(a[len-1] == 0 && a[len-2] == 1){
			flag = "UP";
			print(flag);
			//return flag;
		}
		else if((a[len-1]-a[len-2]) > 0)
		{
			flag = "UP";
			print(flag);
			//return flag;
		}
		else
		{
			flag = "DOWN";
			print(flag);
			//return flag;
		}
	}


var s = +readline();
var digits = {
	0: "zero",
	1: "one",
	2: "two",
	3: "three",
	4: "four",
	5: "five",
	6: "six",
	7: "seven",
	8: "eight",
	9: "nine",
	10: "ten",
	11: "eleven",
	12: "twelve",
	13: "thirteen",
	14: "fourteen",
	15: "fifteen",
	16: "sixteen",
	17: "seventeen",
	18: "eighteen",
	19: "nineteen",
	20: "twenty",
	30: "thirty",
	40: "forty",
	50: "fifty",
	60: "sixty",
	70: "seventy",
	80: "eighty",
	90: "ninety",
};

if(s <= 20){
	write(digits[s]);
}
else if(s % 10 == 0){
	write(digits[s]);
}
else{
	write(digits[s - (s % 10)]);
	write("-");
	write(digits[s % 10]);
}


var numbers = readline().split(' ').map(Number);
var sequence = readline().split(' ').map(Number);
var fingerprints = readline().split(' ').map(Number);

var code = [];
for(var i = 0; i < numbers[0]; i++) {
    for(var j = 0; j < numbers[1]; j++) {
        if(sequence[i] === fingerprints[j]) {
            code.push(sequence[i]);
            break;
        }
    }
}

print(code.join(' '));


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

rl.on('line', (d) => {

  if (+d < 2) {
    console.log(-1);
  }
  else {
    if (+d % 2 === 0) {
      console.log(+d, +d);
    }
    else {
      console.log(+d - 1, +d - 1);
    }
  }
});


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

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

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

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

  console.log(Math.min(watchedTime, 90));

  c++;
});


var s1Map = { '+' : 0, '-' : 0 },
			s2Map = { '+' : 0, '-' : 0, '?' : 0 },
			totalCase = 0,
			solveCase = 0,
			result = 0;

		var factorial = function(n)	{
			if(n == 0)	return 1;
			if(!arguments[1])	arguments[1] = n;
			return n == 1 ? arguments[1] : factorial(n - 1, arguments[1] * (n - 1));
		};

		var combination = function(n, k)	{
			if(n < k || n === 0 || k < 0)	return 0;
			if(n === k)	return 1;
			return factorial(n) / (factorial(k) * factorial(n - k));
		};

		print.call(undefined, (function()	{
			readline().split('').forEach(function(ch)	{
				s1Map[ch] += 1;
			});

			readline().split('').forEach(function(ch)	{
				s2Map[ch] += 1;
			});

			if(s1Map['+'] - s2Map['+'] === 0 && s1Map['-'] - s2Map['-'] === 0)	{
				result = 1;
			} else	{
				totalCase = Math.pow(2, s2Map['?']);
				solveCase = s1Map['+'] > 0 ? combination(s2Map['?'], s1Map['+'] - s2Map['+'])
				: combination(s2Map['?'], s1Map['-'] - s2Map['-']);

				result = solveCase / totalCase;
			}

			result = Number(result).toFixed(12);

			return result;
		})());


var r = readline();

r = r.split(' ');

n = parseInt(r[0]);
h = parseInt(r[1]);
m = parseInt(r[2]);

arr = [];

for(var i=0;i<m;i++)
{
    r = readline();
    r = r.split(' ');
    //print(r);
    arr.push(r);
}
var ans = 0;

for(var i=0;i<m;i++)
{
    for(var j=0;j<3;j++)
    {
        arr[i][j] = parseInt(arr[i][j]);
        //print(arr[i][j]);
    }
   // print("**");
}

for(var i = 1;i<=n;i++)
{
    for(var j=h;j>0;j--)
    {
        var pu = 0;
        for(var k=0;k<m;k++)
        {
            if( arr[k][0]<=i && arr[k][1] >= i )
            {
                if(arr[k][2]<j)
                {
                    pu = 1;
                    break;
                }
            }
        }
        if(pu==0)
        {
            ans+=j*j;
            //print(i,j);
            break;
        }

    }
}

print(ans)


var numbers = readline().split(" ").map(function(x) { return parseInt(x); });
var n = numbers[0]
var k = numbers[1]

var rem = n % k;
if(rem ===0){
print(n + k);
}else{

if(rem == n){
    print(k)
}else{
    n-=rem
    print(n+k)
}

}


var arr = readline().split(':');
var h = parseInt(arr[0]);
var m = parseInt(arr[1]);

var isP = function (s)
{
    for (var i = 0; i < s.length / 2; i ++)
    {
        if (s.charAt(i) != s.charAt(s.length - i - 1))
        {
            return false;
        }
    }
    return true;
}
var zeroPad = function (num, places)
{
    var zero = places - num.toString().length + 1;
    return Array(+(zero > 0 && zero)).join("0") + num;
}

var i = 0;
while(true)
{
    var str = zeroPad(h, 2)+zeroPad(m, 2);
    // print(str);
    if (isP(str))
    {
        break;
    }
    m ++;
    if (m >= 60)
    {
        m %= 60;
        h ++;
        h %= 24;
    }
    i ++;
}
print(i);


let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var n = lines[i];
        var a = new Map();
        for(j = 1; j * j <= n; j++){
            a.set(j * j, 1);
        }
        for(j = 1; j * j * j <= n; j++){
            a.set(j * j * j, 1);
        }
        console.log(a.size);
    }
});


function main() {

    var nm = readline().split(' ').map(Number);
    var n = nm[0];
    var m = nm[1];
    var horizontal = readline();
    var vertical = readline();

    if (horizontal[0] === "<" && horizontal[n - 1] === ">" && vertical[0] === "v" && vertical[m - 1] === "^") {
        print("YES");
    } else if (horizontal[0] === ">" && horizontal[n - 1] === "<" && vertical[m - 1] === "v" && vertical[0] === "^") {
        print("YES");
    } else {
        print("NO");
    }

}

main();


;(function () {

	print((function () {
		for (var i = 1, str = readline(), l = str.length, ret = 0, p = 0; i < l; i++) {
			if (str[i] === str[i - 1]) {
				p++;
			} else {
				p = 0;
				ret++;
			}

			if (p >= 5) {
				ret++;
				p = 0;
			}
		}

		return ret + 1;
	}).apply(0));

}).call(this);


var valid = function(x) {
	x = x + ''
	return x.charAt(0) != x.charAt(1)
		&& x.charAt(0) != x.charAt(2)
		&& x.charAt(0) != x.charAt(3)
		&& x.charAt(1) != x.charAt(2)
		&& x.charAt(1) != x.charAt(3)
		&& x.charAt(2) != x.charAt(3)
}

var n = parseInt(readline()) + 1

while(!valid(n))
	n ++

print(n)


var aux=readline().split(" ").map(function(x){return parseInt(x);});
var n=aux[0],v=aux[1];
var rez=Math.min(v,n-1);
for(var i=2;i<=n-v;i++)
    rez+=i;
print(rez);


var n = parseInt(readline().split(' '));
var s = readline().split(' ');
var crash = [];
for (var i = 0; i < n; i ++) {
    crash[i] = parseInt(s[i]) - 1;
}
var res = 1;
var vis = new Array(n);
var gcd = function (x, y) {
    if (x == 0) {
        return y;
    }
    return gcd(y%x, x);
};
var lcm = function (x, y) {
    return parseInt(x/ gcd(x,y)) * y;
};
var dfs = function (x, idx, rt) {
    vis[x] = true;
    var y = crash[x];
    if (vis[y] == null) {
        dfs(y, idx+1, rt);
    }
    else {
        if (y == rt) {
            if (idx % 2 == 1) {
                res = lcm(res, idx);
            }
            else {
                res = lcm(res, parseInt(idx/2));
            }
        }
        else {
            res = -1;
        }
        return;
    }
}

for (var i = 0; i < n; i ++) {
    if (vis[i] == null) {
        dfs(i, 1, i);
        if (res == -1)
            break;
    }
}

print(res);


var num = readline().split(" ").map(function(x) { return parseInt(x); });
var n=num[0];

write(Math.floor(n/2)+1);


ip = readline().split(' ').map(Number);
a = ip[0], b = ip[1], c = ip[2];
i = 0;
found = false;
while (!found && i * a <= c){
    k = c - (a*i);
    if (k % b === 0){
        found = true;
        break;
    }
    i++;
}
print(found?'Yes':'No');


//rextester.com:C24.2.0 (SpiderMonkey)--codeforces.com:V8 4.8.0
var z=readline().split(' ');var a=parseInt(z[0]);var b=parseInt(z[1])
if(a<1&b>0)print('Impossible')
else print((a>b)?a:b,b!=0?a+b-1:a)


function  main()
{
    var data = readline().split(' ');
    var k = data[0];
    var n = 4;
    var x = 0;
    var a = new Array (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
    for ( var i = 0; i < n; i++)
    {
        data = readline().split(' ');
        var line = data[0]
        for ( var j = 0; j < line.length; j++)
        {
            if (line[j] == '.')
                continue;
            x = +(line[j]);
            a[x]++;
            if (a[x] >  2*k)
            {
                print('NO');
                return;
            }
        }
    }
    print('YES');
}
main()