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

class Main internal constructor(inputStream: InputStream, val out: PrintWriter) {
    companion object {
        val ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null
    }

    private val br = BufferedReader(InputStreamReader(inputStream))
    private var st = StringTokenizer("")

    internal fun hasNext(): Boolean {
        while (!st.hasMoreTokens()) {
            val readLine = br.readLine() ?: return false
            st = StringTokenizer(readLine)
        }
        return true
    }

    private operator fun next() =
            if (hasNext()) st.nextToken()!!
            else throw RuntimeException("No tokens")

    internal fun nline() =
            if (hasNext()) st.nextToken("\n")
            else throw RuntimeException("No tokens")

    private fun ni() = next().toInt()
    private fun nii() = Pair(ni(), ni())
    private fun niii() = Triple(ni(), ni(), ni())
    private fun nia(n: Int) = IntArray(n) { ni() }
    private fun nia(m: Int, n: Int) = Array(m) { nia(n) }

    private fun nl() = next().toLong()
    private fun nll() = Pair(nl(), nl())
    private fun nlll() = Triple(nl(), nl(), nl())
    private fun nla(n: Int) = LongArray(n, { nl() })
    private fun nla(m: Int, n: Int) = Array(m) { nla(n) }

    private fun nd() = next().toDouble()
    private fun ndd() = Pair(nd(), nd())
    private fun nddd() = Triple(nd(), nd(), nd())
    private fun nda(n: Int) = DoubleArray(n) { nd() }
    private fun nda(m: Int, n: Int) = Array(m) { nda(n) }

    inline fun log(name: String, block: () -> Unit) {
        if (!ONLINE_JUDGE) {
            p("#$name: ")
            block()
            flush()
        }
    }

    inline fun log() = log("") { pln() }
    inline fun log(message: Any?, name: String = "") = log(name) { pln(message) }
    inline fun log(arr: IntArray?, name: String = "") = log(name) { pln(arr) }
    inline fun log(arr: LongArray?, name: String = "") = log(name) { pln(arr) }
    inline fun log(arr: DoubleArray?, name: String = "") = log(name) { pln(arr) }
    inline fun <T> log(arr: Array<T>?, name: String = "") = log(name) { pln(arr) }
    inline fun <T> log(stack: Stack<T>?, name: String = "") = log(name) { pln(stack) }
    inline fun <T> log(list: List<T>?, name: String = "") = log(name) { pln(list) }

    //prefix print
    inline fun prep(prefix: Boolean, separator: String, message: Any?) {
        if (prefix) {
            p(separator)
        }
        p(message)
    }

    inline fun p(message: Any?) = this.also { out.print(message) }

    inline fun p(arr: IntArray?, separator: String = " ") = this.also {
        arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })
    }

    inline fun p(arr: LongArray?, separator: String = " ") = this.also {
        arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })
    }

    inline fun p(arr: DoubleArray?, separator: String = " ") = this.also {
        arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })
    }

    inline fun <T> p(arr: Array<T>?, separator: String = " ") = this.also {
        arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })
    }

    inline fun <T> p(list: List<T>?, separator: String = " ") = this.also {
        list?.fold(false, { prefix, t -> prep(prefix, separator, t); true })
    }

    inline fun <T> p(stack: Stack<T>?, separator: String = " ") = this.also {
        stack?.fold(false, { prefix, t -> prep(prefix, separator, t); true })
    }

    inline fun pln() = this.also { out.println() }
    inline fun pln(message: Any?) = p(message).pln()
    inline fun pln(arr: IntArray?, separator: String = " ") = p(arr, separator).pln()
    inline fun pln(arr: LongArray?, separator: String = " ") = p(arr, separator).pln()
    inline fun pln(arr: DoubleArray?, separator: String = " ") = p(arr, separator).pln()
    inline fun <T> pln(list: List<T>?, separator: String = " ") = p(list, separator).pln()
    inline fun <T> pln(arr: Array<T>?, separator: String = " ") = p(arr, separator).pln()
    inline fun <T> pln(stack: Stack<T>?, separator: String = " ") = p(stack, separator).pln()

    inline fun flush() = out.flush()

    //////////////////////////////////////

    fun run() {
        val n = ni()
        var answer = 1
        var itr = 1
        var k = 0
        var d = 0
        var set = TreeSet<Int>();
        var flag = true
        var flag1 = true
        for (i in 1..n) {
            k = 0
            d = i
            flag = true
            flag1 = true
            while (d > 0) {
                if (d % 2 == 0 && flag1) k++
                else {
                    flag1 = false
                    if (d % 2 == 0) flag = false
                    else k--
                }
                d /= 2
            }
            if (k == -1 &&flag) set.add(i)
        }
        for (i in set) if (n % i == 0) answer = i
        out.print(answer)
    }

}

//////////////////////////////////////
fun main(args: Array<String>) {
    val inp = File("input.txt")
    if (Main.ONLINE_JUDGE || !inp.isFile) {
        val a = Main(System.`in`, PrintWriter(BufferedOutputStream(System.out)))
        a.run()
        a.flush()
        a.out.close()
    } else {
        val t = Main(FileInputStream("input.txt"), PrintWriter(BufferedOutputStream(System.out)))
        while (t.hasNext()) {
            val name = t.nline()
            t.log("##### Test $name #####")
            val startTime = System.currentTimeMillis()
            t.run()
            val endTime = System.currentTimeMillis()
            t.log(endTime - startTime, "Total Time")
            t.log()
            t.flush()
        }
    }

}


fun main() {
    val (n, m) = readInts()

    // Kx[y] = # of arrays of x 1s and y -1s such that max prefix sum = 0
    var K = ModIntArray(m+1) { ModInt(1) }
    // Dx[y] = answer for n=x and m=y
    var D = ModIntArray(m+1) { ModInt(0) }

    for(x in 1..n) {
        val Kx = ModIntArray(m+1)
        for(y in x..m) {
            Kx[y] = K[y] + Kx[y-1]
        }

        val Dx = ModIntArray(m+1)
        Dx[0] = ModInt(x)
        for(y in 1..m) {
            val nn = x + y - 1
            Dx[y] = C(nn, y) + D[y] + Dx[y-1] - C(nn, x) + Kx[y-1]
        }

        K = Kx
        D = Dx
    }

    val ans = D[m]

    println(ans)
}

infix fun Int.umod(base: Int) =
    (this % base).let { if(it >= 0) it else it + base }

infix fun Long.umod(base: Long) =
    (this % base).let { if(it >= 0) it else it + base }

infix fun Long.umod(base: Int) =
    (this % base).let { if(it >= 0) it else it + base }

fun Int.mulMod(other: Int, mod: Int) = (toLong() * other).umod(mod).toInt()

fun Int.powMod(exponent: Int, mod: Int): Int {
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

/** modint inline class, requires hardcoded mod base **/
const val MODBASE = 998244853

inline fun Int.toModInt() = ModInt(this umod MODBASE)
inline fun Long.toModInt() = ModInt((this umod MODBASE).toInt())

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    inline operator fun plus(other: ModInt) = plus(other.int) // MODBASE < 2^30
    inline operator fun plus(other: Int) =  (int + other).toModInt() // careful of possible overflow
    inline operator fun inc() = plus(1)

    inline operator fun minus(other: ModInt) = minus(other.int)
    inline operator fun minus(other: Int) = (int - other).toModInt()
    inline operator fun dec() = minus(1)
    operator fun unaryMinus() = if(int == 0) this else ModInt(MODBASE - int)

    inline operator fun times(other: ModInt) = times(other.int)
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODBASE))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) exponent umod MODBASE - 1 else exponent // assumes MODBASE is prime
        return ModInt(int.powMod(e, MODBASE))
    }

    inline fun inv() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized() = pow(MODBASE - 2) // assumes MODBASE is prime
    fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inv())
    inline operator fun div(other: Int) = div(other.toModInt())

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

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override val size: Int get() = intArray.size

    override fun contains(element: ModInt): Boolean = any { it == element }

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override fun isEmpty(): Boolean = size == 0

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }
}
fun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))
inline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) =
    ModIntArray(IntArray(capacity) { init(it).int })

val _factorialMemo = mutableListOf(ModInt(1))

fun Int.factorial() = run {
    while(this > _factorialMemo.lastIndex) {
        _factorialMemo.add(_factorialMemo.last() * _factorialMemo.size)
    }

    _factorialMemo[this]
}

fun C(n: Int, k: Int) = n.factorial() / k.factorial() / (n-k).factorial()

fun Iterable<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Sequence<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Iterable<ModInt>.product() = fold(ModInt(1), ModInt::times)
fun Sequence<ModInt>.product() = fold(ModInt(1), ModInt::times)

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

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


fun main() {
    val (n, m) = readInts()

    var ans = C(n+m, n) * (n-m-1).coerceAtLeast(0)

    for(k in 0..minOf(n-1, m)) {
        ans += C(n+m, k)
    }

    println(ans)
}

val _factorialMemo = mutableListOf(ModInt(1))

fun Int.factorial() = run {
    while(this > _factorialMemo.lastIndex) {
        _factorialMemo.add(_factorialMemo.last() * _factorialMemo.size)
    }

    _factorialMemo[this]
}

fun C(n: Int, k: Int) = n.factorial() / k.factorial() / (n-k).factorial()

infix fun Int.umod(base: Int) =
    (this % base).let { if(it >= 0) it else it + base }

infix fun Long.umod(base: Long) =
    (this % base).let { if(it >= 0) it else it + base }

infix fun Long.umod(base: Int) =
    (this % base).let { if(it >= 0) it else it + base }

fun Int.mulMod(other: Int, mod: Int) = (toLong() * other).umod(mod).toInt()

