import java.util.*
import kotlin.math.*

private fun <E> List<E>.toPair(): Pair<E, E> {
    return Pair(this[0], this[1])
}

private fun maxOf(ans: Pair<Int, Int>, b: Pair<Int, Int>): Pair<Int, Int> {
    return if (ans.first > b.first || ans.first == b.first && ans.second > b.second) ans
    else b
}

private fun <T1 : Comparable<T1>, T2 : Comparable<T2>> pairCmp(): Comparator<Pair<T1, T2>> {
    return Comparator { a, b ->
        val res = a.first.compareTo(b.first)
        if (res == 0) a.second.compareTo(b.second) else res
    }
}

private val readR = Scanner(System.`in`)
private const val BUFFER_SIZE = 1 shl 16
private val buffer = ByteArray(BUFFER_SIZE)
private var bufferPt = 0
private var bytesRead = 0
private fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
private val INPUT = System.`in`
private tailrec fun readChar(): Char {
    if(bufferPt == bytesRead) {
        bufferPt = 0
        bytesRead = INPUT.read(buffer, 0, BUFFER_SIZE)
    }
    return if(bytesRead < 0) Char.MIN_VALUE
    else {
        val c = buffer[bufferPt++].toInt().toChar()
        if (c == '\r') readChar()
        else c
    }
}
private fun readln() = readLine()!!
private fun readInt() = read().toInt()
private fun readDouble() = read().toDouble()
private fun readLong() = read().toLong()
private fun readStrings(n: Int) = List(n) { read() }
private fun readLines(n: Int) = List(n) { readln() }
private fun readInts(n: Int) = List(n) { read().toInt() }
private fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
private fun readDoubles(n: Int) = List(n) { read().toDouble() }
private fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
private fun readLongs(n: Int) = List(n) { read().toLong() }
private fun readLongArray(n: Int) = LongArray(n) { read().toLong() }
private fun printWithSpace(vararg x: Any?) = println(x.joinToString(" "))
private fun readCharArray(n:Int) = CharArray(n) {_->readChar()}
//----------------Customizing Functions----------------

//-----------------------Solving-----------------------
private fun solve() {
    val r=readInt()
    val a=IntArray(9)
    a[0]=1200
    a[1]=1400
    a[2]=1600
    a[3]=1900
    a[4]=2100
    a[5]=2300
    a[6]=2400
    a[7]=2600
    a[8]=3000
    for(i in a.indices){
        if(r<a[i]){
            println("${a[i]}")
            break
        }
    }
}
//-------------------The Result Stage------------------
fun main() {
    solve()
}


import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintStream

val Number.i: Int get() = this.toInt()
val Number.l: Long get() = this.toLong()
val Number.f: Float get() = this.toFloat()
val Number.d: Double get() = this.toDouble()
val String.i: Int get() = this.toInt()
val String.l: Long get() = this.toLong()
val String.f: Float get() = this.toFloat()
val String.d: Double get() = this.toDouble()
val Boolean.i: Int get() = if (this) 1 else 0

operator fun <T> List<T>.component6() = this[5]

fun main() = BufferedReader(InputStreamReader(System.`in`)).use { solve(it, System.out) }

fun solve(input: BufferedReader, output: PrintStream) {
    val (x0, y0, x1, y1, x2, y2) = input.readLine().split(' ').map { it.i }
    output.println(
        when {
            isGoodStraight(x0, y0, x1, y1, x2, y2) -> "RIGHT"
            isAlmost(x0, y0, x1, y1, x2, y2) -> "ALMOST"
            else -> "NEITHER"
        }
    )
}

fun isStraight(x0: Int, y0: Int, x1: Int, y1: Int, x2: Int, y2: Int) = (x0 == x1 && y0 == y2) || (x0 == x2 && y0 == y1)
fun isAlmost(x0: Int, y0: Int, x1: Int, y1: Int, x2: Int, y2: Int) = (false ||
        isGoodStraight(x0 - 1, y0, x1, y1, x2, y2) ||
        isGoodStraight(x0 + 1, y0, x1, y1, x2, y2) ||
        isGoodStraight(x0, y0 - 1, x1, y1, x2, y2) ||
        isGoodStraight(x0, y0 + 1, x1, y1, x2, y2) ||

        isGoodStraight(x0, y0, x1 - 1, y1, x2, y2) ||
        isGoodStraight(x0, y0, x1 + 1, y1, x2, y2) ||
        isGoodStraight(x0, y0, x1, y1 - 1, x2, y2) ||
        isGoodStraight(x0, y0, x1, y1 + 1, x2, y2) ||

        isGoodStraight(x0, y0, x1, y1, x2 - 1, y2) ||
        isGoodStraight(x0, y0, x1, y1, x2 + 1, y2) ||
        isGoodStraight(x0, y0, x1, y1, x2, y2 - 1) ||
        isGoodStraight(x0, y0, x1, y1, x2, y2 + 1)
        )

fun isGoodStraight(x0: Int, y0: Int, x1: Int, y1: Int, x2: Int, y2: Int) =
    (true &&
//            !(x0 == x1 && y0 == y1) &&
//            !(x0 == x2 && y0 == y2) &&
//            !(x2 == x1 && y2 == y1) &&
            true) && (0 +
            isStraight(x0, y0, x1, y1, x2, y2).i +
            isStraight(x1, y1, x0, y0, x2, y2).i +
            isStraight(x2, y2, x0, y0, x1, y1).i) > 0


// 2022.09.02 at 15:52:32 BST
import java.io.BufferedInputStream
import java.io.File
import java.io.PrintWriter
import kotlin.math.ln
import kotlin.system.measureTimeMillis

// 1. Modded
const val p = 1000000007L
const val pI = p.toInt()
fun Int.adjust():Int{ if(this >= pI){ return this  - pI }else if (this < 0){ return this + pI };return this }
fun Int.snap():Int{ if(this >= pI){return this - pI} else return this}
infix fun Int.modM(b:Int):Int{ return ((this.toLong() * b) % pI).toInt() }
infix fun Int.modPlus(b:Int):Int{ val ans = this + b;return if(ans >= pI) ans - pI else ans }
infix fun Int.modMinus(b:Int):Int{ val ans = this - b;return if(ans < 0) ans + pI else ans }
fun Int.inverse():Int = intPow(this,pI-2,pI)
infix fun Int.modDivide(b:Int):Int{ return this modM (b.inverse()) }
fun intPow(x:Int,e:Int,m:Int):Int{
    var X = x ; var E =e ; var Y = 1
    while(E > 0){
        if(E and 1 == 0){
            X = ((1L * X * X) % m).toInt()
            E = E shr 1
        }else{
            Y = ((1L * X * Y) % m).toInt()
            E -= 1
        }
    }
    return Y
}
// 2. DP initial values
const val plarge = 1_000_000_727
const val nlarge = -plarge
const val phuge = 2_727_000_000_000_000_000L
const val nhuge = -phuge
// 3. convenience conversions
val Boolean.chi:Int get() = if(this) 1 else 0 //characteristic function
val BooleanArray.chiarray:IntArray get() = IntArray(this.size){this[it].chi}
val Char.code :Int get() = this.toInt() -  'a'.toInt()
//3. hard to write stuff
fun IntArray.put(i:Int,v:Int){ this[i] = (this[i] + v).adjust() }
val mint:MutableList<Int> get() = mutableListOf<Int>()
val mong:MutableList<Long> get() = mutableListOf<Long>()
//4. more outputs
fun List<Char>.conca():String = this.joinToString("")
val CharArray.conca :String get() = this.joinToString("")
val IntArray.conca :String get() = this.joinToString(" ")
@JvmName("concaInt")
fun List<Int>.conca():String = this.joinToString(" ")
val LongArray.conca:String get() = this.joinToString(" ")
@JvmName("concaLong")
fun List<Long>.conca():String = this.joinToString(" ")
//5. Pair of ints
const val longmask = (1L shl 32) - 1
fun makepair(a:Int, b:Int):Long = (a.toLong() shl 32) xor (longmask and b.toLong())
val Long.first get() = (this ushr 32).toInt()
val Long.second get() = this.toInt()
//6. strings
val String.size get() = this.length
const val randCount = 100
//7. bits
fun Int.has(i:Int):Boolean = (this and (1 shl i) != 0)
fun Long.has(i:Int):Boolean = (this and (1L shl i) != 0L)
//8 TIME
inline fun TIME(f:()->Unit){
    val t = measureTimeMillis(){
        f()
    }
    println("$t ms")
}
//9.ordered pair
fun order(a:Int, b:Int):Pair<Int,Int>{
    return Pair(minOf(a,b), maxOf(a,b))
}
const val interactive = false
object Reader{
    private const val BS = 1 shl 16
    private const val NC = 0.toChar()
    private val buf = ByteArray(BS)
    private var bId = 0
    private var size = 0
    private var c = NC

    var warningActive = true
    var fakein = StringBuilder()

    private var IN: BufferedInputStream = BufferedInputStream(System.`in`, BS)
    val OUT: PrintWriter = PrintWriter(System.out)

    private val char: Char
        get() {
            if(interactive){
                return System.`in`.read().toChar()
            }
            while (bId == size) {
                size = IN.read(buf) // no need for checked exceptions
                if (size == -1) return NC
                bId = 0
            }
            return buf[bId++].toChar()
        }

    fun nextInt(): Int {
        var neg = false
        if (c == NC) c = char
        while (c < '0' || c > '9') {
            if (c == '-') neg = true
            c = char
        }
        var res = 0
        while (c in '0'..'9') {
            res = (res shl 3) + (res shl 1) + (c - '0')
            c = char
        }
        return if (neg) -res else res
    }
    fun nextLong(): Long {
        var neg = false
        if (c == NC) c = char
        while (c < '0' || c > '9') {
            if (c == '-') neg = true
            c = char
        }
        var res = 0L
        while (c in '0'..'9') {
            res = (res shl 3) + (res shl 1) + (c - '0')
            c = char
        }
        return if (neg) -res else res
    }
    fun nextString():String{
        val ret = StringBuilder()
        while (true){
            c = char
            if(!isWhitespace(c)){ break}
        }
        ret.append(c)
        while (true){
            c = char
            if(isWhitespace(c)){ break}
            ret.append(c)
        }
        return ret.toString()
    }
    fun isWhitespace(c:Char):Boolean{
        return c == ' ' || c == '\n' || c == '\r' || c == '\t'
    }
    fun rerouteInput(){
        if(warningActive){
            put("Custom test enabled")
            println("Custom test enabled")
            warningActive = false
        }
        val S = fakein.toString()
        println("New Case ")
        println(S.take(80))
        println("...")
        fakein.clear()
        IN = BufferedInputStream(S.byteInputStream(),BS)
    }
    fun flush(){
        OUT.flush()
    }
    fun takeFile(name:String){
        IN = BufferedInputStream(File(name).inputStream(),BS)
    }
}
fun put(aa:Any){
    Reader.OUT.println(aa)
    if(interactive){ Reader.flush()}
}
fun done(){ Reader.OUT.close() }
fun share(aa:Any){
    if(aa is IntArray){Reader.fakein.append(aa.joinToString(" "))}
    else if(aa is LongArray){Reader.fakein.append(aa.joinToString(" "))}
    else if(aa is List<*>){Reader.fakein.append(aa.toString())}
    else{Reader.fakein.append(aa.toString())}
    Reader.fakein.append("\n")
}