fun Int.powMod(exponent: Int, mod: Int): Int {
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

/** modint inline class, requires hardcoded mod base **/
const val MODBASE = 998244853

inline fun Int.toModInt() = ModInt(this umod MODBASE)
inline fun Long.toModInt() = ModInt((this umod MODBASE).toInt())

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    inline operator fun plus(other: ModInt) = plus(other.int) // MODBASE < 2^30
    inline operator fun plus(other: Int) =  (int + other).toModInt() // careful of possible overflow
    inline operator fun inc() = plus(1)

    inline operator fun minus(other: ModInt) = minus(other.int)
    inline operator fun minus(other: Int) = (int - other).toModInt()
    inline operator fun dec() = minus(1)
    operator fun unaryMinus() = if(int == 0) this else ModInt(MODBASE - int)

    inline operator fun times(other: ModInt) = times(other.int)
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODBASE))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) exponent umod MODBASE - 1 else exponent // assumes MODBASE is prime
        return ModInt(int.powMod(e, MODBASE))
    }

    inline fun inv() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized() = pow(MODBASE - 2) // assumes MODBASE is prime
    fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inv())
    inline operator fun div(other: Int) = div(other.toModInt())

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

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override val size: Int get() = intArray.size

    override fun contains(element: ModInt): Boolean = any { it == element }

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override fun isEmpty(): Boolean = size == 0

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }
}
fun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))
inline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) =
    ModIntArray(IntArray(capacity) { init(it).int })

fun Iterable<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Sequence<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Iterable<ModInt>.product() = fold(ModInt(1), ModInt::times)
fun Sequence<ModInt>.product() = fold(ModInt(1), ModInt::times)

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

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


fun main() {
    val (n, m) = readInts()

    // Kx[y] = # of arrays of x 1s and y -1s such that max prefix sum = 0
    var K = ModIntArray(m) { ModInt(1) }
    // Dx[y] = answer for n=x and m=y
    var D = ModIntArray(m+1)

    for(x in 1..n) {
        val Kx = ModIntArray(m)
        for(y in x until m) {
            Kx[y] = K[y] + Kx[y-1]
        }

        val Dx = ModIntArray(m+1)
        Dx[0] = ModInt(x)
        for(y in 1..m) {
            val nn = x + y - 1
            Dx[y] = C(nn, y) + D[y] + Dx[y-1] - C(nn, x) + Kx[y-1]
        }

        K = Kx
        D = Dx
    }

    val ans = D[m]

    println(ans)
}

val _factorialMemo = mutableListOf(ModInt(1))

fun Int.factorial() = run {
    while(this > _factorialMemo.lastIndex) {
        _factorialMemo.add(_factorialMemo.last() * _factorialMemo.size)
    }

    _factorialMemo[this]
}

fun C(n: Int, k: Int) = n.factorial() / k.factorial() / (n-k).factorial()

infix fun Int.umod(base: Int) =
    (this % base).let { if(it >= 0) it else it + base }

infix fun Long.umod(base: Long) =
    (this % base).let { if(it >= 0) it else it + base }

infix fun Long.umod(base: Int) =
    (this % base).let { if(it >= 0) it else it + base }

fun Int.mulMod(other: Int, mod: Int) = (toLong() * other).umod(mod).toInt()

fun Int.powMod(exponent: Int, mod: Int): Int {
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

/** modint inline class, requires hardcoded mod base **/
const val MODBASE = 998244853

inline fun Int.toModInt() = ModInt(this umod MODBASE)
inline fun Long.toModInt() = ModInt((this umod MODBASE).toInt())

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    inline operator fun plus(other: ModInt) = plus(other.int) // MODBASE < 2^30
    inline operator fun plus(other: Int) =  (int + other).toModInt() // careful of possible overflow
    inline operator fun inc() = plus(1)

    inline operator fun minus(other: ModInt) = minus(other.int)
    inline operator fun minus(other: Int) = (int - other).toModInt()
    inline operator fun dec() = minus(1)
    operator fun unaryMinus() = if(int == 0) this else ModInt(MODBASE - int)

    inline operator fun times(other: ModInt) = times(other.int)
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODBASE))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) exponent umod MODBASE - 1 else exponent // assumes MODBASE is prime
        return ModInt(int.powMod(e, MODBASE))
    }

    inline fun inv() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized() = pow(MODBASE - 2) // assumes MODBASE is prime
    fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inv())
    inline operator fun div(other: Int) = div(other.toModInt())

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

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override val size: Int get() = intArray.size

    override fun contains(element: ModInt): Boolean = any { it == element }

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override fun isEmpty(): Boolean = size == 0

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }
}
fun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))
inline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) =
    ModIntArray(IntArray(capacity) { init(it).int })

fun Iterable<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Sequence<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Iterable<ModInt>.product() = fold(ModInt(1), ModInt::times)
fun Sequence<ModInt>.product() = fold(ModInt(1), ModInt::times)

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

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


fun main() {
    val (n, m) = readInts()

    var ans = ModInt(0)

    for(x in 1..n) {
        if(x >= n-m) ans += C(n+m, n-x)
        else ans += C(n+m, n)
    }

    println(ans)
}

val _factorialMemo = mutableListOf(ModInt(1))

fun Int.factorial() = run {
    while(this > _factorialMemo.lastIndex) {
        _factorialMemo.add(_factorialMemo.last() * _factorialMemo.size)
    }

    _factorialMemo[this]
}

fun C(n: Int, k: Int) = n.factorial() / k.factorial() / (n-k).factorial()

infix fun Int.umod(base: Int) =
    (this % base).let { if(it >= 0) it else it + base }

infix fun Long.umod(base: Long) =
    (this % base).let { if(it >= 0) it else it + base }

infix fun Long.umod(base: Int) =
    (this % base).let { if(it >= 0) it else it + base }

fun Int.mulMod(other: Int, mod: Int) = (toLong() * other).umod(mod).toInt()

fun Int.powMod(exponent: Int, mod: Int): Int {
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

/** modint inline class, requires hardcoded mod base **/
const val MODBASE = 998244853

inline fun Int.toModInt() = ModInt(this umod MODBASE)
inline fun Long.toModInt() = ModInt((this umod MODBASE).toInt())

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    inline operator fun plus(other: ModInt) = plus(other.int) // MODBASE < 2^30
    inline operator fun plus(other: Int) =  (int + other).toModInt() // careful of possible overflow
    inline operator fun inc() = plus(1)

    inline operator fun minus(other: ModInt) = minus(other.int)
    inline operator fun minus(other: Int) = (int - other).toModInt()
    inline operator fun dec() = minus(1)
    operator fun unaryMinus() = if(int == 0) this else ModInt(MODBASE - int)

    inline operator fun times(other: ModInt) = times(other.int)
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODBASE))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) exponent umod MODBASE - 1 else exponent // assumes MODBASE is prime
        return ModInt(int.powMod(e, MODBASE))
    }

    inline fun inv() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized() = pow(MODBASE - 2) // assumes MODBASE is prime
    fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inv())
    inline operator fun div(other: Int) = div(other.toModInt())

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

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override val size: Int get() = intArray.size

    override fun contains(element: ModInt): Boolean = any { it == element }

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override fun isEmpty(): Boolean = size == 0

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }
}
fun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))
inline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) =
    ModIntArray(IntArray(capacity) { init(it).int })

fun Iterable<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Sequence<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Iterable<ModInt>.product() = fold(ModInt(1), ModInt::times)
fun Sequence<ModInt>.product() = fold(ModInt(1), ModInt::times)

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

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


fun main(args: Array<String>) {
    var N = readLine()!!.toInt()
    var W = readLine()!!
    var C = 0
    var c = 0
    for (i in 0 until N) {
        when(W[i]){
            in 'A'..'Z'-> {
                C++
                if (c < C) {
                    c = C
                }
            }
            ' '->{
                C = 0
                if (c < C) {
                    c = C
                }
            }
        }
    }
    print(c)
}


fun main() {
    readLine()
    println(readLine()!!.split(" ").map { it.count { c -> c.isUpperCase() } }.max()!!)
}


fun main(args : Array<String>){

    var n = readLine()
    var text = readLine() + " "
    var max = 0
    var count = 0

    for (c in text) {
        if (c.isUpperCase()) {
            ++count
        } else if (c.toString() == " ") {
            max = if (count > max) count else max
            count = 0
        }
    }

    println(max)
}


var n:Int=0
var arr=Array(15){tuple(0,0,0)}
fun main(args: Array<String>){
    n= readLine()!!.toInt()
    for (i:Int in 0 until n){
        val inp=readLine()!!.split(' ')
        arr[i]=tuple(inp[0].toInt() , inp[1].toInt() , inp[2].toInt())
    }
    var ans=0
    var num_of_ans=0
    for(i:Int in 123..9876){
        if(!distinct(i)){
            continue
        }
        if(check(i)){
            ans=i
            num_of_ans++
        }
    }
    if(num_of_ans == 0){
        println("Incorrect data")
    }else if(num_of_ans > 1){
        println("Need more data")
    }else{
        if(ans/1000 == 0){
            print(0)
            print(ans)
        }else {
            print(ans)
        }
    }
}
fun distinct(x:Int):Boolean{
    var firstX:Int=x%10
    var secondX:Int=(x%100)/10
    var thirdX:Int=(x%1000)/100
    var fourthX:Int=x/1000
    if(firstX == secondX || firstX == thirdX || firstX == fourthX
        || secondX == thirdX || secondX == fourthX || thirdX == fourthX){
        return false
    }
    return true
}

fun check(num: Int):Boolean{
    for(i:Int in 0 until n){//bulls the same pos
        if(Bulls(arr[i].x , num) != arr[i].y ||
                Cows(arr[i].x , num) != arr[i].z){
            return false
        }
    }
    return true
}
fun Bulls(x:Int , y:Int):Int{
    var ans:Int=0
    if(x%10 == y%10){
        ans++
    }
    if ((x%100)/10 == (y%100)/10){
        ans++
    }
    if ((x%1000)/100 == (y%1000)/100){
        ans++
    }
    if(x/1000 == y/1000){
        ans++
    }
    return ans
}
fun Cows(x:Int , y:Int):Int{
    var ans=0
    var firstX:Int=x%10
    var secondX:Int=(x%100)/10
    var thirdX:Int=(x%1000)/100
    var fourthX:Int=x/1000

    var firstY:Int=y%10
    var secondY:Int=(y%100)/10
    var thirdY:Int=(y%1000)/100
    var fourthY:Int=y/1000
    if(firstX == secondY || firstX == thirdY || firstX == fourthY){
        ans++
    }
    if(secondX == firstY || secondX == thirdY || secondX == fourthY){
        ans++
    }
    if(thirdX == secondY || thirdX == firstY || thirdX == fourthY){
        ans++
    }
    if(fourthX == secondY || fourthX == thirdY || fourthX == firstY){
        ans++
    }
    return ans
}
class tuple(x:Int , y:Int , z:Int){
    var x:Int=0
    var y:Int=0
    var z:Int=0
    init{
        this.x=x
        this.y=y
        this.z=z
    }
}