val getintfast:Int get() = Reader.nextInt()
val getint:Int get(){ val ans = getlong ; if(ans > Int.MAX_VALUE) IntArray(1000000000); return ans.toInt() }
val getlong:Long get() = Reader.nextLong()
val getstr:String get() = Reader.nextString()
fun getline(n:Int):IntArray{
    return IntArray(n){getint}
}
fun getlineL(n:Int):LongArray{
    return LongArray(n){getlong}
}
var dmark = -1
infix fun Any.dei(a:Any){
    dmark++
    var str = "<${dmark}>   "
    debug()
    if(this is String){ str += this
    }else if(this is Int){ str += this.toString()
    }else if(this is Long){ str += this.toString()
    }else{ str += this.toString()}
    if(a is List<*>){ println("$str : ${a.joinToString(" ")}")
    }else if(a is IntArray){ println("$str : ${a.joinToString(" ")}")
    }else if(a is LongArray){ println("$str : ${a.joinToString(" ")}")
    }else if(a is BooleanArray){ println("$str :${a.map{if(it)'1' else '0'}.joinToString(" ")}")
    }else if(a is Array<*>){
        println("$str : ")
        for(c in a){if(c is IntArray){println(c.joinToString(" "))}
        else if(c is LongArray){println(c.joinToString(" "))}
        else if(c is BooleanArray){println(c.map { if(it) '1' else '0' }.joinToString(""))
        }
        }
        println()
    }else{ println("$str : $a")
    }
}
val just = " "
fun crash(){
    throw Exception("Bad programme")}
fun assert(a:Boolean){
    if(!a){
        throw Exception("Failed Assertion")
    }}
enum class solveMode {
    real, rand, tc
}
object solve{
    var mode:solveMode = solveMode.real
    var tcNum:Int = 0
    var rand:()->Unit = {}
    var TC:MutableMap<Int,()->Unit> = mutableMapOf()
    var tn:Long = 0
    fun cases(onecase:()->Unit){
        val t = if(mode == solveMode.real){if(singleCase) 1 else getint} else if(mode == solveMode.tc){1 } else randCount
        if(pI != 998_244_353 && pI != 1_000_000_007){
            throw Exception("Not usual primes!")
        }
        if(t == 1 && mode != solveMode.real){
            tn = System.currentTimeMillis()
        }
        repeat(t){
            if(mode == solveMode.tc){
                TC[tcNum]?.let { it() }
                Reader.rerouteInput()
            }else if(mode == solveMode.rand){
                rand()
                Reader.rerouteInput()
            }
            onecase()
        }
        if(t == 1 && mode != solveMode.real){
            val dt = System.currentTimeMillis() - tn
            println("Time $dt ms ")
        }
    }
    inline fun singleCase(a:solve.()->Unit){
        val t = if(mode != solveMode.rand){1} else randCount
        repeat(t) { a() }
    }
    fun rand(a:()->Unit){
        this.rand = a
    }
    fun tc(id:Int = 0,a:()->Unit){
        TC[id] = a
    }
    fun usetc(a:Int = 0 ){
        this.tcNum = a
        this.mode = solveMode.tc
    }
    fun userand(){
        this.mode = solveMode.rand
    }
}
fun debug(){}

object sieve{

    const val sieveMx = 200005
    val primeOf = IntArray(sieveMx + 1)
    var primeCounter = 0
    val primeUpperBound = maxOf(25,(sieveMx.toDouble()/(ln(sieveMx.toDouble()) -4)).toInt() +3)
    val primes = IntArray(primeUpperBound)
    var sieveCalculated = false
    val nextPrime = IntArray(sieveMx+1)
    val nextPrimePower = IntArray(sieveMx+1)
    val afterPrimePowerDivison = IntArray(sieveMx+1)
    var mobius = IntArray(0)

    var factors:List<MutableList<Int>> = mutableListOf()

    fun calculateSieveFast(){
        if(sieveCalculated){
            return
        }
        sieveCalculated = true
        for(i in 2..sieveMx){
            if(primeOf[i] == 0 ){
                primeOf[i] = i
                primes[primeCounter] = i
                primeCounter += 1
            }
            for(j in 0 until primeCounter){
                val p = primes[j]
                val pd = p * i
                if(p <= i && pd <= sieveMx){
                    primeOf[pd] = p
                }else{
                    break
                }
            }
        }
    }
    fun preparePrimePower(){
        nextPrime[1] = -1
        nextPrimePower[1] = -1
        afterPrimePowerDivison[1] = 1
        for(i in 2..sieveMx){
            val p = primeOf[i]
            val new = i / p
            nextPrime[i] = p
            if(nextPrime[new] == p){
                nextPrimePower[i] = nextPrimePower[new]
                afterPrimePowerDivison[i] = afterPrimePowerDivison[new]
            }else{
                afterPrimePowerDivison[i] = new
            }
            nextPrimePower[i] += 1
        }
    }
    fun primeID():Pair<IntArray,IntArray>{
        assert(sieveCalculated)
        var now =0
        val primes = IntArray(primeCounter)
        val id = IntArray(sieveMx) {
            if (it > 0 && primeOf[it] == it) {
                primes[now] = it
                return@IntArray now++
            } else -1}
        return Pair(primes,id)
    }
    fun prepareFactors(){
        // 700ms in 1M
        // shoudl not be used for 1M
        // 200ms codeforces for 200k
        factors = List(sieveMx + 1){ mutableListOf()}
        factors[1].add(1)

        for(i in 2..sieveMx){
            val p = nextPrime[i]
            val a = nextPrimePower[i]
            val old = afterPrimePowerDivison[i]

            var here = 1
            repeat(a+1){
                for(c in factors[old]){
                    factors[i].add(c * here )
                }
                here *= p
            }
//            factors[1].ad
//            factors[i].addAll(i.factors())
        }
    }
    fun calculateMobius(){
        assert(sieveCalculated)
        mobius = IntArray(sieveMx + 1)
        mobius[1] = 1
        for(i in 2..sieveMx){
            val p = primeOf[i]
            if(p == primeOf[i/p]){
                mobius[i] = 0
            }else{
                mobius[i] = -1 * mobius[i/p]
            }
        }
    }
}
inline fun Int.eachPrimePower(act:(Int,Int)->Unit){
    assert(sieve.sieveCalculated)
    var here = this
    while(here > 1){
        act(sieve.nextPrime[here], sieve.nextPrimePower[here])
        here = sieve.afterPrimePowerDivison[here]
    }
}
fun Int.factors():List<Int>{
    val ret = mutableListOf(1)
    this.eachPrimePower { p, e ->
        val s = ret.toList()
        var now = 1
        repeat(e){
            now *= p
            ret.addAll(s.map{it * now})
        }
    }
    return ret
}
fun totient(a:Int):Int{
    var ret = a
    a.eachPrimePower{
            p, _ ->
        ret /= p
        ret *= (p-1)
    }
    return ret
}
fun Int.numOfDivisors():Int{
    var ret = 1
    this.eachPrimePower { _, e -> ret *= (e+1) }
    return ret
}
fun Int.factorLook():List<Int>{
    return sieve.factors[this]
}

tailrec fun gcd(a: Int, b: Int): Int {
    if(b == 0) return a
    return if (a % b == 0) Math.abs(b) else gcd(b, a % b)
}
tailrec fun gcd(a: Long, b: Long): Long {
    if(b == 0L) return a
    return if (a % b == 0L) Math.abs(b) else gcd(b, a % b)
}

fun lcm(a:Long, b:Long):Long{
    return a  * b / (gcd(a,b))
}
const val singleCase = true
fun main(){
    sieve.calculateSieveFast()
    sieve.preparePrimePower()
    sieve.prepareFactors()
    solve.cases{
        val n = getint

        val phi = IntArray(n+1){if(it == 0) 0 else totient(it)}

        var ret = 0
        for(c in 1..n-2){
            val ab = n - c
            for(f in ab.factorLook()){
                if(f == ab) continue
                val options = phi[ab / f]

//                ab dei "$f $options"
                val extra = (lcm(c.toLong(),f.toLong()) % pI).toInt()
                ret = ret modPlus (extra modM options)
            }
        }

        put(ret)

    }
    done()
}


fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    val (numHouses, numHouse) = readInts()
    print(if (numHouse and 1 == 1) (numHouse + 1) / 2 else 1 + (numHouses - numHouse) / 2)
}


fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    val (_, x) = readInts()
    val numsSet = readInts().toSet()
    var sol = 0
    for (num in 0 until x) if (num !in numsSet) sol++
    if (x in numsSet) sol++
    print(sol)
}


import java.util.*

fun main(args: Array<String>) {
    val tokenizer = StringTokenizer(readLine())
    val n = tokenizer.nextToken().toInt()
    val x = tokenizer.nextToken().toInt()
    val arrayTokenizer = StringTokenizer(readLine())
    var steps = x
    generateSequence { arrayTokenizer.takeIf { it.hasMoreTokens() }?.nextToken()?.toInt() }.forEach {
        if (it < x) {
            steps--
        } else if (it == x) {
            steps++
        }
    }
    println(steps)
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    val num = r.readLine()!!.toInt()
    //var (n, m) = r.readLine()!!.split(" ").map { it.toInt() }
    val m = r.readLine()!!.split(" ").map { it.toInt() }
    val n = r.readLine()!!.split(" ").map { it.toInt() }
    val c1 = m.subList(1, m[0]+1).toMutableList()
    val c2 = n.subList(1, n[0]+1).toMutableList()
    val hash = mutableSetOf<Int>()
    var ans = 0
    while (c1.size>0&&c2.size>0){
        ans ++
        when{
            c1[0]>c2[0] -> {
                c1 += c2[0]
                c1 += c1[0]
                c1.removeAt(0)
                c2.removeAt(0)
            }
            c1[0]<c2[0] -> {
                c2 += c1[0]
                c2 += c2[0]
                c1.removeAt(0)
                c2.removeAt(0)
            }
        }
        if (c1.hashCode()-c2.hashCode() !in hash) {
            hash += c1.hashCode()-c2.hashCode()
        } else {
            ans = -1
            break
        }
    }
    val win = if (c1.size==0) 2 else 1
    println(if (c1.size*c2.size!=0) -1 else "$ans $win")
}


fun main() {

    val k = readLine()
    var i = 1

    var generateSequence = generateSequence{i++}.takeWhile { i<=10000 }
    print(generateSequence.elementAt(k!!.toInt()-1))

}


fun main() {
    fun readInt() = readLine()!!.toInt()

    val sb = StringBuilder()
    for (i in 1 until 2780) sb.append(i)
    print(sb[readInt() - 1])
}


fun readLn() = readLine()!!

fun main() {
	var k = readLn().toLong();
	var (p, np, numD) = listOf(1L, 10L, 1);
	k--;
	while (true) {
		val x = minOf(k/numD, np-p);

		k -= x*numD;

		if (x < np-p) {
			println((p+x).toString()[k.toInt()]);
			break;
		}

		numD++;
		p = np;
		np *= 10;
	}

}


fun main(){

    var k = readLine()!!.toInt()

    //9 однозначных чисел
    //90 двузначных
    //900 трехзначных
    //9000 четырехзначных
    //числа максимум четырехзначные
    var p = 1
    for (i in 1..4){
        val s=i*9*p
        if (k<=s){
            //значит число i значное
            //нужно понять какое оно по счету среди i значных
            val pos = if(k%i==0){
                k/i
            }else{
                k/i+1
            }
            val num = p-1+pos//то самое число в которое попали
            //теперь нужно узнать какая именно цифра заданного числа
            val n = (k-1)%i
            println(num.toString()[n])
            break
        }else{
            k-=s
            p*=10
        }
    }
}


fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val xs = readLine()!!.split(" ").map(String::toInt)
    val ys = readLine()!!.split(" ").map(String::toInt)

    var cnt = 0
    for (i in 0 until xs.size) {
        val xor_ret = xs[i] xor ys[i]
        if (xor_ret in setOf(xs[i], ys[i])) {
        //if (xs[i].xor(ys[i])) {
            cnt += 1
        }
    }

    if (cnt % 2 == 0) {
        println("Karen")
    } else {
        println("Koyomi")
    }

}