fun main() {
    var n = readLine()!!.toInt()

    var list = mutableListOf<String>()

    for (i:Char in '0'..'9')
        for (j:Char in '0'..'9')if(j != i)
            for (k:Char in '0'..'9')if(k != i && k!= j)
                for (l:Char in '0'..'9')if(l!=i && l!=j && l!= k){
                    var arr = CharArray(4){i}
                    arr[1] = j
                    arr[2] = k
                    arr[3] = l

                    var num = String(arr)

                    list.add(num)
                }

    repeat(n){
        var (num,bulls, cows) = readLine()!!.split(" ")
        var tmp = mutableListOf<String>()
        for (s in list){
            var b = 0
            var c = 0

            var seto = setOf(num[0],num[1],num[2],num[3])
            var sett = setOf(s[0],s[1],s[2],s[3])

            var finSet = seto.intersect(sett);

            for (i in 0..3){
                if (s[i] == num[i])b++
            }

            c = finSet.size - b

            if(b == bulls.toInt() && c == cows.toInt())
                tmp.add(s)
        }

        list = tmp
    }

    if (list.size == 1)
        println(list[0])
    else if(list.isEmpty())
        println("Incorrect data")
    else
        println("Need more data")
}


import java.util.*

fun main() {
    val jin = Scanner(System.`in`)
    val k = jin.nextInt()
    val pa = jin.nextLong()
    val pb = jin.nextLong()
    val p = (pa * ((pa + pb) pow -1)) % MOD
    val np = 1L - p
    val npInv = np pow -1
    //println("p = $p, np = $np, npInv = $npInv")
    val dp = Array(k) { LongArray(k + 1) }
    var answer = k.toLong()
    dp[0][1] = 1L
    for (j1 in 0 until k) {
        for (j2 in 1..k) {
            //println("dp[$j1][$j2] = ${dp[j1][j2]}")
            if (j2 == k) {
                answer += dp[j1][j2] * (j1.toLong() + npInv - 1L)
                answer %= MOD
            } else {
                dp[j1][j2 + 1] += dp[j1][j2] * p
                dp[j1][j2 + 1] %= MOD
                if (j1 + j2 >= k) {
                    answer += ((dp[j1][j2] * np) % MOD) * (j1 + j2 - k).toLong()
                    answer %= MOD
                } else {
                    dp[j1 + j2][j2] += dp[j1][j2] * np
                    dp[j1 + j2][j2] %= MOD
                }
            }
        }
    }
    println(((answer % MOD) + MOD) % MOD)
}

val MOD: Long = 1000000007
val MOD_TOTIENT = (MOD - 1).toInt()

infix fun Long.pow(power: Int): Long {
    var e = power
    e %= MOD_TOTIENT
    if (e < 0) {
        e += MOD_TOTIENT
    }
    if (e == 0 && this == 0L) {
        return this
    }
    var b = this
    var res = 1L
    while (e > 0) {
        if (e and 1 != 0) {
            res *= b
            res %= MOD
        }
        b *= b
        b %= MOD
        e = e shr 1
    }
    return res
}


import java.util.Scanner

fun main(args : Array<String>) {

    //val reader = Scanner(System.`in`)
    //var n: Int = reader.nextInt()
    // var m: Int = reader.nextInt()

    val n = readLine()!!
    val m = readLine()!!
    var a: Int = n.toInt()
    var b: Int = m.toInt()

    var list1: MutableList<Int> = mutableListOf()
    var list2: MutableList<Int> = mutableListOf()

    if (n.length != m.length) println("WRONG_ANSWER")
    else if(n.length == 1 && m.length == 1 && n!= m ) println("WRONG_ANSWER")
    else if (n.length == 1 && m.length == 1 && n == m ) println("OK")
    else if (a > 0 && b > 0) {
            while (a > 0) {
                list1.add(a % 10)
                a = a / 10
            }
            list1.sort()
            if (list1[0] == 0) {
                for (i in 1..list1.size - 1) {
                    if (list1[i] != 0) {
                        list1[0] = list1[i]
                        list1[i] = 0
                        break
                    }
                }
            }

            while (b > 0) {
                list2.add(b % 10)
                b = b / 10
            }
            list2.reverse()

            if (list1 == list2) {
                println("OK")
            } else {
                println("WRONG_ANSWER")
            }
        }
}


fun main(args: Array<String>) {
    var s = readLine()!!.toCharArray().sortedArray()
    if (s[0] == '0') {
        var i = 0
        while (i + 1 < s.size && s[i] == '0')
            i++
        s[0] = s[i].also { s[i] = s[0] }
    }
    println(if (s contentEquals  readLine()!!.toCharArray()) "OK" else "WRONG_ANSWER")
}


fun main(){
    var (n,d) = readLine()!!.split(' ').map { it.toInt() }
    var list = readLine()!!.split(' ').map { it.toInt() }.sorted()
    var m = readLine()!!.toInt()

    if (m>=n){
        println(list.sum() - ((m-n)*d))
    }else{
        var ans = 0
        for (i in 0..m-1){
            ans+=list[i]
        }
        println(ans)
    }
}


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

    val (numHooks, fine) = readInts()
    val prices = readInts().sorted()
    val numGuests = readInt()
    print(
        if (numGuests <= numHooks) prices.subList(0, numGuests).sum()
        else prices.sum() - fine * (numGuests - numHooks)
    )
}


import kotlin.math.abs

fun main() {
    val (a, b, s) = readLine()!!.split(" ").map(String::toLong)
    val distance = abs(a) + abs(b)
    print(if (s >= distance && (s - distance) % 2 == 0L) "Yes" else "No")
}


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

    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 readInt() = readToken().toInt()
    fun readLong() = readToken().toLong()
    fun readLine() : String {
        tok = StringTokenizer("")
        return rd.readLine()
    }
}

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

fun solve(io: ProblemIO) {
    val a = io.readInt()
    val b = io.readInt()
    val s = io.readInt()
    val mind = Math.abs(a) + Math.abs(b)
    val res = if (s < mind) false else (s - mind) % 2 == 0
    io.println(if (res) "Yes" else "No")
}


import kotlin.math.abs

fun main() {
    var (a, b, s) = readLine()!!.split(" ").map { it.toInt() }
    var sum = abs(a) + abs(b)
    if (sum > s || (s - sum) % 2 == 1) {
        println("NO")
    } else {
        println("YES")
    }
}


import java.util.*

fun main(args: Array<String>) {
    val s = Scanner(System.`in`)
    val a = IntArray(2, { Math.abs(s.nextInt()) }).sum()
    val b = s.nextInt()
    val res = when {
        a == b || (a < b && (b - a).rem(2) == 0) -> "Yes"
        else -> "No"
    }
    print(res)
}


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

    fun main(args: Array<String>) {
        val infile = BufferedReader(InputStreamReader(System.`in`))
        val st = StringTokenizer(infile.readLine())
        val L = Integer.parseInt(st.nextToken())
        val R = Integer.parseInt(st.nextToken())
        val X = Integer.parseInt(st.nextToken())
        val Y = Integer.parseInt(st.nextToken())
        if (Y % X != 0) {
            println(0)
            return
        }
        var res = 0
        val boof = Y / X
        var i = 1
        while (i <= Math.sqrt(boof.toDouble())) {
            if (boof % i == 0 && X * Math.min(i, boof / i) >= L && X * Math.max(i, boof / i) <= R)
                if (rp(i, boof / i)) {
                    res += 2
                    if (i == boof / i)
                        res--
                }
            i++
        }
        println(res)
    }

    fun rp(c: Int, d: Int): Boolean {
        var a = c
        var b = d
        if (b > a) {
            val t = a
            a = b
            b = t
        }
        return if (b == 0) a == 1 else rp(b, a % b)
    }


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

    val options = listOf("vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon")
    val length = readInt()
    val hint = readLine()!!
    nextOption@ for (option in options) {
        if (option.length != length) continue
        for (pos in option.indices) if (hint[pos] != '.' && hint[pos] != option[pos]) continue@nextOption
        return print(option)
    }
}


fun main(){
    var n = readLine()!!.toInt()
    var str = readLine()!!
    if (n==6){
        println("espeon")
    }else if (n==8){
        println("vaporeon")
    }else{

        var list = listOf<String>("jolteon","flareon","umbreon","leafeon","glaceon","sylveon")
        for (i in list){
            var flag = false;
            for (j in 0 until i.length){
                if (str[j]!='.' && str[j]!=i[j]){
                    flag = true
                    break
                }
            }
            if (!flag) println(i)
        }
    }
}


import java.util.*

fun main() {

    val sc = Scanner(System.`in`)
    val a = arrayOf("vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon")
    val n = sc.nextInt()
    val str = sc.next()

    for (i in 0 until 8) {
        var stop = true
        if (n == a[i].length) {
            for (j in 0 until n) {
                if (str[j] != '.') {
                    if (str[j] != a[i][j]) {
                        stop = false
                        break
                    }
                }
            }
            if (stop) {
                print(a[i])
                return
            }
        }
    }

}


import kotlin.math.min

fun main() {
    readLine()
    val s = readLine()!!
    print(min(s.count { it == '8' }, s.length / 11))
}


import kotlin.math.min

fun main(args: Array<String>) {

    val n = readLine()?.toInt() ?: 0
    val text = readLine().toString()

    val nc = n / 11

    var ec = 0
    for(c in text) {
        if(c == '8')
            ec++
    }

    println(min(ec, nc))

}


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

object programkt {
  @JvmStatic fun main(args: Array<String>) {
    if (args.size == 1)
      System.setIn(FileInputStream(args[0]))
    val sc = Scanner(System.`in`)
    sc.nextLine()
    val all = sc.nextLine()
    var eights = all.filter { it == '8' }.count()
    var others = all.length - eights
    var numbers = 0
    while (eights > 0) {
      eights--
      IntRange(1, 10).forEach {
        if (others > 0)
          others--
        else
          eights--
      }
      if (numbers < 0 || eights < 0)
        break
      numbers++
    }
    println(numbers)
  }
}


fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    var digits = readLine()!!.count {it == '8'}
    println(minOf(n / 11, digits))
}


import kotlin.math.max
import kotlin.math.min

fun main(args: Array<String>) {
    var (la, ra, ta) = readLine()!!.split(' ').map(String::toLong)
    var (lb, rb, tb) = readLine()!!.split(' ').map(String::toLong)
    if (la > lb) {
        var t = la; la = lb; lb = t
        t = ra; ra = rb; rb = t
        t = ta; ta = tb; tb = t
    }
    rb -= la
    lb -= la
    ra -= la
    la = 0
    val tgcd = gcd(ta, tb)
    val q = lb / tgcd
    lb -= q * tgcd
    rb -= q * tgcd
    val ans1 = max(0, (min(ra, rb) - max(la, lb) + 1))
    lb -= tgcd
    rb -= tgcd
    val ans2 = max(0, (min(ra, rb) - max(la, lb) + 1))
    println(max(ans1, ans2))
}

fun gcd(a: Long, b: Long): Long {
    var aa = a
    var bb = b
    while (bb > 0) {
        val t = aa
        aa = bb
        bb = t % bb
    }
    return aa
}


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

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

fun solve(cin: FastReader, out: PrintWriter) {
    var la = cin.nextInt()
    var ra = cin.nextInt()
    var ta = cin.nextInt()
    var lb = cin.nextInt()
    var rb = cin.nextInt()
    var tb = cin.nextInt()
    var g = gcd(ta, tb)
    rb -= la
    ra -= la
    lb -= la
    la -= la
    if (lb < 0) {
        lb += tb
        rb += tb
    }

    var ans = 0
    for (d in listOf(lb / g, lb / g + 1, lb / g - 1)) {
        val llb = lb - g * d
        val rrb = rb - g * d

        if (llb <= ra && la <= rrb)
            ans = Math.max(ans, Math.min(ra, rrb) - Math.max(la, llb) + 1)
    }

    out.print(ans)
}

class FastReader(input: InputStream) {
    private val br = BufferedReader(InputStreamReader(input))
    private var st = StringTokenizer("")

    fun next(): String {
        while (!st.hasMoreTokens())
            st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt(): Int {
        return next().toInt()
    }

    fun nextDouble(): Double {
        return next().toDouble()
    }

    fun nextLong(): Long {
        return next().toLong()
    }

    /**
     * Warning! Use carefully!
     */
    fun nextLine(): String {
        return br.readLine()
    }
}

fun main(args: Array<String>) {
    val cin = FastReader(System.`in`)
    val out = PrintWriter(BufferedOutputStream(System.out))
    solve(cin, out)
    out.close()
}


import java.io.BufferedReader
import java.io.InputStreamReader
import kotlin.math.max
import kotlin.math.min

fun main() {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    var (la, ra, ta) = jin.readLine().split(" ").map { it.toLong() }
    var (lb, rb, tb) = jin.readLine().split(" ").map { it.toLong() }
    val g = gcd(ta, tb)
    val sa = ra - la
    val sb = rb - lb
    la %= g
    lb %= g
    val answer = max(
            max(
                    min(la + sa, lb + sb) - max(la, lb),
                    min(la + sa + g, lb + sb) - max(la + g, lb)),
            max(
                    min(la + sa, lb + sb + g) - max(la, lb + g),
                    -1L)
    ) + 1L
    println(answer)
}

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


fun gcd(x: Int, y: Int): Int {
    if (x < y) return gcd(y, x)
    if (x % y == 0) return y
    return gcd(y, x % y)
}

fun main(args: Array<String>) {
    var (l, r, t) = readLine()!!.split(" ").map { it.toInt() }
    var (l2, r2, t2) = readLine()!!.split(" ").map { it.toInt() }
    val g = gcd(t, t2)
    if (g == 1) {
        println(minOf(r - l + 1, r2 - l2 + 1))
    } else {
        var ans = 0
        if (l < l2) {
            var temp = (l2 - l) / g * g
            l += temp
            r += temp
            ans = maxOf(ans, minOf(r, r2) - maxOf(l, l2) + 1)
            l += g
            r += g
            ans = maxOf(ans, minOf(r, r2) - maxOf(l, l2) + 1)
        } else {
            var temp = (l - l2) / g * g
            l2 += temp
            r2 += temp
            ans = maxOf(ans, minOf(r, r2) - maxOf(l, l2) + 1)
            l2 += g
            r2 += g
            ans = maxOf(ans, minOf(r, r2) - maxOf(l, l2) + 1)
        }
        println(ans)
    }
}


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

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val inp = InputReader(inputStream)
    val out = PrintWriter(outputStream)
    val solver = TaskB()
    solver.solve(inp, out)
    out.close()
}

class TaskB {
    fun solve(inp: InputReader, out: PrintWriter) {
        val t = inp.nextInt()
        for (i in 1..t) {
            val a = inp.nextLong()
            val b = inp.nextLong()
            val d1 = a - b
            val d2 = a + b
            if (d1 == 1L) {
                if (isPrime(d2))
                    out.println("YES")
                else
                    out.println("NO")
            } else
                out.println("NO")
        }
    }

    private fun isPrime(x: Long): Boolean {
        if (x == 1L)
            return false
        var d = 2L
        while (d * d <= x) {
            if (x % d == 0L)
                return false
            d++
        }
        return true
    }
}

class InputReader(stream: InputStream) {
    private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer? = null

    init {
        tokenizer = null
    }

    operator fun next(): String {
        while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }
        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return next().toLong()
    }
}


import kotlin.math.sqrt

// unable to solve it by myself. Solution on tutorial: https://codeforces.com/blog/entry/62287
fun main() {
    fun readInt() = readLine()!!.toInt()
    fun readLongs() = readLine()!!.split(" ").map(String::toLong)

    nextQuery@ for (query in 0 until readInt()) {
        val (a, b) = readLongs()
        if (a - b != 1L) {
            println("NO")
            continue@nextQuery
        }
        val goal = a + b
        if (goal % 2 == 0L) println("NO")
        else {
            for (divisor in 3..sqrt(goal.toDouble()).toInt() step 2)
                if (goal % divisor == 0L) {
                    println("NO")
                    continue@nextQuery
                }
            println("YES")
        }
    }
}


import kotlin.math.sqrt

fun main() {
    repeat(readLine()!!.toInt()) {
        val (a,b)= readLine()!!.split(" ").map { it.toLong() }
        if(a - b > 1) {
            println("NO")
        } else {
            var isPrime = true
            for (i in 3..sqrt((a+b).toDouble()).toInt() step 2) {
                if((a+b).rem(i) == 0L) {
                    isPrime = false
                    break
                }
            }
            if(isPrime) {
                println("YES")
            } else {
                println("NO")
            }

        }

    }

}


import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val t = sc.nextInt()
    repeat(t) {
        val a = sc.nextBigInteger()
        val b = sc.nextBigInteger()
        if ((a * a - b * b).isProbablePrime(100)) {
            println("YES")
        }else{
            println("NO")
        }
    }
}


fun main(vararg args: String) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    var countInside = 0
    val noPar = s.replace("""\((.*?)\)""".toRegex()) {
        countInside += it.groupValues[1].splitToSequence('_').filter { it.length > 0 }.count()
        "_"
    }
    val maxLengthOutside = noPar.splitToSequence('_').map {it.length}.max() ?: 0
    println("$maxLengthOutside $countInside")
}


import java.util.*

//https://codeforces.com/problemset/problem/723/B

fun main(args: Array<String>) = with(Scanner(System.`in`)){
    val n = nextLine()!!.toInt()

    val str = nextLine()!!.toString()
//    println("str: $str")
    val chars = str.toCharArray()

    var pStart = false
    var undStart = false
    var wStart = false

    var longestW = 0
    var wordsInsideP =  0

    var currentWCount = 0

    val underScC = '_'
    val pStartC = '('
    val pEndC = ')'

    for(c in chars){
//        print("current: $c, ")
        if(c == underScC){
            if(wStart){
                wStart = false
                if(pStart){
                    wordsInsideP++
                } else {
                    if(longestW < currentWCount){
                        longestW = currentWCount
                    }
                    currentWCount = 0
                }
             }
        } else if (c == pStartC){
            pStart = true
            if(wStart) {
                wStart = false
                if(longestW < currentWCount){
                    longestW = currentWCount
                }
                currentWCount = 0
            }
        } else if(c == pEndC) {
             pStart = false
             if(wStart) {
                wStart = false
                wordsInsideP++
            }
        } else {
            wStart = true
            if(!pStart){
                currentWCount++
            }
        }
    }
    if(wStart){
       if(longestW < currentWCount){
            longestW = currentWCount
            currentWCount = 0
       }
    }
    println("$longestW $wordsInsideP")
}


//region TEMPLATE
@file:Suppress("CanBeVal")

import java.io.*;
import java.io.BufferedReader
import java.math.BigInteger
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.max
import kotlin.math.min

fun main(args: Array<String>) {
    if (args.isNotEmpty() && args.first() == "file") {
        reader = BufferedReader(FileReader("input.txt"))
        out = PrintWriter(FileWriter("output.txt"))
        do {
            solve()
            out.println("\n")
            out.flush()
        } while (reader.readLine() != null)
    } else {
        reader = BufferedReader(InputStreamReader(System.`in`))
        out = PrintWriter(OutputStreamWriter(System.out))
        solve()
    }
    reader.close()
    out.close()
}

lateinit var out: PrintWriter
lateinit var reader: BufferedReader
var tokenizer: StringTokenizer? = null
fun read(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
        tokenizer = StringTokenizer(readLn())
    }
    return tokenizer!!.nextToken()
}

fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readLn() = reader.readLine()!!
fun readInts() = readLn().split(" ").map { it.toInt() }
fun readInts(sz: Int) = Array(sz) { readInt() }
fun readLongs() = readLn().split(" ").map { it.toLong() }
fun readLongs(sz: Int) = Array(sz) { readLong() }
fun print(b: Boolean) = out.print(b)
fun print(i: Int) = out.print(i)
fun print(d: Double) = out.print(d)
fun print(l: Long) = out.print(l)
fun print(s: String) = out.print(s)
fun print(message: Any?) = out.print(message)
fun print(a: Array<Int>) = a.forEach { print("$it ") }
fun <T> print(a: Array<out T>) = a.forEach { print("$it ") }
fun <T> print(a: Collection<T>) = a.forEach { print("$it ") }
fun println(b: Boolean) = out.println(b)
fun println(i: Int) = out.println(i)
fun println(d: Double) = out.println(d)
fun println(l: Long) = out.println(l)
fun println(s: String) = out.println(s)
fun println() = out.println()
fun println(message: Any?) = out.println(message)
fun <T> println(a: Array<out T>) {
    a.forEach { print("$it ") }
    println()
}