import java.util.*

fun main() {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    scanner.nextLine()
    val a = scanner.nextLine().split(" ").map { it.toInt() }.toIntArray()
    val b = scanner.nextLine().split(" ").map { it.toInt() }.toIntArray()

    println(findWinner(a, b, n))
}

fun findWinner(x: IntArray, y: IntArray, n: Int): String {
    var count = 0L

    for(i in 0 until n) {
        for (j in 0 until n) {
            val temp =  (x[i].xor(y[j]))
            if (x.contains(temp) || y.contains(temp)) {
                count++
            }
        }
    }

    return if (count % 2L == 0L) {
        "Karen"
    } else {
        "Koyomi"
    }
}


fun main(){
    val r = readLine()!!.toInt()

    var x = 1
    while (true){
        val y = (r-x*x-x-1)
        if (y<0){
            println("NO")
            break
        }
        if (y%(2*x)==0){
            println("$x ${y/(2*x)}")
            break
        }

        x++
    }
}


fun main(){
    val r = readLine()!!.toLong()

    var x = 1L
    while (true){
        val y = (r-x*x-x-1)
        if (y<=0){
            println("NO")
            break
        }
        if (y%(2*x)==0L){
            println("$x ${y/(2*x)}")
            break
        }

        x++
    }
}


fun main() {
    val r = readLong()

    val ans = run {
        if(r % 2 == 0L) return@run "NO"
        val y = (r - 3) / 2
        if(y <= 0) "NO" else "1 $y"
    }

    println(ans)
}

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readDouble() = readLn().toDouble()
fun readLong() = readLn().toLong()
fun readStrings() = readLn().split(' ')
fun readInts() = readStrings().map { it.toInt() }
fun readDoubles() = readStrings().map { it.toDouble() }
fun readLongs() = readStrings().map { it.toLong() }

class Output {
    private val sb = StringBuilder()
    fun print(o: Any?) { sb.append(o) }
    fun println() { sb.append('\n') }
    fun println(o: Any?) { sb.append(o).append('\n') }
    @JvmName("_print") fun Any?.print() = print(this)
    @JvmName("_println") fun Any?.println() = println(this)
    fun nowPrint() { kotlin.io.print(sb) }
}
inline fun output(block: Output.()->Unit)
    { Output().apply(block).nowPrint() }


fun main() {
    val r = readInt()

    val ans = run {
        if(r % 2 == 0) return@run "NO"
        val y = (r - 3) / 2
        if(y <= 0) "NO" else "1 $y"
    }.also { println(it) }
}

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readDouble() = readLn().toDouble()
fun readLong() = readLn().toLong()
fun readStrings() = readLn().split(' ')
fun readInts() = readStrings().map { it.toInt() }
fun readDoubles() = readStrings().map { it.toDouble() }
fun readLongs() = readStrings().map { it.toLong() }

class Output {
    private val sb = StringBuilder()
    fun print(o: Any?) { sb.append(o) }
    fun println() { sb.append('\n') }
    fun println(o: Any?) { sb.append(o).append('\n') }
    @JvmName("_print") fun Any?.print() = print(this)
    @JvmName("_println") fun Any?.println() = println(this)
    fun nowPrint() { kotlin.io.print(sb) }
}
inline fun output(block: Output.()->Unit)
    { Output().apply(block).nowPrint() }


/**
 * Description: Kotlin tips for dummies
 * Source: own
 */

/* sorting
 * 1 (ok)
    val a = nextLongs().sorted() // a is mutable list
 * 2 (ok)
    val a = arrayListOf<Long>() // or ArrayList<Long>()
    a.addAll(nextLongs())
    a.sort()
 *.3 (ok)
    val A = nextLongs()
    val a = Array<Long>(n,{0})
    for (i in 0..n-1) a[i] = A[i]
    a.sort()
 * 4 (ok)
    val a = ArrayList(nextLongs())
    a.sort()
 * 5 (NOT ok)
    val a = LongArray(N) // or nextLongs().toLongArray()
    Arrays.sort(a)
 */
/* 2D array
 * val ori = Array(n, {IntArray(n)})
 * val ori = arrayOf(
    intArrayOf(8, 9, 1, 13),
    intArrayOf(3, 12, 7, 5),
    intArrayOf(0, 2, 4, 11),
    intArrayOf(6, 10, 15, 14)
    )
 */
/* printing variables:
 * println("${l+1} and $r")
 * print d to 8 decimal places: String.format("%.8g%n", d)
 * try to print one stringbuilder instead of multiple prints
 */
/* comparing pairs
    val pq = PriorityQueue<Pair<Long,Int>>({x,y -> x.first.compareTo(y.first)})
    val pq = PriorityQueue<Pair<Long,Int>>(compareBy {it.first})
    val A = arrayListOf(Pair(1,3),Pair(3,2),Pair(2,3))
    val B = A.sortedWith(Comparator<Pair<Int,Int>>{x,y -> x.first.compareTo(y.first)})
    sortBy
 */
/* hashmap
    val h = HashMap<String,Int>()
    for (i in 0..n-2) {
        val w = s.substring(i,i+2)
        val c = h.getOrElse(w){0}
        h.put(w,c+1)
    }
 */
/* basically switch, can be used as expression
    when (x) {
        0,1 -> print("x <= 1")
        2 -> print("x == 2")
        else -> { // Note the block
            print("x is neither 1 nor 2")
        }
    }
*/
// swap : a = b.also { b = a }
// arraylist remove element at index: removeAt, not remove ...
// lower bound: use .binarySearch()

import java.util.*
// import kotlin.math.*

val MOD = 1000000007
val SZ = 1 shl 18
val INF = (1e18).toLong()

fun add(a: Int, b: Int) = (a+b) % MOD // from tourist :o
fun sub(a: Int, b: Int) = (a-b+MOD) % MOD
fun mul(a: Int, b: Int) = ((a.toLong() * b) % MOD).toInt()

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextInts() = next().split(" ").map { it.toInt() }
fun nextLongs() = next().split(" ").map { it.toLong() }

val out = StringBuilder()
fun YN(b: Boolean):String { return if (b) "YES" else "NO"  }

fun gcd(a: Int, b: Int): Int {
    return if (a == 0) b else gcd(b%a,a)
}

fun isMul(a: Int, b: Int, c: Int, d: Int): Boolean {
    if (a == 0 && b == 0) return true
    if (c == 0 && d == 0) return false
    if (a.toLong()*d != b.toLong()*c) return false
    if (c != 0) {
        if (a%c != 0 || a/c < 0) return false
    } else {
        if (b%d != 0 || b/d < 0) return false
    }
    return true
}

fun solve() {
    val (a,b) = nextInts()
    val s = next()
    var (x,y) = arrayOf(0,0)
    for (c in s) {
        if (c == 'U') {
            y ++
        }
        if (c == 'D') {
            y --
        }
        if (c == 'L') {
            x --
        }
        if (c == 'R') {
            x ++
        }
    }
    var (X,Y) = arrayOf(0,0)
    for (c in s) {
        var (difx,dify) = arrayOf(a-X,b-Y)
        if (isMul(difx,dify,x,y)) {
            println("Yes")
            System.exit(0)
        }
        if (c == 'U') {
            Y ++
        }
        if (c == 'D') {
            Y --
        }
        if (c == 'L') {
            X --
        }
        if (c == 'R') {
            X ++
        }
    }
    println("No")
}

fun main(args: Array<String>) {
    solve()
}


fun main() {
    var a = readLine()!!.toInt()
    if (a >= 0) {
        print(a)
        return
    }
    val s = (-a).toString()
    println((0 until s.length)
        .map { s.removeRange(it..it) }
        .map { it.toInt() }
        .filter { it.toString().length == s.length - 1 }
        .map { -it }
        .max())
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    //val n = r.readLine()!!.toInt()
    //val (n, m, a, b) = r.readLine()!!.split(" ").map { it.toInt() }

    var act = r.readLine()!!
    when{
        act[0] != '-' -> println(act.toInt())
        else -> {
            act = act.removeRange(0..0)
            val size = act.length
            val last = act[size-1]
            val second = act[size-1]
            if (last>=second) {
                act = act.removeRange(size-1..size-1)
            } else{
                act = act.removeRange(size-2..size-2)
            }
            s.append("-")
            s.append(act.toInt())
            println(s)
        }
    }
}


fun main()
{
    var n = readLine()!!.toInt()
    var answer = n
    if (n / 10 > answer) answer = n / 10
    val opt1 = (n % 10) + (n / 100) * 10
    if (opt1 > answer) answer = opt1
    println(answer)

}


fun main() {
    val (n, a, b, c, d) = readLine()!!.split(" ").map(String::toInt)
    var sol = 0L
    for (x1 in 1..n) {
        if (x1 + b - c in 1..n &&
            x1 + a - d in 1..n &&
            x1 + a + b - c - d in 1..n
        )
            sol++
    }
    print(sol * n)
}


import java.io.FileInputStream
import java.math.BigDecimal
import java.math.BigInteger

fun main(args: Array<String>) {
    if (args.size > 0) {
        input = FileInputStream(args[0])
    }
    var str = nextString()
    var tokens = str!!.split("VK")
    var ans = tokens.size - 1 + if (tokens.filter { it.length > 1 && it != "KV" }.isNotEmpty()) 1 else 0
    println(ans)
}

fun String.toBigInteger() = BigInteger(this)
fun String.toBigDecimal() = BigDecimal(this)

var input = System.`in`

val sb = StringBuilder()
val buffer = ByteArray(4096)
var pos = 0
var size = 0

fun nextString(): String? {
    var c = skipWhitespace()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        do {
            append(c.toChar())
            c = read()
        } while (c > ' '.toInt())

        toString()
    }
}

fun nextLine(): String? {
    var c = read()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        while (c >= 0 && c != '\n'.toInt()) {
            append(c.toChar())
            c = read()
        }

        toString()
    }
}

fun nextLong(): Long {
    var c = skipWhitespace()

    val sign = if (c == '-'.toInt()) {
        c = read()
        -1
    } else 1

    var ans = 0L

    while (c > ' '.toInt()) {
        ans = ans * 10 + c - '0'.toInt()
        c = read()
    }

    return sign * ans
}

fun nextInt() = nextLong().toInt()
fun nextDouble() = nextString()?.toDouble() ?: 0.0
fun nextBigInteger(): BigInteger = nextString()?.toBigInteger() ?: BigInteger.ZERO
fun nextBigDecimal(): BigDecimal = nextString()?.toBigDecimal() ?: BigDecimal.ZERO

fun nextStrings(n: Int) = Array<String>(n) { nextString() ?: "" }
fun nextInts(n: Int) = IntArray(n) { nextInt() }
fun nextLongs(n: Int) = LongArray(n) { nextLong() }
fun nextDoubles(n: Int) = DoubleArray(n) { nextDouble() }
fun nextBigIntegers(n: Int) = Array<BigInteger>(n) { nextBigInteger() }
fun nextBigDecimals(n: Int) = Array<BigDecimal>(n) { nextBigDecimal() }

fun nextStrings(n: Int, m: Int) = Array(n) { nextStrings(m) }
fun nextInts(n: Int, m: Int) = Array(n) { nextInts(m) }
fun nextLongs(n: Int, m: Int) = Array(n) { nextLongs(m) }
fun nextDoubles(n: Int, m: Int) = Array(n) { nextDoubles(m) }
fun nextBigIntegers(n: Int, m: Int) = Array(n) { nextBigIntegers(m) }
fun nextBigDecimals(n: Int, m: Int) = Array(n) { nextBigDecimals(m) }