fun println(a: IntArray) {
    a.forEach { print("$it ") }
    println()
}

fun <T> println(a: Collection<T>) {
    a.forEach { print("$it ") }
    println()
}

const val M7 = 1000000007L
const val M9 = 1000000009L
const val MFFT = 998244353L
fun zero(sz: Int) = IntArray(sz)
fun zeroL(sz: Int) = LongArray(sz)
fun <T> init(vararg elements: T) = elements
fun VI(n: Int = 0, init: Int = 0) = MutableList(n) { init }
fun VVI(n: Int = 0, m: Int = 0, init: Int = 0) = MutableList(n) { VI(m, init) }
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
    }
}
//endregion

fun solve() {
    var n = readInt()
    var s = read()
    var f = false
    var mx = 0
    var cnt = 0
    var i = 0
    while(i < n){
        if (s[i] == '('){
            f = true
        }
        if (s[i] == ')'){
            f = false
        }
        if (s[i].isLetter()){
            var j = i
            while(j < n && s[j].isLetter()){
                j++
            }
            if (f){
                cnt++
            } else {
                mx = max(mx, j - i)
            }
            i = j - 1
        }
        i++
    }
    print("${mx} ${cnt}")

}


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

fun main(args: Array<String>) {
    val br = BufferedReader(InputStreamReader(System.`in`))
    br.readLine()

    val s = br.readLine() + "_"

    var longestWord = 0
    var wordCount = 0
    var inParentheses = false
    var charCount = 0

    fun wordSplit() {
        if (charCount > 0)
            if (inParentheses) {
                wordCount++
            } else {
                longestWord = Math.max(longestWord, charCount)
            }
        charCount = 0
    }

    fun character() {
        charCount++
    }

    s.forEach {
        when (it) {
            '_' -> wordSplit()
            '(' -> {
                wordSplit()
                inParentheses = true
            }
            ')' -> {
                wordSplit()
                inParentheses = false
            }
            else -> character()
        }
    }

    println("$longestWord $wordCount")

}


import kotlin.math.max

fun main() {
    var insideParenthesis = false
    readLine()
    var countInside = 0
    var maxOutside = 0
    var count = 0
    for (c in readLine()!!)
        when (c) {
            '_' -> {
                if (insideParenthesis && count > 0) countInside++
                count = 0
            }
            '(' -> {
                insideParenthesis = true
                count = 0
            }
            ')' -> {
                if (count > 0) countInside++
                insideParenthesis = false
                count = 0
            }
            else -> {
                count++
                if (!insideParenthesis) maxOutside = max(maxOutside, count)
            }
        }
    print("$maxOutside $countInside")
}


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

fun main(args : Array<String>) {
  //====== Input preparations ========================================================
//  val fin = BufferedReader(FileReader("b.in"))
  val fin = BufferedReader(InputStreamReader(System.`in`))
  val fout = PrintWriter (System.out)
  var tokenizer = StringTokenizer("")
  fun next() : String {
    while (!tokenizer.hasMoreTokens())
      tokenizer = StringTokenizer(fin.readLine())
    return tokenizer.nextToken()
  }
  fun nextInt() = next().toInt()
  fun nextPair() = nextInt() to nextInt()
  fun nextPairDec() = nextInt()-1 to nextInt()-1
  //====== Solution below ============================================================
  var cntIn = 0
  var maxOut = 0
  next()
  val words = next().split('(', ')')
  for (i in words.indices) {
    val s = words[i]
    for (w in s.split('_').filter { it != "" }) {
      if (i % 2 == 0)
        maxOut = Math.max(maxOut, w.length)
      else
        cntIn++
    }
  }
  fout.print("%d %d".format(maxOut, cntIn))

  fout.close()
  fin.close()
}


import java.io.*
import java.lang.Math.*
import java.math.BigInteger
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import kotlin.math.sqrt

typealias IndexPair<Type> = Pair<Type, Int>
typealias IntIndexPair = IndexPair<Int>
typealias IntIntPair = Pair<Int, Int>

typealias IntMatrix = Array<IntArray>
typealias LongMatrix = Array<LongArray>

typealias ListArray<Type> = Array<MutableList<Type>>

typealias Graph = IntMatrix

typealias Edge = Pair<Int, Int>
typealias EdgeArray = Array<Edge>
typealias WeightedGraph = Array<EdgeArray>

typealias TotalEdge = Triple<Int, Int, Int>
typealias TotalEdgeArray = Array<TotalEdge>

fun init() { }

const val MODULO = 1000 * 1000 * 1000 + 7

fun solve() {
    val n = readLong() - 1

    var nearestRoot = sqrt(n * 2.0).toLong()
    while (nearestRoot * (nearestRoot + 1) > 2 * n) --nearestRoot
    val sum = nearestRoot * (nearestRoot + 1) / 2

    val answer = n - sum
    out.println(answer + 1)
}

fun stress() {
    val rnd = Random(1234)

    for (it in 0 until 100) {
        val expected = brute()
        val actual = fast()

        if (expected != actual) {
            System.err.println("Gotcha!")
            System.err.println("$expected $actual")

            break
        }
    }
}

fun fast() {

}

fun brute() {

}

fun Long.mod() : Long {
    var result = this % MODULO
    if (result < 0) result += MODULO
    return result
}

infix fun Long.add(other : Long) = (this + other).mod()
infix fun Long.sub(other : Long) = this add -other.mod()
infix fun Long.mult(other : Long) = (this.mod() * other.mod()).mod()

fun Long.even() = (this and 1L) == 0L
fun Long.odd() = !even()

fun Int.even() = (this and 1) == 0
fun Int.odd() = !even()

infix fun Long.binpow(power : Long) : Long {
    if (power == 0L) return 1L

    val half = binpow(power shl 1)

    var result = half mult half
    if (power.odd()) {
        result = result mult this
    }

    return result
}

val stepsXY = arrayOf(
        arrayOf(0, -1),
        arrayOf(0, 1),
        arrayOf(-1, 0),
        arrayOf(1, 0)
)

class IndexedWeightedGraph(private val n : Int, private val edges: TotalEdgeArray) {

    private val graph : Graph

    private fun buildGraphForEdges(
            edgeFilter : (index : Int, edge : TotalEdge) -> Boolean = { _, _ -> true }
    ) : Graph {
        val builder = GraphBuilder()
        edges
            .forEachIndexed { index, edge ->
                if (edgeFilter(index, edge)) {
                    val (first, second, _ ) = edge

                    builder.addDirectedEdge(first, index)
                    builder.addDirectedEdge(second, index)
                }
            }

        return builder.build(n)
    }

    init {
        graph = buildGraphForEdges()
    }

    var root : Int = -1
    lateinit var inTree : BooleanArray
    lateinit var tree : Graph

    fun kruskalTree(root : Int) : Long {
        this.root = root

        inTree = BooleanArray(edges.size) { false }

        val dsu = DSU(n)

        edges
            .mapIndexed { index, (_, _, w) -> index to w }
            .sortedBy { it.second }
            .forEach {
                val edge = edges[it.first]
                inTree[it.first] = dsu.union(edge.first, edge.second)
            }

        tree = buildGraphForEdges { index, _ -> inTree[index] }

        return edges
                .mapIndexed { index, (_, _, w)  -> if (inTree[index]) w.toLong() else 0L }
                .sum()
    }

    private fun to(from : Int, index : Int) : Int {
        val edge = edges[index]
        return if (from == edge.first) edge.second else edge.first
    }

    fun buildLca() {
        calculateTimes()
        calculateParents()
        calculatePathInfo()
    }

    lateinit var timesIn : IntArray
    lateinit var timesOut : IntArray
    private var time = -1

    private fun calculateTimes() {
        timesIn = IntArray(n) { -1 }
        timesOut = IntArray(n) { -1 }
        this.time = 0

        timeDfs(root)
    }

    private fun timeDfs(from : Int, parent : Int = -1) {
        timesIn[from] = time++

        for (index in tree[from]) {
            val to = to(from, index)
            if (to == parent) continue

            timeDfs(to, from)
        }

        timesOut[from] = time++
    }

    lateinit var parents : Array<IntArray>
    private val maxBit = 19

    private fun calculateParents() {
        parents = Array(maxBit) { IntArray(n) { -1 } }

        parentDfs(root, root)

        for (bit in 0 until maxBit - 1) {
            for (v in 0 until n) {
                val parent = parents[bit][v]
                parents[bit + 1][v] = parents[bit][parent]
            }
        }
    }

    private fun parentDfs(from : Int, parent : Int = -1) {
        parents[0][from] = parent

        for (index in tree[from]) {
            val to = to(from, index)
            if (to == parent) continue

            parentDfs(to, from)
        }
    }

    lateinit var maxEdges : Array<IntArray>

    private fun calculatePathInfo() {
        maxEdges = Array(maxBit) { IntArray(n) { -1 } }

        for (v in 0 until n){
            for (index in tree[v]) {
                val to = to(v, index)
                if (to == parents[0][v]) continue

                maxEdges[0][to] = edges[index].third
            }
        }

        for (bit in 0 until maxBit - 1) {
            for (v in 0 until n) {
                val parent = parents[bit][v]
                maxEdges[bit + 1][v] = max(
                        maxEdges[bit][v],
                        maxEdges[bit][parent]
                )
            }
        }
    }

    fun getOnPath(a : Int, b : Int) : Int {
        var answer = Int.MIN_VALUE

        answer = max(answer, getOnLcaPath(a, b))
        answer = max(answer, getOnLcaPath(b, a))

        return answer
    }

    private fun getOnLcaPath(start : Int, other : Int) : Int {
        var answer = Int.MIN_VALUE

        if (timesIn[start] <= timesIn[other] && timesOut[other] <= timesOut[start]) {
            return answer
        }

        var v = start
        for (bit in maxBit - 1 downTo 0) {
            val parent = parents[bit][v]
            if (timesIn[parent] > timesIn[other] || timesOut[other] > timesOut[parent]) {
                answer = max(answer, maxEdges[bit][v])
                v = parent
            }
        }

        answer = max(answer, maxEdges[0][v])

        return answer
    }
}

fun yesNo(yes : Boolean) {
    out.println(if (yes) "YES" else "NO")
}

fun run() {
    init()
    solve()
    out.close()
}

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

val ONLINE_JUDGE = !File("input.txt").exists()

val input = BufferedReader(
        if (ONLINE_JUDGE) InputStreamReader(System.`in`) else FileReader("input.txt")
)
val out =
        if (ONLINE_JUDGE) PrintWriter(System.out)
        else PrintWriter("output.txt")

fun readStrings(separator: String = " ", emptyWords: Boolean = false) : Array<String> {
    val line = input.readLine()

    val list = ArrayList<String>()
    var builder = StringBuilder()

    for (i in 0..line.length) {
        if (i == line.length || separator.contains(line[i])) {
            if (emptyWords || builder.isNotEmpty()) {
                list.add(builder.toString())
                builder = StringBuilder()
            }
        } else {
            builder.append(line[i])
        }
    }

    return list.toTypedArray()
}

fun readString(separator: String = " ") =
        readStrings(separator).first()

fun readInts(separator: String = " ") =
        readStrings(separator).map(String::toInt).toIntArray()

fun readDecreasedInts(separator : String = " ") =
        readInts(separator).map { it - 1 }.toIntArray()

fun readSortedInts(separator: String = " ") : IntArray {
    val a = readInts(separator)

    val aInteger = Array(a.size) { a[it] }
    Arrays.sort(aInteger)

    return aInteger.toIntArray()
}

fun readInt(separator: String = " ") =
        readInts(separator).first()

fun readLongs(separator: String = " ") =
        readStrings(separator).map(String::toLong).toLongArray()

fun readLong(separator: String = " ") =
        readLongs(separator).first()

fun readDoubles(separator: String = " ") =
        readStrings(separator).map(String::toDouble).toDoubleArray()

fun readDouble(separator: String = " ") =
        readDoubles(separator).first()

fun readBigIntegers(separator: String = " ") =
        readStrings(separator).map { BigInteger(it) }.toTypedArray()

fun readBigInteger(separator: String = " ") =
        readBigIntegers(separator).first()

fun readTree(n : Int, indexing : Int = 1) =
    readGraph(n, n - 1, true, indexing)

fun readGraph(n: Int, m : Int,
              undirected : Boolean = true,
              indexing : Int = 1) : Graph {
    val builder = GraphBuilder()

    for (i in 1..m) {
        var (from, to) = readInts()

        from -= indexing
        to -= indexing

        if (undirected) builder.addEdge(from, to)
        else builder.addDirectedEdge(from, to)
    }

    return builder.build(n)
}

fun readWeightedGraph(n : Int, m : Int,
                      undirected : Boolean = true,
                      indexing : Int = 1) : WeightedGraph {
    val builder = GraphBuilder()

    for (i in 1..m) {
        var (from, to, weight) = readInts()

        from -= indexing
        to -= indexing

        if (undirected) builder.addEdge(from, to, weight)
        else builder.addDirectedEdge(from, to, weight)
    }

    return builder.buildWeighted(n)
}

fun readTotalEdges(m : Int, indexing : Int = 1) =
        TotalEdgeArray(m) {
            var (from, to, w) = readInts()

            from -= indexing
            to -= indexing

            Triple(from, to, w)
        }

class GraphBuilder {

    private val froms = ArrayList<Int>()
    private val tos = ArrayList<Int>()
    private val weights = ArrayList<Int>()

    fun addEdge(from : Int, to : Int, weight : Int = 1) {
        addDirectedEdge(from, to, weight)
        addDirectedEdge(to, from, weight)
    }

    fun addDirectedEdge(from : Int, to : Int, weight : Int = 1) {
        froms.add(from)
        tos.add(to)
        weights.add(weight)
    }

    private fun calculateFromSizes(n : Int) : IntArray {
        val sizes = IntArray(n) { 0 }
        froms.forEach { ++sizes[it] }
        return sizes
    }

    fun build(n : Int) : Graph {
        val sizes = calculateFromSizes(n)

        val graph = Graph(n) { IntArray(sizes[it]) { 0 } }

        for (i in 0 until n) {
            sizes[i] = 0
        }

        for (i in 0 until froms.size) {
            val from = froms[i]
            val to = tos[i]

            graph[from][sizes[from]++] = to
        }

        return graph
    }

    fun buildWeighted(n : Int) : WeightedGraph {
        val sizes = calculateFromSizes(n)

        val graph = WeightedGraph(n) { EdgeArray(sizes[it]) { -1 to 0 } }

        for (i in 0 until n) {
            sizes[i] = 0
        }

        for (i in 0 until froms.size) {
            val from = froms[i]
            val to = tos[i]
            val weight = weights[i]

            graph[from][sizes[from]++] = to to weight
        }

        return graph
    }
}

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

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

fun getDivisors(x : Int) : MutableList<Int> {
    val divisors = ArrayList<Int>()

    var d = 1
    while (d * d <= x) {
        if (x % d == 0) {
            if (d != 1) divisors.add(d)
            if (x != d) divisors.add(x / d)
        }

        ++d
    }

    return divisors
}

fun getPrimeDivisors(xx : Int) : MutableList<Int> {
    val divisors = ArrayList<Int>()

    var d = 2
    var x = xx
    while (d * d <= x) {
        if (x % d == 0) {
            divisors.add(d)
            while (x % d == 0) {
                x /= d
            }
        }

        ++d
    }

    if (x > 1) divisors.add(x)

    return divisors
}

fun checkIndex(index : Int, size : Int) =
        0 <= index && index < size

fun checkCell(x : Int, n : Int, y : Int, m : Int) =
        checkIndex(x, n) && checkIndex(y, m)

fun toChar(index : Int, start : Char) =
        (index + start.toInt()).toChar()

class DSU {

    var sizes : IntArray
    var ranks : IntArray
    var parents : IntArray

    constructor(n : Int)
    : this(
            IntArray(n) { 1 }
    )

    constructor(sizes : IntArray) {
        val size = sizes.size
        this.sizes = sizes
        this.ranks = IntArray(size) { 1 }
        this.parents = IntArray(size) { it }
    }

    operator fun get(v : Int) : Int {
        val parent = parents[v]
        if (parent == v) return v
        parents[v] = get(parent)
        return parents[v]
    }

    fun union(aUniting : Int, bUniting : Int) : Boolean {
        var a = get(aUniting)
        var b = get(bUniting)

        if (a == b) return false

        if (ranks[a] < ranks[b]) {
            val tmp = a
            a = b
            b = tmp
        }

        parents[b] = a
        sizes[a] += sizes[b]
        if (ranks[a] == ranks[b]) ++ranks[a]

        return true
    }

    fun size(v : Int) : Int = sizes[get(v)]
}

class FenwickTree(n : Int) {

    val size = n + 1
    val tree = LongArray(size) { 0L }

    fun update(index : Int, delta : Int) {
        var x = index + 1
        while (x < size) {
            tree[x] = tree[x] + delta
            x += x and -x
        }
    }

    operator fun get(start : Int, end : Int) =
            get(end) - get(start - 1)

    operator fun get(index : Int) : Long {
        var result : Long = 0

        var x = index + 1
        while (x > 0) {
            result += tree[x]
            x -= x and -x
        }

        return result
    }
}


fun main() {
    val n = readLong() - 1

    val bs = (1..2e7.toLong()).binarySearchBy {
        regime(it).compareTo(n)
    }

    val l = bs.value - if(bs.exactFound) 0 else 1
    val ans = n - regime(l) + 1

    println(ans)
}

fun regime(l: Long) = l * (l-1) / 2

fun LongRange.binarySearchBy(goldilocks: (Long) -> Int): BinarySearchResult<Long> {
    var low = start
    var high = endInclusive

    while (low <= high) {
        val mid = low / 2 + high / 2 + (low % 2 + high % 2) / 2
        val cmp = goldilocks(mid)

        if (cmp < 0)
            low = mid + 1
        else if (cmp > 0)
            high = mid - 1
        else
            return BinarySearchResult(mid, true) // key found
    }
    return BinarySearchResult(low, false)  // key not found
}
data class BinarySearchResult<out T>(val value: T, val exactFound: Boolean)

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readDouble() = readLn().toDouble()
fun readLong() = readLn().toLong()
fun readStrings() = readLn().split(' ')
fun readStringSeq() = readLn().splitToSequence(' ')
fun readInts() = readStrings().map { it.toInt() }
fun readIntSeq() = readStringSeq().map { it.toInt() }
fun readIntArray(size: Int) = readIntSeq().iterator().let { i -> IntArray(size) { i.next() } }
fun readDoubles() = readStrings().map { it.toDouble() }
fun readDoubleSeq() = readStringSeq().map { it.toDouble() }
fun readDoubleArray(size: Int) = readDoubleSeq().iterator().let { i -> DoubleArray(size) { i.next() } }
fun readLongs() = readStrings().map { it.toLong() }
fun readLongSeq() = readStringSeq().map { it.toLong() }
fun readLongArray(size: Int) = readLongSeq().iterator().let { i -> LongArray(size) { i.next() } }

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


import java.lang.Long.min

fun main() {
    val count = readLine()!!.toInt()
    val dp = Array(count) { i -> LongArray(count - i) { Long.MAX_VALUE / 3 } }
    dp[0].fill(0)
    dp[1].fill(0)
    for (left in 0 until count - 2) {
        dp[2][left] = 1L * (left + 1) * (left + 2) * (left + 3)
    }

    for (length in 3 until count) {
        for (left in 0 until count - length) {
            val right = left + length
            val mult = 1L * (left + 1) * (right + 1)
            for (midPoint in left + 1 until right) {
                dp[length][left] = min(dp[length][left],
                        dp[midPoint - left][left] + dp[right - midPoint][midPoint] + mult * (midPoint + 1))
            }
        }
    }
    println(dp[count - 1][0])
}


import kotlin.math.min
import kotlin.math.max
import kotlin.math.sqrt

private fun cin_ch() = readLine()!!.split(" ").map{it.toInt()}
private fun cin_array() = readLine()!!.split(" ").map(String::toInt)
private fun cin_string() = readLine()!!.split(" ")

fun main() {
var n = cin_ch()[0];
var ans = 0;
for (i in 3..n) {
ans+=i*(i-1);
}
println(ans);
return;
}


//package com.happypeople.codeforces.c1140

import java.io.ByteArrayInputStream
import java.io.InputStream
import java.util.*