private fun skipWhitespace(): Int {
    while (true) {
        val c = read()
        if (c > ' '.toInt() || c < 0) return c
    }
}

private fun read(): Int {
    while (pos >= size) {
        if (size < 0) return -1
        size = input.read(buffer, 0, buffer.size)
        pos = 0
    }
    return buffer[pos++].toInt()
}


import java.util.StringTokenizer
import java.io.PrintWriter

fun main() {
  for(t in 1..1) {
    val s = readString().toCharArray()
    val l = s.size
    var c = 0
    var f = false
    for (i in 1..l - 1) {
      if (s[i] == 'K' && s[i - 1] == 'V') c++
      else if (!f && s[i] == 'V' && s[i - 1] == 'V') {
        if((i < l - 1 && s[i + 1] != 'K') || (i == l - 1)) {
          c++
          s[i] = 'K'
          f = true
        }
      }
      else if (!f && s[i] == 'K' && s[i - 1] == 'K') {
        if((i >= 2 && s[i - 2] == 'K') || (i == 1)) {
          c++
          s[i - 1] = 'V'
          f = true
        }
      }
    }
//    wr(s.joinToString(""))
    if(l == 2 && s[0] == 'K' && s[1] == 'K') wr(1)
    else if (l > 1) wr(c)
    else wr(0)
  }
}

@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out
@JvmField val _reader = INPUT.bufferedReader()

fun readLine(): String? = _reader.readLine()
fun readLn(): String = _reader.readLine()!!

@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")

fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}

fun readString() = readLn()
fun readStrings() = readLn().split(" ")
fun readInt() = readLn().toInt()
fun readInts() = readStrings().map { it.toInt() }
fun readLong() = readLn().toLong()
fun readLongs() = readStrings().map { it.toLong() }

fun wr(a: String) = println(a)
fun wr(a: Int) = println(a)

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }


import java.io.FileInputStream
import java.math.BigDecimal
import java.math.BigInteger

fun main(args: Array<String>) {
    if (args.size > 0) {
        input = FileInputStream(args[0])
    }
    var str = nextLine()
    var tokens = str!!.split("VK")
    var ans = tokens.size - 1 + if (tokens.filter { it.length > 1 && it != "KV" }.isNotEmpty()) 1 else 0
    println(ans)
}

fun String.toBigInteger() = BigInteger(this)
fun String.toBigDecimal() = BigDecimal(this)

var input = System.`in`

val sb = StringBuilder()
val buffer = ByteArray(4096)
var pos = 0
var size = 0

fun nextString(): String? {
    var c = skipWhitespace()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        do {
            append(c.toChar())
            c = read()
        } while (c > ' '.toInt())

        toString()
    }
}

fun nextLine(): String? {
    var c = read()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        while (c >= 0 && c != '\n'.toInt()) {
            append(c.toChar())
            c = read()
        }

        toString()
    }
}

fun nextLong(): Long {
    var c = skipWhitespace()

    val sign = if (c == '-'.toInt()) {
        c = read()
        -1
    } else 1

    var ans = 0L

    while (c > ' '.toInt()) {
        ans = ans * 10 + c - '0'.toInt()
        c = read()
    }

    return sign * ans
}

fun nextInt() = nextLong().toInt()
fun nextDouble() = nextString()?.toDouble() ?: 0.0
fun nextBigInteger(): BigInteger = nextString()?.toBigInteger() ?: BigInteger.ZERO
fun nextBigDecimal(): BigDecimal = nextString()?.toBigDecimal() ?: BigDecimal.ZERO

fun nextStrings(n: Int) = Array<String>(n) { nextString() ?: "" }
fun nextInts(n: Int) = IntArray(n) { nextInt() }
fun nextLongs(n: Int) = LongArray(n) { nextLong() }
fun nextDoubles(n: Int) = DoubleArray(n) { nextDouble() }
fun nextBigIntegers(n: Int) = Array<BigInteger>(n) { nextBigInteger() }
fun nextBigDecimals(n: Int) = Array<BigDecimal>(n) { nextBigDecimal() }

fun nextStrings(n: Int, m: Int) = Array(n) { nextStrings(m) }
fun nextInts(n: Int, m: Int) = Array(n) { nextInts(m) }
fun nextLongs(n: Int, m: Int) = Array(n) { nextLongs(m) }
fun nextDoubles(n: Int, m: Int) = Array(n) { nextDoubles(m) }
fun nextBigIntegers(n: Int, m: Int) = Array(n) { nextBigIntegers(m) }
fun nextBigDecimals(n: Int, m: Int) = Array(n) { nextBigDecimals(m) }

private fun skipWhitespace(): Int {
    while (true) {
        val c = read()
        if (c > ' '.toInt() || c < 0) return c
    }
}

private fun read(): Int {
    while (pos >= size) {
        if (size < 0) return -1
        size = input.read(buffer, 0, buffer.size)
        pos = 0
    }
    return buffer[pos++].toInt()
}


fun model(n: Long, k: Long): Long {
    var rem = n
    var ans = 0L

    while (rem > 0) {
        val vasyaCount = Math.min(rem, k)
        ans += vasyaCount
        rem -= vasyaCount
        rem -= rem / 10
    }

    return ans
}

fun check(vasyaCount: Long, n: Long) = vasyaCount > n / 2

fun main(args: Array<String>) {
    val n = readLine()!!.toLong()

    var a = 1L
    var b = n

    while (b - a > 1) {
        val c = (a + b) / 2
        if (check(model(n, c), n)) {
            b = c
        } else {
            a = c
        }
    }

    if (check(a, n)) {
        println(a)
    } else {
        println(b)
    }
}


fun model(n: Long, k: Long): Long {
    var rem = n
    var ans = 0L

    while (rem > 0) {
        val vasyaCount = Math.min(rem, k)
        ans += vasyaCount
        rem -= vasyaCount
        rem -= rem / 10
    }

    return ans
}

fun check(vasyaCount: Long, n: Long) = 2 * model(n, vasyaCount) >= n

const val LIMIT = 100_000

fun main(args: Array<String>) {
    val n = readLine()!!.toLong()

    var a = 1L
    var b = n

    while (b - a > 1) {
        val c = (a + b) / 2
        if (check(model(n, c), n)) {
            b = c
        } else {
            a = c
        }
    }

    a = Math.max(a - LIMIT / 2, 1L)
    b = a + LIMIT / 2

    for (k in a..b) {
        if (check(k, n)) {
            println(k)
            break
        }
    }
}


//package codeForces.c491_2

fun tryEat(n: Long, c: Long): Boolean {
    var remains = n
    var eaten = 0L

    while (remains > c) {
        remains -= c
        eaten += c

        remains -= remains / 10
    }
    eaten += remains

    return eaten >= n / 2
}

fun main(args: Array<String>) {
    val n = readLine()!!.toLong()

    var left = 0L
    var right = n
    var lastSuccess = -1L

    while (left <= right) {
        val c = (left + right) / 2

        if (tryEat(n, c)) {
            lastSuccess = c
            right = c - 1
        } else {
            left = c + 1
        }
    }

    println(lastSuccess)
}


fun main(){
    var l = readLine()!!.split(" ")
    val p1 = l[0].toInt()
    val p2 = l[1].toInt()

    if (p1 == p2) {
        println("0 6 0")
        return
    }

    var diff = p1 - p2
    if (diff < 0 ) diff++
        else diff--

    var likt = 0
    if (diff % 2 != 0) {
        likt = 1
    }
    diff /= 2

    var w1 = 0
    var w2 = 0

    if (p1 > p2) {
        w1 = 6 - (p1 - diff - 1)
    }else{
        w1 = p1 - diff
    }
    w2 = 6 - likt - w1

    println("$w1 $likt $w2")

}


import kotlin.math.abs

fun main(args: Array<String>) = with(java.util.Scanner(System.`in`)) {
    var a = nextInt()
    var b = nextInt()
    var win = 0
    var draw = 0
    var lose = 0
    for( i in 1..6){
        if(abs(a-i) == abs(i-b))draw++
        else if(abs(a-i)>abs(i-b))win++
        else lose++
    }
    println("$win $draw $lose")
}


import java.util.Scanner
fun main(){
  	val reader=Scanner(System.`in`)
    var a:Int=reader.nextInt()
    var b:Int=reader.nextInt()
    var c=0
    while(b>0){
        c=c*10+(b%10)
        b/=10
    }
    print(a+c)
}


import java.util.Scanner

fun main(args : Array<String>) {
    var list1: MutableList<String> = mutableListOf()
    for (i in 0..7) {
        list1.add(readLine()!!)
    }

    var row = 0
    var a = 0
    for (i in 0..7) {
        var col = 0
        for (char in list1[i]) {
            if (char == 'B') {
                col++
            }
            if (col == 8) {
                row++
            }
        }
        a = col
    }

    var c = row + a
    if (c==16){ println(8) }
    else  { println(c)}
}


fun main(args: Array<String>) {
    val chain = readLine()!!.toCharArray()
    checkChain(chain)
}

fun checkChain(chain: CharArray) {
    val char1 = '-'
    val char0 = 'o'

    val char1Count = chain.filter { it == char1 }.count()
    val char0Count = chain.filter { it == char0 }.count()

    if (char0Count == 0 || char1Count == 0) return print("YES")

    when {
        char0Count > char1Count -> return print("NO")
        char0Count < char1Count -> return if (char1Count % char0Count == 0) print("YES") else print("NO")
        char0Count == char1Count -> return print("YES")
        else -> {
        }
    }
}


fun main(args: Array<String>){
	// 0 -businka
	// 1 - nit'
	val busy = readLine().toString().map{if (it =='o') 0 else 1}
	val length = busy.size
	val nitN = busy.sum()
	val busyN = length - nitN
	//println("$busyN $nitN")
	if (busyN == 0){
		println("YES")
		return
	}
	val zlp = nitN.rem(busyN)
	if (zlp == 0) println("YES") else println("NO")

}


fun main(args: Array<String>) {
    val a = readLine()!!
    val b = a.count{it=='o'}
    val n = a.count{it=='-'}
    // --o--o--o
    if(n == 0 || b == 0) {
        print("YES")
    } else print(
            if(n % b == 0) "YES" else "NO"
    )
}


fun main(args: Array<String>) {
    val (links, pearls) = readLine()!!.partition { it == '-' }
    if (pearls.isEmpty()) {
        println("YES")
    } else {
        println(if (links.length % pearls.length == 0) "YES" else "NO")
    }
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    //val n = r.readLine()!!.toInt()
    //val l = r.readLine()!!.split(" ").map { it.toInt() }
    //val n = r.readLine()!!.toInt()
    val (n, m) = r.readLine()!!.split(" ").map { it.toInt() }
    when{
        n>2*m -> println(m)
        m>2*n -> println(n)
        else -> println((m+n)/3)
    }
}


import com.sun.javafx.binding.SelectBinding

// contest/65/A Harry Potter and Three Spells train

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main() {
    val abcdef = readInts()
    val a = abcdef[0]
    val b = abcdef[1]
    val c = abcdef[2]
    val d = abcdef[3]
    val e = abcdef[4]
    val f = abcdef[5]
    var ace : Long
    var bdf : Long
    var canInf = false

    var coef = 1.0
    if (d==0) {
        // no gold
        canInf = false
    } else if (c!=0 && b==0) {
        // no lead
        canInf = false
    } else if (a != 0 && f==0) {
        // no sand
        canInf = false
    } else if (d!=0 && c==0) {
        canInf = true  // unlimited gold
    } else if (d!=0 && c==0) {
        canInf = true  // unlimited gold
    } else if (b!=0 && d != 0 && a==0) {
        canInf = true  // unlimited lead
    } else if (b!=0 && d != 0 && f!=0 && e==0) {
        canInf = true  // unlimited sand
    } else {
        ace = a.toLong()*c*e
        bdf = b.toLong() *d*f
        canInf = bdf > ace
    }

    println(if (canInf) "Ron" else "Hermione")
}