fun main(args: Array<String>) {
    try {
        D1140().run()
    } catch (e: Throwable) {
        println("")
        e.printStackTrace()
    }
}

class D1140 {
    fun run() {
        val sc = Scanner(systemIn())
        val n=sc.nextInt()
        var ans=0L
        for(i in 3..n)
            ans+=(i*(i-1))

        println("$ans")
    }

    companion object {
        var inputStr: String? = null

        fun systemIn(): InputStream {
            if (inputStr != null)
                return ByteArrayInputStream(inputStr!!.toByteArray())
            else
                return System.`in`
        }

        var printLog = false
        fun log(str: String) {
            if (printLog)
                println(str)
        }
    }
}


import java.util.*

typealias Pii = Pair<Int, Int>
typealias Pll = Pair<Long, Long>

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
    var n = nextInt();
    var ans:Long = 0;
    for (i in 3..n) {
        ans += (i - 1) * i;
    }
    println("$ans");
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    //val l = r.readLine()!!.toInt()
    //val time = r.readLine()!!.split(" ").map { it.toInt() }.sorted()
    var black = 0
    var white = 0
    repeat(8){
        val board = r.readLine()!!
        board.forEach {
            when(it){
                'q' -> black += 9
                'r' -> black += 5
                'b' -> black += 3
                'n' -> black += 3
                'p' -> black += 1
                'Q' -> white += 9
                'R' -> white += 5
                'B' -> white += 3
                'N' -> white += 3
                'P' -> white += 1
            }
        }
    }
    println(when{
        black>white -> "Black"
        white>black -> "White"
        else -> "Draw"
    })
}


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

    val map = mapOf('q' to 9, 'r' to 5, 'b' to 3, 'n' to 3, 'p' to 1, '.' to 0, 'k' to 0)
    val sums = intArrayOf(0, 0)
    repeat(8) {
        for (c in readLine()!!)
            sums[c.isUpperCase().toInt()] += map[c.toLowerCase()] ?: error("not recognixed piece")
    }
    print(if (sums[0] > sums[1]) "Black" else if (sums[0] == sums[1]) "Draw" else "White")
}


/**
 * We declare a package-level function main which returns Unit and takes
 * an Array of strings as a parameter. Note that semicolons are optional.
 */
fun main(args: Array<String>) {
    var black:Int = 0
    var white:Int = 0
    for (i in 1..8) {
   		val str = readLine()!!
        for (c in str) {
            black = when(c) {
                'q' -> black + 9
                'r' -> black + 5
                'b' -> black + 3
                'n' -> black + 3
                'p' -> black + 1
                else -> black
            }
             white = when(c) {
                'Q' -> white + 9
                'R' -> white + 5
                'B' -> white + 3
                'N' -> white + 3
                'P' -> white + 1
                else -> white
            }
        }
    }
    if (black == white ) {
        println("Draw")
        return
    }
    if (black > white ){
        println("Black")
    } else {
        println("White")
    }
}


fun main(args: Array<String>) {
    (0 until 8).sumBy {
        readLine()!!.sumBy { when(it.toLowerCase()){
                'q' -> 9
                'r' -> 5
                'b','n' -> 3
                'p' -> 1
                else -> 0
        } * if (it.isUpperCase()) 1 else -1 }
    }.let { println(when {
            it < 0 -> "Black"
            it > 0 -> "White"
            else -> "Draw"
        })
    }
}


fun main() {
    fun readLong() = readLine()!!.toLong()

    val n = readLong()
    var a = 0L
    while (a * 10 + 9 <= n) a = a * 10 + 9
    var b = n - a
    var sol = 0L
    while (a > 0) {
        sol += a % 10
        a /= 10
    }
    while (b > 0) {
        sol += b % 10
        b /= 10
    }
    print(sol)
}


fun main(args: Array<String>) {
    val n = readLine()
    val x = if (n!!.length > 1) "9".repeat(n.length - 1) else "0"
    val y = (n.toBigInteger() - x.toBigInteger()).toString()
    println(x.map {it -> it.toString().toInt()}.reduce {s, sum -> s + sum}
            + y.map {it -> it.toString().toInt()}.reduce {s, sum -> s + sum})
}


import kotlin.math.log10
fun ffff(d : Int):Long
{
    var s = 0L
    var d2 = d
    while(d2>0){
        s += Math.pow(10.0,(d2-1L).toDouble()).toLong()*9
        d2--
    }
    return s
}
fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    val bas = log10(n.toDouble()).toInt() + 1
    //println(bas)
    val s1 = ffff(bas-1)
    var s2 = n-s1
    var t = 0
    //println(s2)
    while (s2>0)
    {
        t+=(s2 % 10L).toInt()
        s2/=10L
    }
    t += 9*(bas-1)
    println(t)
}


import java.io.FileInputStream
import java.math.BigDecimal
import java.util.*
import kotlin.Comparator

object programkt {
  fun S(n0: Long): Long {
    var res = 0L
    var n = n0
    while (n > 0) {
      res += n % 10
      n = n / 10
    }
    return res
  }

  fun solveDumb(n: Long) =
    LongRange(0, n)
      .map { it -> Pair(S(it) + S(n - it), it) }
      .maxWith(
        object : Comparator<Pair<Long, Long>> {
          override fun compare(o1: Pair<Long, Long>, o2: Pair<Long, Long>): Int {
            if (o1.first == o2.first)
              return o1.second.compareTo(o2.second)
            else
              return o1.first.compareTo(o2.first)
          }
        }
      )!!

  fun solve(n: Long): Long {
    if (n < 10)
      return n
    else {
      var n10 = 1L
      while (n10 * 10 <= n) {
        n10 *= 10
      }
      val a = n / n10 * n10 - 1
      val b = n - a
      return S(a) + S(b)
    }
  }

  @JvmStatic fun main(args: Array<String>) {
    if (args.size == 1)
      System.setIn(FileInputStream(args[0]))
    //val sc = Scanner(System.`in`)

    LongRange(0, 100).forEach {
      //println("$it " + solveDumb(it))
      assert(solveDumb(it).first == solve(it))
    }

    println(solve(BigDecimal(readLine()).toLong()))
  }
}


private fun readLn() = readLine()!!
private fun readString() = readLn().trim()
private fun readInt() = readLn().toInt()
private fun readLong() = readLn().toLong()
private val regSpace = "\\s+".toRegex()
private fun readSomeInts(): List<Int> {
    return readLn().trim().split(regSpace).map { it.toInt() }
}
private fun readSomeLongs(): List<Long> {
    return readLn().trim().split(regSpace).map { it.toLong() }
}

data class Point(val row: Int, val col: Int)

fun main() {
    val (n, m) = readSomeInts()

    fun neighbors(p: Point): List<Point> {
        val acc = mutableListOf<Point>()
        if (p.row > 0) {
            acc.add(Point(p.row - 1, p.col))
        }
        if (p.col > 0) {
            acc.add(Point(p.row, p.col - 1))
        }
        if (p.col < m - 1) {
            acc.add(Point(p.row, p.col + 1))
        }
        if (p.row < n - 1) {
            acc.add(Point(p.row + 1, p.col))
        }
        return acc
    }

    val field = mutableListOf<String>().apply {
        repeat(n) {
            val s = readString()
            this.add(s)
        }
    }.toList()

    fun hasWolf(p: Point) = field[p.row][p.col] == 'W'

    val wolfNotHangry = Array<BooleanArray>(n) { BooleanArray(m) }

    var countEatenPigs = 0
    for (i in 0 until n) {
        for (j in 0 until m) {
            if (field[i][j] == 'P') {
                val pigPt = Point(i, j)
                val anyWolf = neighbors(pigPt)
                        .firstOrNull { pt -> hasWolf(pt) && !wolfNotHangry[pt.row][pt.col] }
                if (anyWolf != null) {
                    wolfNotHangry[anyWolf.row][anyWolf.col] = true
                    countEatenPigs++
                }
            }
        }
    }
    println(countEatenPigs)
}


fun main() {
    val (numRows, numCols) = readLine()!!.split(" ").map(String::toInt)
    val board = Array(numRows + 2) { ArrayList<Char>(numCols + 2) }
    board[0] = arrayListOf(*(1..numCols + 2).map { '.' }.toTypedArray())
    for (i in 1..numRows) {
        val l = arrayListOf('.')
        l.addAll(readLine()!!.toCharArray().toList())
        l.add('.')
        board[i] = l
    }
    board[numRows + 1] = arrayListOf(*(1..numCols + 2).map { '.' }.toTypedArray())
    var sol = 0
    for (row in 1..numRows)
        for (col in 1..numCols)
            if (board[row][col] == 'P')
                when {
                    board[row - 1][col] == 'W' -> {
                        sol++
                        board[row - 1][col] = '.'
                    }
                    board[row][col - 1] == 'W' -> {
                        sol++
                        board[row][col - 1] = '.'
                    }
                    board[row][col + 1] == 'W' -> {
                        sol++
                        board[row][col + 1] = '.'
                    }
                    board[row + 1][col] == 'W' -> {
                        sol++
                        board[row + 1][col] = '.'
                    }
                }
    print(sol)
}


fun main() {
    val table = Table()

    val notEatenPig: (Cell) -> Boolean = { it is PigCell && !it.eaten }

    // eat variant pig
    fun eatPig(nearbyCount: Int): Int {
        var eatCount = 0
        table.forEachIndexed { x, y, cell ->
            if (cell is WolfeCell && !cell.eat) {
                val nearbyPigs = table.nearby(x, y, notEatenPig)
                if (nearbyPigs.size == nearbyCount) {
                    cell.eat = true
                    (nearbyPigs.first() as PigCell).eaten = true
                    eatCount += 1
                }
            }
        }
        return eatCount
    }

    println((1..4).fold(0) { acc, count -> acc + eatPig(count) })
}

class Table {
    private val matrix: List<List<Cell>>
    private val n: Int
    private val m: Int

    init {
        readLine()!!.split(" ")
            .map(String::toInt)
            .also {
                n = it[0]
                m = it[1]
            }

        matrix = (0 until n).map {
            readLine()!!.toCharArray().take(m)
                .map {
                    when (it) {
                        'P' -> PigCell()
                        'W' -> WolfeCell()
                        '.' -> EmptyCell
                        else -> throw IllegalArgumentException("Unknown animal")
                    }
                }
        }
    }

    fun forEachIndexed(action: (x: Int, y: Int, cell: Cell) -> Unit) {
        matrix.forEachIndexed { i, row ->
            row.forEachIndexed { j, cell -> action(i, j, cell) }
        }
    }

    private fun inRange(x: Int, y: Int) = x in 0 until n && y in 0 until m

    fun nearby(x: Int, y: Int, predicate: (Cell) -> Boolean): List<Cell> {
        return listOf(
            Pair(x - 1, y),  // left
            Pair(x + 1, y),  // right
            Pair(x, y - 1),  // top
            Pair(x, y + 1)   // bottom
        )
            .filter { (x, y) -> inRange(x, y) }
            .map { (x, y) -> matrix[x][y] }
            .filter(predicate)
    }
}

sealed class Cell

data class PigCell(
    var eaten: Boolean = false
) : Cell()

data class WolfeCell(
    var eat: Boolean = false
) : Cell()

object EmptyCell : Cell()


import java.io.*
import kotlin.concurrent.thread
import java.io.IOException
import java.io.BufferedReader
import java.io.InputStream
import kotlin.*
import java.*
import java.io.OutputStream
import java.io.PrintWriter
import java.lang.ArithmeticException
import java.lang.Exception
import java.math.BigInteger
import java.security.cert.TrustAnchor
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashSet
import kotlin.system.exitProcess

fun main() {
    val inputStream = System.`in`
    val outputStream = System.out
    val `in` = InputReader(inputStream)
    val out = PrintWriter(outputStream)
    val mod = 1000*1000*1000+7

    fun add(a:Int,b:Int):Int{
        if (a+b>=mod)
            return a+b-mod
        return a+b
    }
    fun sub(a:Int,b:Int):Int{
        if (a>=b)
            return a-b
        return a-b+mod
    }

    fun mul(a:Int,b:Int):Int{
        return (a.toLong()*b.toLong()%mod).toInt()
    }

    val n=`in`.nextInt()
    val m=`in`.nextInt()

    val dp=IntArray(n+1)
    dp[0]=1
    dp[1]=1
    for (i in 2..n){
        dp[i]=add(dp[i-1],dp[i-2])
    }
    val dp2=IntArray(m+1)
    dp2[0]=1
    dp2[1]=1
    for (i in 2..m){
        dp2[i]=add(dp2[i-1],dp2[i-2])
    }

    out.println(mul(2,sub(add(dp[n],dp2[m]),1)))

    out.close()

}

internal class InputReader(stream: InputStream) {
    var reader: BufferedReader
    var tokenizer: StringTokenizer? = null

    init {
        reader = BufferedReader(InputStreamReader(stream), 32768)
        tokenizer = null
    }

    operator fun next(): String {
        while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return next().toLong()
    }

}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING")

import java.io.PrintWriter
import java.util.StringTokenizer
import java.util.TreeMap
import java.util.TreeSet
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln // immediate println for interactive

fun main() {
    output {
        val n = readInt()
        val m = readInt()

        val F = ModIntArray(max(n, m) + 1)
        F[0] = ModInt(1)
        F[1] = ModInt(1)

        for(i in 2..F.lastIndex) {
            F[i] = F[i-1] + F[i-2]
        }

        val ans = (F[n] + F[m] - 1) * 2

        println(ans)
    }
}

const val BILLION7 = 1e9.toInt() + 7
const val MODINT_BASE = BILLION7
const val MODINT_TOTIENT = MODINT_BASE - 1 // assumes MODINT_BASE is prime

inline infix fun Int.umod(base: Int) = Math.floorMod(this, base)
inline infix fun Long.umod(base: Long) = Math.floorMod(this, base)
inline infix fun Long.umod(base: Int) = Math.floorMod(this, base.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = (toLong() * other).umod(mod)

fun Int.powMod(exponent: Int, mod: Int): Int {
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MODINT_BASE)
inline fun Long.toModInt() = ModInt(this umod MODINT_BASE)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    inline operator fun plus(other: ModInt) = plus(other.int) // MODINT_BASE < 2^30
    inline operator fun plus(other: Int) =  (int + other).toModInt() // careful of possible overflow
    inline operator fun inc() = plus(1)

    inline operator fun minus(other: ModInt) = minus(other.int)
    inline operator fun minus(other: Int) = (int - other).toModInt()
    inline operator fun dec() = minus(1)
    operator fun unaryMinus() = if(int == 0) this else ModInt(MODINT_BASE - int)

    inline operator fun times(other: ModInt) = times(other.int)
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODINT_BASE))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) exponent umod MODINT_TOTIENT else exponent
        return ModInt(int.powMod(e, MODINT_BASE))
    }

    fun pow(exponent: Long) = pow(exponent umod MODINT_TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(MODINT_TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

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

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override fun contains(element: ModInt): Boolean = any { it == element }

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }
}
fun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))
inline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) =
    ModIntArray(IntArray(capacity) { init(it).int })

fun Iterable<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Sequence<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Iterable<ModInt>.product() = fold(ModInt(1), ModInt::times)
fun Sequence<ModInt>.product() = fold(ModInt(1), ModInt::times)

/** IO code start */
@JvmField val _reader = System.`in`.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

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

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()


val MOD = 1000000007L

fun mod(x: Long) = (x % MOD + MOD) % MOD

tailrec fun fib(n: Int, a: Long = 1, b: Long = 1): Long =
    if (n == 0) a
    else fib(n - 1, b, mod(a + b))

fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }

    println(mod(2L * mod(fib(n) + fib(m) - 1)))
}


fun main() {
    val (x1, x2) = readInts()
    val n = minOf(x1, x2)
    val m = maxOf(x1, x2)
    val fib = LongArray(m + 1)
    fib[0] = 1
    fib[1] = 1
    for(i in 2..m) {
        fib[i] = (fib[i - 1] + fib[i - 2]) % mod
    }
    val f0 = LongArray(n + 1)
    f0[1] = fib[m - n + 1]
    for (i in 2..n) {
        f0[i] = (f0[i - 1] + fib[i - 2] + fib[m - n + i - 2]) % mod
    }
    println((f0[n] * 2) % mod)
}

private val mod = 1000000007L

private fun readString() = readLine()!!

private fun readInt() = readString().toInt()

private fun readInts() = readString().split(" ").map { it.toInt() }

private fun readLong() = readString().toLong()

private fun readLongs() = readString().split(" ").map { it.toLong() }


import java.util.Scanner
import kotlin.math.ceil
import kotlin.math.sqrt

fun main(args : Array<String>) {

    val reader = Scanner(System.`in`)
    var x: Int = reader.nextInt()
    var y: Int = reader.nextInt()

    var a  = x.toDouble()
    var b  = y.toDouble()
    var r = sqrt(a*a+b*b)

    if((x>=0 && y>=0) || (x<=0 && y<=0) ){
        if (ceil(r).toInt() == r.toInt() || ceil(r).toInt() % 2 == 1) {
            println("black")
        } else if (ceil(r).toInt() % 2 == 0) {
            println("white")
        }
    }
    else{
        if (ceil(r).toInt() == r.toInt() || ceil(r).toInt() % 2 == 0 ) {
            println("black")
        } else if (ceil(r).toInt() % 2 == 1) {
            println("white")
        }
    }

}


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

    readLine()
    val sizes = readInts().toSet().toList().sorted()
    for (pos in 0 until sizes.size - 2)
        if (sizes[pos] + 1 == sizes[pos + 1] && sizes[pos] + 2 == sizes[pos + 2]) return print("YES")
    print("NO")
}


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

const val INPUT_FILE_NAME = "input"
const val OUTPUT_FILE_NAME = "output"

fun main(args: Array<String>) {
    solve(System.`in`, System.out)
//    solve(FileInputStream("$INPUT_FILE_NAME.txt"), FileOutputStream("$OUTPUT_FILE_NAME.txt"))
}

val MAX_N = (1e6 + 10).toInt()
val INF = (1e9 + 7).toInt()
val MOD = (1e9 + 7).toInt()

fun solve(input: InputStream, output: OutputStream) {
    val reader = InputReader(BufferedInputStream(input))
    val writer = PrintWriter(BufferedOutputStream(output))

    solve(reader, writer)
    writer.close()
}

fun solve(reader: InputReader, writer: PrintWriter) {
    val n = reader.nextInt()
    val b = BooleanArray(1001)
    reader.nextArrayInt(n).forEach { b[it] = true }
    for (i in 1..998) {
        if (b[i] && b[i + 1] && b[i + 2]) {
            writer.println("YES")
            return
        }
    }
    writer.println("NO")
}

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

class InputReader(stream: InputStream) {
    private val reader = BufferedReader(InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer? = null

    operator fun next(): String {
        while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }

    fun nextArrayInt(count: Int): IntArray {
        return nextArrayInt(0, count)
    }

    fun nextArrayInt(start: Int, count: Int): IntArray {
        val a = IntArray(start + count)
        for (i in start until start + count) {
            a[i] = nextInt()
        }
        return a
    }

    fun nextArrayLong(count: Int): LongArray {
        val a = LongArray(count)
        for (i in 0 until count) {
            a[i] = nextLong()
        }
        return a
    }
}


fun main() {
    val cmd = readLine()!!
    val direction = mutableMapOf(
        'L' to Pair(-1, 0),
        'R' to Pair(1, 0),
        'U' to Pair(0, -1),
        'D' to Pair(0, 1)
    )
    val path = mutableListOf(Pair(0, 0))
    var x = 0
    var y = 0
    var i = 0
    for (step in cmd) {
        x += direction[step]!!.first
        y += direction[step]!!.second
        i++
        if (path.contains(Pair(x, y))) {
            println("BUG")
            return
        }
        path.add(Pair(x, y))
    }
    val bfs = mutableListOf(Pair(Pair(0, 0), 0))
    val visited = mutableSetOf<Pair<Int, Int>>()
    while (bfs.isNotEmpty()) {
        val front = bfs.first()
        if (front.first == Pair(x, y) && front.second < cmd.length) {
            println("BUG")
            return
        }
        bfs.removeAt(0)
        for (d in direction.values) {
            val nx = front.first.first + d.first
            val ny = front.first.second + d.second
            val cell = Pair(nx, ny)
            if (!visited.contains(cell) && path.contains(cell)) {
                val ns = front.second + 1
                visited.add(Pair(nx, ny))
                bfs.add(Pair(Pair(nx, ny), ns))
            }
        }
    }
    println("OK")
}