import java.util.*

fun main() {
    var w: Int
    var h: Int

    with(Scanner(System.`in`)) {
        w = nextInt()
        h = nextInt()
    }

    var count = 0

    for (i in w / 2 downTo 1 step 1) {
        for (j in h / 2 downTo 1 step 1) {
            count += (w - i * 2 + 1) * (h - j * 2 +1)
        }
    }
    print(count)
}


fun main(arg: Array<String>){
	var s = readLine()!!
	var m = readLine()!!.toLong()
	var l = s.length
	var now = 0.toLong()
	var Q = 1.toLong()
	for(i in 0..l-1){
		now = (now * 10 + (s[i].toInt() - 48))%m
		Q = Q * 10 % m
	}
	var res = now
	for(i in 0..l-1){
		var x = s[i].toInt() - 48
		now = (now * 10 + x - x * Q % m + m)%m
		if(now < res)res = now
	}
	println(res)
}


fun main(args: Array<String>) {
    val line = readLine()!!.toCharArray()

    (1 until line.size).forEach {
        if (line[it] < line[it - 1]){
            println("NO")
            return
        }
    }
    val sorted = line.toSet().sorted()

    if (sorted.size > 26){
        println("NO")
        return
    }

    (1 until sorted.size).forEach {
        if (sorted[it] - sorted[it-1] != 1){
            println("NO")
            return
        }
    }
    println("YES")
}


/**
 * Created by tux on 31.12.16.
 */

fun main(args: Array<String>) {
    val T = readLine()!!

    var nextChar = 'a'
    var ret = true
    for (c in T) {
        if (c == nextChar) {
            nextChar = (nextChar.toInt() + 1).toChar()

        } else if (c > nextChar) {
            ret = false
            break
        } else if (nextChar > 'z') {
            ret = false
            break
        }
    }

    println(if (ret) "YES" else "NO")
}


fun main() {
    var next = 'a'
    for (c in readLine()!!)
        when {
            c == next -> next++
            c > next -> return print("NO")
        }
    print("YES")
}


fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map(String::toInt)
    val (c, d) = readLine()!!.split(" ").map(String::toInt)

    var ans = -1

    loop@ for (x in 0..99) {
        for (y in 0..99) {
            val t1 = b + x * a
            val t2 = d + y * c
            if (t1 == t2) {
                ans = t1
                break@loop
            }
        }
    }

    println(ans)
}


import java.io.*
import java.util.*

tailrec fun gcd(a: Int, b: Int): Int {
    if (a != 0 && b != 0) {
        if (a > b) return gcd(a % b, b)
        else return gcd(b % a, a)
    }

    return a + b
}

fun gcde(a: Int, b: Int): Triple<Int, Int, Int> {
    if (a == 0) {
        return Triple(b, 0, 1)
    }

    val (d, x1, y1) = gcde(b % a, a)

    return Triple(d, y1 - (b / a) * x1, x1)
}

fun DataReader.solve(out: PrintWriter) {
    val b = nextInt()
    val a = nextInt()
    val d = nextInt()
    val c = nextInt()

    val q = c - a
    val (g) = gcde(b, -d)

    if (q % g != 0) {
        out.println(-1)
        return
    }

    for (i in 0..100000000) {
        val w = a + i * b - c

        if (w >= 0 && w % d == 0) {
            out.println(w + c)
            return
        }
    }

//
//    val p = q / g
//
//    val (g1, x, y) = gcde(b / g, -d / g)
//
//    val (xr, yr) = x * p to y * p

    throw RuntimeException(":(")
}

fun Boolean.toYesNo() = if (this) "YES" else "NO"

class DataReader(private val reader: BufferedReader) {
    var st : StringTokenizer? = null
    companion object {
        fun createFromFile(name: String) = DataReader(BufferedReader(FileReader(name)))
    }

    fun next() : String? {
        while (st == null || !st!!.hasMoreTokens()) {
            val s = reader.readLine() ?: return null
            st = StringTokenizer(s)
        }

        return st?.nextToken()
    }

    fun nextToken() = next()!!

    fun nextInt() = nextToken().toInt()
    fun nextLong() = nextToken().toLong()
    fun readIntArray(n: Int) : IntArray {
        val result = IntArray(n)
        result.indices.forEach { i -> result[i] = nextInt() }
        return result
    }

    fun readLongArray(n: Int) : LongArray {
        val result = LongArray(n)
        result.indices.forEach { i -> result[i] = nextLong() }
        return result
    }

    fun nextLine() = reader.readLine()
}

fun main(args: Array<String>) {
    val r: Reader
    val out: PrintWriter
    if (System.getProperty("ONLINE_JUDGE") == null) {
        r = FileReader("input.txt")
        out = PrintWriter("output.txt")
    } else {
        r = InputStreamReader(System.`in`)
        out = PrintWriter(System.out)
    }

    DataReader(BufferedReader(r)).solve(out)
    out.flush()
}


import java.io.*
import java.util.*

fun DataReader.solve(out: PrintWriter) {
    val b = nextInt()
    val a = nextInt()
    val d = nextInt()
    val c = nextInt()

    for (i in 1..1000000) {
        val q = a + i * b - c

        if (q >= 0 && q % d == 0) {
            out.println(q + c)
            return
        }
    }

    out.println(-1)
}

fun Boolean.toYesNo() = if (this) "YES" else "NO"

class DataReader(private val reader: BufferedReader) {
    var st : StringTokenizer? = null
    companion object {
        fun createFromFile(name: String) = DataReader(BufferedReader(FileReader(name)))
    }

    fun next() : String? {
        while (st == null || !st!!.hasMoreTokens()) {
            val s = reader.readLine() ?: return null
            st = StringTokenizer(s)
        }

        return st?.nextToken()
    }

    fun nextToken() = next()!!

    fun nextInt() = nextToken().toInt()
    fun nextLong() = nextToken().toLong()
    fun readIntArray(n: Int) : IntArray {
        val result = IntArray(n)
        result.indices.forEach { i -> result[i] = nextInt() }
        return result
    }

    fun readLongArray(n: Int) : LongArray {
        val result = LongArray(n)
        result.indices.forEach { i -> result[i] = nextLong() }
        return result
    }

    fun nextLine() = reader.readLine()
}

fun main(args: Array<String>) {
    val r: Reader
    val out: PrintWriter
    if (System.getProperty("ONLINE_JUDGE") == null) {
        r = FileReader("input.txt")
        out = PrintWriter("output.txt")
    } else {
        r = InputStreamReader(System.`in`)
        out = PrintWriter(System.out)
    }

    DataReader(BufferedReader(r)).solve(out)
    out.flush()
}


import ds.*
import nt.*
import java.io.*
import java.util.*
import java.math.*

//val inp = BufferedReader(FileReader ( "input.txt" ) )
val inp = BufferedReader(InputStreamReader(System.`in`))

fun solve() : Int {
	val a = ( inp.readLine() ?: return 1 ).split(" ").map{ it.toInt() }
	val b = ( inp.readLine() ?: return 1 ).split(" ").map{ it.toInt() }
	var curA = a[1]
	var curB = b[1]
	for ( i in 1..1000000 ) {
		if ( curA == curB ) {
			println ( "" + curA )
			return 0
		}
		if ( curA < curB ) curA += a[0]
		else curB += b[0]
	}
	println ( "-1" )
	return 0
}

fun main ( args : Array<String> ) {
	while (solve()==0);
}


import kotlin.math.*

fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }
    println(countWays(n, k))
}

fun countWays(n: Long, k: Long): Long {
    if (k <= 1 || k > 2 * n - 1) return 0
    val m1 = k / 2
    val m2 = k - m1
    return min(n - m2 + 1, m1)
}


import java.io.OutputStream
import java.io.PrintWriter

// @author: noisegain

fun main() = withFastOut(times = readInt()) {
    val s = Array(2) { readInts(2) }
    if (s.all { it == listOf(1, 1) }) {
        println(2)
    } else if (s.any { it.contains(1) }) {
        println(1)
    } else {
        println(0)
    }
}
/* Utilities */
class MyMap<K, V>(
    private val back: MutableMap<K, V> = mutableMapOf(),
    private val default: (K) -> V
) : MutableMap<K, V> by back {

    override tailrec fun get(key: K): V = if (key in back) back[key]!! else {
        put(key, default(key))
        get(key)
    }

    override fun equals(other: Any?) = back == other

    override fun hashCode() = back.hashCode()

    override fun toString() = back.toString()
}

fun <T1 : Comparable<T1>, T2 : Comparable<T2>> pairCmp(): Comparator<Pair<T1, T2>> = Comparator { a, b ->
    val res = a.first.compareTo(b.first)
    if (res == 0) a.second.compareTo(b.second) else res
}

fun Boolean.toInt() = if (this) 1 else 0

/* Output */
inline fun withFastOut(
    out: OutputStream = System.out,
    times: Int = 1,
    fn: PrintWriter.() -> Unit
) = PrintWriter(out).use { writer ->
    repeat(times) { fn(writer) }
}

fun PrintWriter.printVar(vararg x: Any?, sep: String = " ") = println(x.joinToString(sep))

/* Input */
val INPUT = System.`in`
const val BUFFER_SIZE = 1 shl 16
val buffer = ByteArray(BUFFER_SIZE)
var bufferPt = 0
var bytesRead = 0

tailrec fun readChar(): Char {
    if (bufferPt == bytesRead) {
        bufferPt = 0
        bytesRead = INPUT.read(buffer, 0, BUFFER_SIZE)
    }
    return if (bytesRead < 0) Char.MIN_VALUE
    else {
        val c = buffer[bufferPt++].toChar()
        if (c == '\r') readChar()
        else c
    }
}

fun readLine(): String? {
    var c = readChar()
    return if (c == Char.MIN_VALUE) null
    else buildString {
        while (true) {
            when (c) {
                '\n', Char.MIN_VALUE -> return@buildString
                else -> {
                    append(c)
                    c = readChar()
                }
            }
        }
    }
}

fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while (c <= ' ') {
        if (c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while (c > ' ')
}

fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readInts(n: Int) = List(n) { readInt() }
fun readLongs(n: Int) = List(n) { readLong() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }


fun main()
{
    val limit = readln().toInt()
    for (i in 1..limit)
    {
        val firstRow = readln().split(" ")
        val secondRow = readln().split(" ")
        val one = firstRow[0].toInt()
        val two = firstRow[1].toInt()
        val three = secondRow[0].toInt()
        val four = secondRow[1].toInt()
        if (one == 0 && two == 0 && three == 0 && four == 0)
        {
            println("0")
        }
        else if (one == 1 && two == 1 && three == 1 && four == 1)
        {
            println("2")
        }
        else println("1")
    }
}


fun main() {
  repeat(readln().toInt()) {
    val grid = Array(2) { readln().split(" ").map { it.toInt() } }

    if(grid.flatMap { it }.all { it == 1 }) println(2)
    else if (grid.flatMap { it }.all { it == 0 }) println(0)
    else println(1)
  }
}


fun readInt() = readln().toInt()
fun readStrings() = readln().split(" ")
fun readInts() = readStrings().map { it.toInt() }

fun main() {
    repeat(readInt()) {
        val a = listOf(readInts(), readInts())
        output(solve(a))
    }
}

fun solve(a: List<List<Int>>): Int {
    val cnt = a[0][0] + a[0][1] + a[1][0] + a[1][1]
    if (cnt == 0) return 0
    if (cnt == 4) return 2
    return 1
}

fun output(res: Int) {
    println(res)
}


import java.io.PrintWriter
import java.util.StringTokenizer
import java.io.BufferedWriter
import java.io.OutputStreamWriter
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.*

private val INPUT = System.`in`
private val OUTPUT = System.out

private val bufferedReader = INPUT.bufferedReader()
private val outputWriter = BufferedWriter( OutputStreamWriter(OUTPUT));
private  fun readLn() = bufferedReader.readLine()!!

private fun readList() = readLn().split(' ')
private var tokenizer = StringTokenizer("")
private fun read(): String {
    while(tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLn(), " ")
    return tokenizer.nextToken()
}

private fun readInt() = read().toInt()
private fun readLong() = read().toLong()
private fun readDouble() = read().toDouble()

private fun readIntList() = readList().map { it.toInt() }
private fun readLongList() = readList().map { it.toLong() }
private fun readDoubleList() = readList().map { it.toDouble() }

private fun readIntArray(n: Int = 0) =
    if (n == 0) readList().run { IntArray(size) { get(it).toInt() } } else IntArray(n) { readInt() }

private fun readLongArray(n: Int = 0) =
    if (n == 0) readList().run { LongArray(size) { get(it).toLong() } } else LongArray(n) { readLong() }

private fun readDoubleArray(n: Int = 0) =
    if (n == 0) readList().run { DoubleArray(size) { get(it).toDouble() } } else DoubleArray(n) { readDouble() }

private fun Int.modPositive(other: Int): Int = if (this % other < 0) ((this % other) + other) else (this % other)

fun main() {
    var cases = readInt()
    repeat(cases) {
        var sum = 0
        for(i in 0 until 4) {
            sum += readInt()
        }
        if(sum == 0) {
            println(0)
        } else if(sum == 4) {
            println(2)
        } else {
            println(1)
        }
    }
    outputWriter.close()
}


import kotlin.math.sqrt

fun main() {
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    //val (s, n) = r.readLine()!!.split(" ").map { it.toInt() }
    val (a, b, c) = r.readLine()!!.split(" ").map { it.toLong() }.sorted()
    if (a==c) {
        val edge = sqrt(a.toDouble()).toInt()
        println(12*edge)
    } else{
        val x = gcd(b, c)
        val y = b/x
        val z = c/x
        println(4*(x+y+z))
    }
}

tailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)


import kotlin.math.sqrt

fun main() {
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    //val (s, n) = r.readLine()!!.split(" ").map { it.toInt() }
    val (a, b, c) = r.readLine()!!.split(" ").map { it.toDouble() }
    val x = sqrt(a*b/c).toInt()
    val y = sqrt(a*c/b).toInt()
    val z = sqrt(b*c/a).toInt()
    println(4*(x+y+z))
}


fun main(args: Array<String>) {
    println(readLine()!!.toInt()/2 + 1)
}


import java.io.*
import java.util.*

class ProblemIO(val rd: BufferedReader, val wr: PrintWriter) {
    companion object {
        fun console() = ProblemIO(BufferedReader(InputStreamReader(System.`in`)), PrintWriter(System.out))
        fun files(inputFilename: String, outputFilename: String) =
                ProblemIO(BufferedReader(FileReader(File(inputFilename))), PrintWriter(File(outputFilename)))
    }

    var tok = StringTokenizer("")

    fun close() { rd.close(); wr.close() }
    fun <T> print(v: T) = wr.print(v)
    fun <T> println(v: T) = wr.println(v)
    fun readToken(): String {
        while (!tok.hasMoreTokens()) tok = StringTokenizer(rd.readLine())
        return tok.nextToken()
    }
    fun readLine(): String {
        tok = StringTokenizer("")
        return rd.readLine()
    }
    fun readInt(): Int = readToken().toInt()
    fun readLong(): Long = readToken().toLong()
}

fun main(args: Array<String>) {
    Thread({ val io = ProblemIO.console(); solve(io); io.close() }).start()
}

fun solve(io: ProblemIO) {
    val n = io.readInt()
    val a = io.readInt()
    val b = io.readInt()
    var res = 0
    for (i in 0 .. n - 1) {
        if (i < a) continue
        if (n - 1 - a > b) continue
        ++res
    }
    io.println(res)
}


import java.io.*;
import java.util.*;

public class Main {
  public static IO in;
  public static PrintWriter out;

  static void init_io(String filename) throws Exception {
    if (filename.equals("")) {
      in = new IO(System.in);
      out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
    } else {
      in = new IO(new FileInputStream(filename + ".in"));
      out = new PrintWriter(new BufferedWriter(new FileWriter(filename + ".out")), true);
    }
  }

  final static long mod = 998244353;

/*
fun main(args: Array<String>) {
    Main.main(args);
}
*/

  static long get(long l, long r) {
    if (l == r) return 0;

    long x = 1;
    while (x * 2 <= r) x *= 2;
    if (l < x) return x * 2 - 1;
    return get(l - x, r - x);
  }

  static void solve(int tc) throws Exception {
    long l = in.nlong(), r = in.nlong();

    out.println(get(l, r));
  }

  public static void main(String[] _u_n_u_s_e_d_) throws Exception {
    init_io("");

    int t = 1;
    // t = in.nint();
    for (int tc = 0; tc < t; tc++) {
      solve(tc);
    }
  }

  static long minv(long v) {
    return mpow(v, mod - 2);
  }

  static long mpow(long base, long exp) {
    long res = 1;

    while (exp > 0) {
      if ((exp & 1) == 1) {
        res = (res * base) % mod;
      }
      base = (base * base) % mod;
      exp >>= 1;
    }

    return res;
  }

  static long gcd(long x, long y) {
    if (x == 0) return y;
    return gcd(y % x, x);
  }

  static void rsort(long[] arr) {
    Random r = new Random();
    for (int i = 0; i < arr.length; i++) {
      int j = i + r.nextInt(arr.length - i);
      long t = arr[i];
      arr[i] = arr[j];
      arr[j] = t;
    }
    Arrays.sort(arr);
  }

  static void rsort(int[] arr) {
    Random r = new Random();
    for (int i = 0; i < arr.length; i++) {
      int j = i + r.nextInt(arr.length - i);
      int t = arr[i];
      arr[i] = arr[j];
      arr[j] = t;
    }
    Arrays.sort(arr);
  }

  /* static void qsort(long[] arr) {
    Long[] oarr = new Long[arr.length];
    for (int i = 0; i < arr.length; i++) {
      oarr[i] = arr[i];
    }

    ArrayList<Long> alist = new ArrayList<Long>(Arrays.asList(oarr));
    Collections.sort(alist);

    for (int i = 0; i < arr.length; i++) {
      arr[i] = (long)alist.get(i);
    }
  } */

  static void reverse(long[] arr) {
    for (int i = 0; i < arr.length / 2; i++) {
      long temp = arr[i];
      arr[i] = arr[arr.length - 1 - i];
      arr[arr.length - 1 - i] = temp;
    }
  }

  static String atos(long[] arr) {
    String s = Arrays.toString(arr);
    s = s.substring(1, s.length() - 1);
    return s.replace(",", "");
  }

  static class IO {
    public BufferedReader in;
    public StringTokenizer tokens;

    public IO(InputStream x) throws Exception {
      in = new BufferedReader(new InputStreamReader(x));
      tokens = new StringTokenizer(in.readLine());
    }

    int nint() throws Exception {
      return Integer.parseInt(nstr());
    }

    long nlong() throws Exception {
      return Long.parseLong(nstr());
    }

    double ndouble() throws Exception {
      return Double.parseDouble(nstr());
    }

    String nstr() throws Exception {
      if (!tokens.hasMoreTokens()) tokens = new StringTokenizer(in.readLine());
      return tokens.nextToken();
    }

    long[] nla(int n) throws Exception {
      long[] arr = new long[n];
      for (int i = 0; i < n; i++) {
        arr[i] = nlong();
      }
      return arr;
    }
  }

  static class Pair<A extends Comparable<A>, B extends Comparable<B>> implements Comparable<Pair<A, B>> {
    public A f;
    public B s;

    public Pair(A a, B b) {
      f = a;
      s = b;
    }

    public int compareTo(Pair<A, B> other) {
      int v = f.compareTo(other.f);
      if (v != 0) return v;
      return s.compareTo(other.s);
    }

    public String toString() {
      return "(" + f.toString() + ", " + s.toString() + ")";
    }
  }
}


fun main() {
    val line = readLine()!!
    val six = line.indexOf(' ')
    val l = line.substring(0, six).toLong()
    val r = line.substring(six + 1).toLong()
    for (e in 60 downTo 0) {
        val b = 1L shl e
        if ((l and b) != (r and b)) {
            println((2L * b) - 1L)
            return
        }
    }
    println(0L)
}


@file:Suppress("EXPERIMENTAL_API_USAGE")

import Utils.ArrayUtils.Companion.arrayOfNullsSafe
import Utils.ArrayUtils.Companion.makeDistinct
import Utils.ArrayUtils.Companion.toNotNulls
import Utils.ArrayUtils.Prints.Companion.println
import Utils.ArrayUtils.Sorts.Companion.countSort
import Utils.ArrayUtils.Sorts.Companion.shuffleSort
import Utils.ArrayUtils.Swaps.Companion.swap
import Utils.BinarySearchUtils.Companion.binarySearch
import Utils.BinarySearchUtils.Companion.binarySearchDouble
import Utils.BinarySearchUtils.Companion.binarySearchLong
import Utils.BitUtils.Companion.flip
import Utils.BitUtils.Companion.get
import Utils.BitUtils.Companion.set
import Utils.BitUtils.Companion.submaskOf
import Utils.FastReader
import Utils.GeneralUtils.Companion.catch
import Utils.GeneralUtils.Companion.length
import Utils.GeneralUtils.Companion.rnd
import Utils.MathUtils.Companion.compareDoubles
import Utils.MathUtils.Companion.gcd
import Utils.MathUtils.Companion.log2
import Utils.Pairs.Companion.ComparablePair
import Utils.Pairs.Companion.IntPair
import Utils.Pairs.Companion.LongPair
import java.io.*
import java.util.*
import kotlin.collections.ArrayDeque
import kotlin.math.*
import kotlin.random.Random
import kotlin.time.ExperimentalTime

@ExperimentalStdlibApi
@ExperimentalTime
@ExperimentalUnsignedTypes
fun main() {
    Locale.setDefault(Locale.US)
    System.setOut(PrintStream(BufferedOutputStream(System.out)))
    Task(FastReader()).solve()
    System.out.flush()
}

const val eps = 1e-8

const val mod = 998244353

data class MInt(val x: Int) {
    operator fun plus(m: MInt) = MInt((x + m.x) % mod)
    operator fun minus(m: MInt) = MInt((x - m.x + mod) % mod)
    operator fun times(m: MInt) = MInt((x.toLong() * m.x % mod).toInt())
    operator fun div(m: MInt) = this * m.inv()

    fun inv() = inv(x)
    fun pow(p: Int): MInt {
        if (p == 0) return MInt(1)
        var r = pow(p / 2)
        r *= r
        if (p % 2 == 1) r *= this
        return r
    }

    override fun toString() = x.toString()

    companion object {
        private val facts = mutableListOf(MInt(1))
        private val invs = mutableListOf(MInt(0))
        private val invFacts = mutableListOf(MInt(1))
        fun Int.mod() = MInt(this)

        fun factorial(x: Int): MInt {
            while (x !in facts.indices) facts += facts.last() * facts.size.mod()
            return facts[x]
        }

        fun inv(x: Int): MInt {
            while (x !in invs.indices) invs += MInt((mod - mod / x) % mod) * inv(mod % x)
            return x.mod().pow(mod - 2)
        }

        fun invFact(x: Int): MInt {
            while (x !in invFacts.indices) invFacts += invFacts.last() * inv(invFacts.size)
            return invFacts[x]
        }
    }
}

fun c(n: Int, k: Int) = if (k in 0..n) MInt.factorial(n) * MInt.invFact(k) * MInt.invFact(n - k) else MInt(0)

@ExperimentalTime
@ExperimentalStdlibApi
class Task(private val fin: FastReader = FastReader()) {
    fun solve() {
        val n = fin.readInt()
        val maxHealth = fin.readInt()

        val cache = Array(n + 1) { IntArray(maxHealth + 1) { -1 } }
        fun go(alive: Int, damageGot: Int): MInt {
            if (alive == 0) return MInt(1)
            if (damageGot > maxHealth) return MInt(0)
            if (alive == 1) return MInt(0)
            cache[alive][damageGot].let { if (it != -1) return MInt(it) }
            var res = go(alive, damageGot + alive - 1)
            for (died in 1..alive) {
                val survived = alive - died
                val minWas = 1 + damageGot
                val maxWas = minOf(alive - 1 + damageGot, maxHealth)
                val numberOfWaysDied = c(alive, died)
                val healthForDied = MInt(maxWas - minWas + 1).pow(died)
                res += go(survived, damageGot + alive - 1) * numberOfWaysDied * healthForDied
            }
            cache[alive][damageGot] = res.x
            return res
        }

        val ans = go(n, 0)
        println(ans)
    }
}

@Suppress("MemberVisibilityCanBePrivate", "unused")
@ExperimentalStdlibApi
@ExperimentalUnsignedTypes
class Utils {
    class GeneralUtils {
        companion object {
            val rnd = Random(239)
            val IntRange.length get() = maxOf(last - first + 1, 0)

            @Suppress("UNREACHABLE_CODE", "ControlFlowWithEmptyBody")
            fun <R> catch(throwMLE: Boolean = false, f: () -> R): R {
                try {
                    return f()
                } catch (e: Exception) {
                    if (throwMLE) throw OutOfMemoryError()
                    while (true) {
                    }
                }
            }
        }
    }

    class MathUtils {
        companion object {
            tailrec fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
            tailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)
            fun lcm(a: Long, b: Long) = a / gcd(a, b) * b

            fun Int.log2(): Int {
                var log = 0
                while (1 shl log < this) log++
                return log
            }

            fun Long.log2(): Int {
                var log = 0
                while (1L shl log < this) log++
                return log
            }

            fun compareDoubles(x: Double, y: Double) =
                if (abs(x - y) < eps) 0 else if (x < y) -1 else +1

            fun isZero(x: Double) = abs(x) < eps
        }
    }

    class BitUtils {
        companion object {
            operator fun Int.get(bit: Int) = (this shr bit) and 1
            operator fun Long.get(bit: Int) = ((this shr bit) and 1).toInt()
            fun Int.set(bit: Int) = this or (1 shl bit)
            fun Long.set(bit: Int) = this or (1L shl bit)
            fun Int.flip(bit: Int) = this xor (1 shl bit)
            fun Long.flip(bit: Int) = this xor (1L shl bit)
            infix fun Int.submaskOf(x: Int) = (this and x) == this
            infix fun Long.submaskOf(x: Long) = (this and x) == this
        }
    }

    class ArrayUtils {
        companion object {
            fun <T : Comparable<T>> MutableList<T>.makeDistinct() {
                if (size <= 1) return
                sort()
                var sz = 1
                for (i in 1 until size) {
                    if (this[i] != this[i - 1]) {
                        this[sz++] = this[i]
                    }
                }
                while (size > sz) removeAt(lastIndex)
            }

            @Suppress("UNCHECKED_CAST")
            fun <T> Array<T?>.toNotNulls() = this as Array<T>

            @Suppress("UNCHECKED_CAST")
            inline fun <reified T> arrayOfNullsSafe(size: Int): Array<T> =
                arrayOfNulls<T>(size).toNotNulls()
        }

        class Swaps {
            companion object {
                fun <T> Array<T>.swap(i: Int, j: Int) {
                    val x = this[i]
                    this[i] = this[j]
                    this[j] = x
                }

                fun <T> MutableList<T>.swap(i: Int, j: Int) {
                    val x = this[i]
                    this[i] = this[j]
                    this[j] = x
                }

                fun IntArray.swap(i: Int, j: Int) {
                    val x = this[i]
                    this[i] = this[j]
                    this[j] = x
                }

                fun LongArray.swap(i: Int, j: Int) {
                    val x = this[i]
                    this[i] = this[j]
                    this[j] = x
                }

                fun DoubleArray.swap(i: Int, j: Int) {
                    val x = this[i]
                    this[i] = this[j]
                    this[j] = x
                    sort()
                }

                fun CharArray.swap(i: Int, j: Int) {
                    val x = this[i]
                    this[i] = this[j]
                    this[j] = x
                    sort()
                }
            }
        }

        class Sorts {
            companion object {
                fun IntArray.shuffleSort() {
                    for (i in 1 until size) swap(i, rnd.nextInt(i + 1))
                    sort()
                }

                fun LongArray.shuffleSort() {
                    for (i in 1 until size) swap(i, rnd.nextInt(i + 1))
                    sort()
                }

                fun DoubleArray.shuffleSort() {
                    for (i in 1 until size) swap(i, rnd.nextInt(i + 1))
                    sort()
                }

                fun CharArray.shuffleSort() {
                    for (i in 1 until size) swap(i, rnd.nextInt(i + 1))
                    sort()
                }

                @Suppress("DuplicatedCode")
                inline fun <reified T> Array<T>.countSort(
                    inPlace: Boolean = true,
                    type: (T) -> Int = { (it as Number).toInt() }
                ): Array<T> {
                    if (isEmpty()) return if (inPlace) this else emptyArray()
                    val types = IntArray(size) { type(this[it]) }
                    val min = types.minOrNull()!!
                    val max = types.maxOrNull()!!
                    val count = IntArray(max - min + 1)
                    for (t in types) count[t - min]++
                    var sum = 0
                    for (i in count.indices) {
                        val shift = count[i]
                        count[i] = sum
                        sum += shift
                    }
                    val sorted = arrayOfNullsSafe<T>(size)
                    for (i in 0 until size) sorted[count[types[i] - min]++] = this[i]
                    return if (inPlace) {
                        this.also { sorted.copyInto(this) }
                    } else {
                        sorted
                    }
                }

                @Suppress("DuplicatedCode")
                inline fun <reified T> List<T>.countSort(
                    inPlace: Boolean = true,
                    type: (T) -> Int = { (it as Number).toInt() }
                ): List<T> {
                    if (isEmpty()) return if (inPlace) this else emptyList()
                    val types = IntArray(size) { type(this[it]) }
                    val min = types.minOrNull()!!
                    val max = types.maxOrNull()!!
                    val count = IntArray(max - min + 1)
                    for (t in types) count[t - min]++
                    var sum = 0
                    for (i in count.indices) {
                        val shift = count[i]
                        count[i] = sum
                        sum += shift
                    }
                    val sorted = arrayOfNullsSafe<T>(size)
                    for (i in 0 until size) sorted[count[types[i] - min]++] = this[i]
                    return if (inPlace) {
                        return (this as MutableList<T>).apply {
                            for (i in indices) this[i] = sorted[i]
                        }
                    } else {
                        sorted.asList()
                    }
                }

                @Suppress("DuplicatedCode")
                inline fun IntArray.countSort(
                    inPlace: Boolean = true,
                    type: (Int) -> Int = { it -> it }
                ): IntArray {
                    if (isEmpty()) return if (inPlace) this else intArrayOf()
                    val types = IntArray(size) { type(this[it]) }
                    val min = types.minOrNull()!!
                    val max = types.maxOrNull()!!
                    val count = IntArray(max - min + 1)
                    for (t in types) count[t - min]++
                    var sum = 0
                    for (i in count.indices) {
                        val shift = count[i]
                        count[i] = sum
                        sum += shift
                    }
                    val sorted = IntArray(size)
                    for (i in 0 until size) sorted[count[types[i] - min]++] = this[i]
                    return if (inPlace) {
                        this.also { sorted.copyInto(this) }
                    } else {
                        sorted
                    }
                }
            }
        }

        class Prints {
            companion object {
                fun println(a: IntArray) {
                    if (a.isNotEmpty()) {
                        print(a[0])
                        for (i in 1 until a.size) {
                            print(' ')
                            print(a[i])
                        }
                    }
                    println()
                }

                fun println(a: LongArray) {
                    if (a.isNotEmpty()) {
                        print(a[0])
                        for (i in 1 until a.size) {
                            print(' ')
                            print(a[i])
                        }
                    }
                    println()
                }

                fun println(a: CharArray, printSpace: Boolean = false) {
                    if (a.isNotEmpty()) {
                        print(a[0])
                        for (i in 1 until a.size) {
                            if (printSpace) print(' ')
                            print(a[i])
                        }
                    }
                    println()
                }

                fun println(a: Array<*>) {
                    if (a.isNotEmpty()) {
                        print(a[0])
                        for (i in 1 until a.size) {
                            print(' ')
                            print(a[i])
                        }
                    }
                    println()
                }

                fun println(a: List<*>) {
                    if (a.isNotEmpty()) {
                        print(a[0])
                        for (i in 1 until a.size) {
                            print(' ')
                            print(a[i])
                        }
                    }
                    println()
                }

                fun println(a: Iterable<*>) {
                    val it = a.iterator()
                    if (it.hasNext()) {
                        print(it.next())
                        while (it.hasNext()) {
                            print(' ')
                            print(it.next())
                        }
                    }
                    println()
                }
            }
        }
    }

    class BinarySearchUtils {
        companion object {
            @Suppress("DuplicatedCode")
            inline fun binarySearch(from: Int, to: Int, f: (Int) -> Boolean): Int {
                var l = from
                var r = to + 1
                while (r - l > 1) {
                    val m = (l + r) / 2
                    if (f(m)) l = m
                    else r = m
                }
                return l
            }

            inline fun binarySearch(from: Int = 0, f: (Int) -> Boolean): Int {
                var len = 1
                while (f(from + len)) len *= 2
                return binarySearch(from + len / 2, from + len - 1, f)
            }

            @Suppress("DuplicatedCode")
            inline fun binarySearchLong(from: Long, to: Long, f: (Long) -> Boolean): Long {
                var l = from
                var r = to + 1
                while (r - l > 1) {
                    val m = (l + r) / 2
                    if (f(m)) l = m
                    else r = m
                }
                return l
            }

            inline fun binarySearchLong(from: Long = 0, f: (Long) -> Boolean): Long {
                var len = 1L
                while (f(from + len)) len *= 2
                return binarySearchLong(from + len / 2, from + len - 1, f)
            }

            @Suppress("DuplicatedCode")
            inline fun binarySearchDouble(
                from: Double,
                to: Double,
                times: Int = 200,
                f: (Double) -> Boolean
            ): Double {
                var l = from
                var r = to
                repeat(times) {
                    val m = (l + r) / 2
                    if (f(m)) l = m
                    else r = m
                }
                return l
            }

            inline fun binarySearchDouble(
                from: Double = 0.0,
                times: Int = 200,
                f: (Double) -> Boolean
            ): Double {
                var len = 1.0
                while (f(from + len)) len *= 2
                return binarySearchDouble(from, from + len, times, f)
            }
        }
    }

    class Pairs {
        companion object {
            data class ComparablePair<T1 : Comparable<T1>, T2 : Comparable<T2>>(
                val first: T1,
                val second: T2
            ) :
                Comparable<ComparablePair<T1, T2>> {
                override fun compareTo(other: ComparablePair<T1, T2>): Int {
                    var c = first.compareTo(other.first)
                    if (c == 0) c = second.compareTo(other.second)
                    return c
                }
            }

            data class IntPair(val first: Int, val second: Int) : Comparable<IntPair> {
                override fun compareTo(other: IntPair): Int {
                    var c = first.compareTo(other.first)
                    if (c == 0) c = second.compareTo(other.second)
                    return c
                }

                fun swap() = IntPair(second, first)
            }

            data class LongPair(val first: Long, val second: Long) : Comparable<LongPair> {
                override fun compareTo(other: LongPair): Int {
                    var c = first.compareTo(other.first)
                    if (c == 0) c = second.compareTo(other.second)
                    return c
                }
            }
        }
    }

    class UtilsImports {
        fun importDependencies() {
            check(gcd(4, 6) == 2)
            check(rnd.nextInt(10) in 0 until 10)
            check(mutableListOf(1, 3, 2, 2, 1).apply { makeDistinct() } == listOf(1, 2, 3))
            check((5..10).length == 6)
            check(intArrayOf(3, 4).apply { swap(0, 1) }.contentEquals(intArrayOf(4, 3)))
            check(
                intArrayOf(5, 6, 2, 1, 5).apply { shuffleSort() }
                    .contentEquals(intArrayOf(1, 2, 5, 5, 6))
            )
            check(binarySearch { it < 10 } == 9)
            check(binarySearchLong { it < 1e13.toLong() } == 1e13.toLong() - 1)
            binarySearchDouble { true }
            println(intArrayOf())
            ArrayDeque<Int>()
            abs(1)
            sin(1.0)
            cos(1.0)
            hypot(1.0, 1.0)
            catch {}
            ComparablePair(1, 2)
            IntPair(1, 2)
            arrayOfNulls<Int>(0).toNotNulls()
            arrayOfNullsSafe<Int>(0)
            5.log2()
            @Suppress("ReplaceGetOrSet")
            5.get(3)
            5.sign
            5 submaskOf 3
            5.set(3)
            5.flip(3)
            compareDoubles(0.0, 1.0)
            arrayOf(1, 2).countSort { it.countOneBits() }
            LongPair(1, 2)
        }
    }

    class FastReader(fileName: String? = null) {
        @JvmField
        val br =
            BufferedReader(if (fileName != null) FileReader(fileName) else InputStreamReader(System.`in`))

        @JvmField
        var st = StringTokenizer("")

        fun readString(): String {
            while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
            return st.nextToken()
        }

        fun readInt() = readString().toInt()
        fun readLong() = readString().toLong()
        fun readDouble() = readString().toDouble()

        fun readIntArray(n: Int) = IntArray(n) { readInt() }
        fun readLongArray(n: Int) = LongArray(n) { readLong() }
        fun readStringArray(n: Int) = Array(n) { readString() }
        fun readDoubleArray(n: Int) = DoubleArray(n) { readDouble() }

        fun readInts(n: Int) = MutableList(n) { readInt() }
        fun readLongs(n: Int) = MutableList(n) { readLong() }
        fun readStrings(n: Int) = MutableList(n) { readString() }
        fun readDoubles(n: Int) = MutableList(n) { readDouble() }
    }
}


fun main(args: Array<String>) {
    val a = readLine()!!.split(" ").map{ it.toInt() }.toMutableList()
    if (a[0] * 3 <= a[1]) {
        print(0)
    } else {
        print(a[0] * 3 - a[1])
    }
}


    import java.util.*

    data class Row(var left: Int = -1, var right: Int = -1, var length: Int = 0)

    fun main(args: Array<String>){
        val scanner = Scanner(System.`in`)
        val n = scanner.nextInt()
        if (n==1){
            println(0)
            return
        }
        var even = n/2 + n%2
        var odd = n/2
        val rows = arrayListOf<Row>()
        var left = -1
        var right = -1
        var answer = 0
        var length = 0
        for (i in 0 until n){
            var a = scanner.nextInt()
            if (a==0){
                length++
                continue
            }

            if (length==0){
                a%=2
                if (a!=left && left!=-1){
                    answer++
                }
                left=a
                if (a==0){
                    odd--
                }
                else{
                    even--
                }
            }
            else{
                right = a%2
                rows.add(Row(left, right, length))
                left = right
                right=-1
                length=0
                if (a%2==0){
                    odd--
                }
                else{
                    even--
                }
            }
        }
        if (length!=0){
            rows.add(Row(left, right, length))
        }
        rows.sortBy { it.length }
        for (row in rows){
            if (row.left ==-1 && row.right==-1){
                answer+=1
                continue
            }
            if (row.left ==-1 || row.right==-1){
                if (row.left+row.right+1==0){
                    if (row.length<=odd){
                        odd-=row.length
                    }
                    else{
                        answer+=1
                    }
                }
                else{
                    if (row.length<=even){
                        even-=row.length
                    }
                    else{
                        answer+=1
                    }
                }
                continue
            }

            if (row.left!=row.right){
                answer++
            }
            else{
                if (row.left==0){
                    if (row.length<=odd){
                        odd-=row.length
                    }
                    else{
                        answer+=2
                    }
                }
                else{
                    if (row.length<=even){
                        even-=row.length
                    }
                    else{
                        answer+=2
                    }
                }
            }
        }
        println(answer)
    }


package contest612

var n: Int = 0
var lights = emptyList<Int>()

var save = Array(102) { Array(102) { Array(102) { IntArray(2) { -1 } } } }
fun dp(index: Int, odd: Int, even: Int, isOdd: Boolean): Int {
    if (index >= lights.size) {
        return 0
    }
    val oddIndex: Int = if (isOdd) 0 else 1
    if (save[index][odd][even][oddIndex] != -1) return save[index][odd][even][oddIndex]
    var min = Int.MAX_VALUE
    if (lights[index] == 0) {
        if (odd > 0) {
            min = Math.min(min, getCom(isOdd, true) + dp(index + 1, odd - 1, even, true))
        }
        if (even > 0) {
            min = Math.min(min, getCom(isOdd, false) + dp(index + 1, odd, even - 1, false))
        }
    } else {
        val curIsOdd = lights[index] % 2 != 1
        min = getCom(isOdd, curIsOdd) + dp(index + 1, odd, even, curIsOdd)
    }
    save[index][odd][even][oddIndex] = min
    return min
}

fun getCom(odd: Boolean, odd2: Boolean): Int {
    return if (odd == odd2) {
        0
    } else {
        1
    }
}

fun main(args: Array<String>) {
    n = readLine()!!.toInt()
    lights = readLine()!!.split(' ').map { it.toInt() }
    var odd = (n + 1) / 2
    var even = n / 2
    lights.forEach {
        if (it != 0) {
            if(it%2==0)even--
            else odd --
        }
    }
    val ans = Math.min(
            dp(0,odd, even, true),
            dp(0,odd, even, false)
    )
    println(ans)
}


    import java.util.*

    data class Row(var left: Int = -1, var right: Int = -1, var length: Int = 0)

    fun main(args: Array<String>){
        val scanner = Scanner(System.`in`)
        val n = scanner.nextInt()
        if (n==1){
            println(0)
            return
        }
        var even = n/2 + n%2
        var odd = n/2
        val rows = arrayListOf<Row>()
        val rowsW = arrayListOf<Row>()
        var left = -1
        var right = -1
        var answer = 0
        var length = 0
        for (i in 0 until n){
            var a = scanner.nextInt()
            if (a==0){
                length++
                continue
            }

            if (length==0){
                a%=2
                if (a!=left && left!=-1){
                    answer++
                }
                left=a
                if (a==0){
                    odd--
                }
                else{
                    even--
                }
            }
            else{
                right = a%2
                rows.add(Row(left, right, length))
                left = right
                right=-1
                length=0
                if (a%2==0){
                    odd--
                }
                else{
                    even--
                }
            }
        }
        if (length!=0){
            rows.add(Row(left, right, length))
        }
        rows.sortBy { it.length }
        for (row in rows){
            if (row.left ==-1 && row.right==-1){
                answer+=1
                continue
            }
            if (row.left ==-1 || row.right==-1){
                rowsW.add(row)
                continue
            }

            if (row.left!=row.right){
                answer++
            }
            else{
                if (row.left==0){
                    if (row.length<=odd){
                        odd-=row.length
                    }
                    else{
                        answer+=2
                    }
                }
                else{
                    if (row.length<=even){
                        even-=row.length
                    }
                    else{
                        answer+=2
                    }
                }
            }
        }
        for (row in rowsW){
            if (row.left+row.right+1==0){
                if (row.length<=odd){
                    odd-=row.length
                }
                else{
                    answer+=1
                }
            }
            else{
                if (row.length<=even){
                    even-=row.length
                }
                else{
                    answer+=1
                }
            }
        }
        println(answer)
    }


import java.util.*

/**
 * Точки на прямой
 */
fun taskA() {
    val s = Scanner(System.`in`)
    val n = s.nextInt()
    val desiredDiameter = s.nextInt()
    val numbers = Array(n, { _ -> 0 })

    for (i in 0..n-1) {
        numbers[i] = s.nextInt()
    }

    numbers.sort()

    var from = 0
    var to = 0
    var optimalRemoved = Int.MAX_VALUE
    while (to <= numbers.lastIndex) {
        val d = numbers[to] - numbers[from]

        if (d <= desiredDiameter) {
            optimalRemoved = minOf(from + (numbers.size - to - 1), optimalRemoved)
        }

        if (d <= desiredDiameter) {
            to++
        } else {
            from++
        }
    }

    println(optimalRemoved)
}

/**
 * Наша Таня громко плачет
 */
fun taskB() {
    val s = Scanner(System.`in`)
    val n = s.nextInt()
    val k = s.nextInt()
    val subPrice = s.nextInt()
    val divPrice = s.nextInt()

    var curN = n
    var totalPrice = 0
    while (curN != 1) {
        val r = curN % k
        when (r) {
            0 -> {
                val subTotal = subPrice * (curN/k) * (k-1)
                if (subTotal < divPrice) {
                    totalPrice += subTotal
                } else {
                    totalPrice += divPrice
                }
                curN /= k
            }
            else -> {
                totalPrice += subPrice * r
                curN -= r

                // ugly check if curN under k so we could get zero
                if (curN == 0) {
                    curN = 1
                    totalPrice -= subPrice
                }
            }
        }
    }
    println(totalPrice)
}

fun main(args: Array<String>) {
    taskB()
}


fun main(args:Array<String>) {
  val (n,k,A,B) = (1..4).map{ readLine()!!.toLong() }

  // 1で全部消化するときのコスト
  val step1 = (n-1)*A

  // deviableの時、積極的に割っていくアプローチ

  // kの倍数リストを作成して、ジャンプ計算をできるようにしておく

  var minus1 = 0L
  var devides1 = 0L
  var start = n
  while(true) {
    start = start/k
    //println("a $start")
    devides1 ++
    minus1 += start%k
    if( start < k ) {
      //minus1 += start - 1
      break
    }
  }
  //println( "${minus1} ${devides1}" )
  val step2 = (minus1)*A + (devides1)*B
  println( listOf(step1, step2).min())
}


import java.util.Scanner

fun main() {
  val scan = Scanner(System.`in`)
  val cats = scan.nextInt()
  val leftCats = scan.nextInt()

  if(cats == leftCats){
    println(0)
  } else if (leftCats == 0){
    println(0)
  } else {
    val catDiff = cats - leftCats
    if (catDiff > leftCats) {
      println(leftCats)
    } else {
      println(catDiff)
    }
  }
}