import java.io.*
import java.util.*
import kotlin.Comparator

class Solution : Runnable {
    override fun run() {
        solve()
    }

    fun start() {
        Thread(null, Solution(), "whatever", (1 shl 27).toLong()).start()
    }
}

fun main(args: Array<String>) {
    Solution().start()
}

class IO {
    companion object {

        private val reader: InputReader
        private val writer: OutputWriter

        init {
            if (System.getProperty("ONLINE_JUDGE") == null) {
                reader = InputReader(FileInputStream("/Users/300041735/competitiveProgramming/src/codeforces/in.txt"))
                writer = OutputWriter(FileOutputStream("/Users/300041735/competitiveProgramming/src/codeforces/out.txt"))
            } else {
                reader = InputReader(System.`in`)
                writer = OutputWriter(System.`out`)
            }
        }

        private fun readMultipleInts(count: Int): List<Int> {
            val map = mutableListOf<Int>()
            repeat(count) {
                map.add(reader.readInt())
            }
            return map
        }

        fun readInt() = reader.readInt()
        fun readLong() = reader.readLong()
        fun readTwoInts() = readMultipleInts(2)
        fun readThreeInts() = readMultipleInts(3)
        fun readFourInts() = readMultipleInts(4)
        fun readFiveInts() = readMultipleInts(5)
        fun readSixInts() = readMultipleInts(6)
        fun readString() = reader.readString()
        fun readTree(n: Int): MutableMap<Int, MutableList<Int>> {
            val graph = mutableMapOf<Int, MutableList<Int>>()
            repeat(n - 1) {
                val u = reader.readInt()
                val v = reader.readInt()
                if (!graph.containsKey(u)) graph[u] = mutableListOf()
                graph[u]!!.add(v)
            }
            return graph
        }

        fun readIntArray(n: Int): IntArray {
            return IntArray(n) { readInt() }
        }

        fun readLongArray(n: Int): Array<Long> {
            return Array(n) { readLong() }
        }

        fun write(obj: Any) {
            writer.printLine(obj)
        }

        fun flushOutput() {
            writer.flush()
        }

        fun closeOutput() {
            writer.close()
        }
    }
}

class MATH {
    companion object {

        val mod = 998244353
        var ispre = false

        val factMod = Array(300002) { 1 }

        fun pre() {
            for (i in 2 until 300001) {
                factMod[i] = ((factMod[i - 1] * i.toLong()) % MATH.mod).toInt()
            }
        }

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

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

        fun inverseMod(a: Int): Int {
            return powMod(a, mod - 2)
        }

        fun powMod(a: Int, b: Int): Int {
            //calculate a to the power b mod m
            if (b == 0) return 1
            return if (b % 2 == 1) {
                prodMod(a, powMod(a, b - 1))
            } else {
                val p = powMod(a, b / 2)
                prodMod(p, p)
            }
        }

        fun ncr(n: Int, r: Int): Int {
            if (!ispre) pre(); ispre = true
            return ((factMod[n].toLong() * inverseMod(((factMod[r].toLong() * factMod[n - r]) % mod).toInt())) % mod).toInt()
        }

        fun prodMod(val1: Int, val2: Int): Int {
            return ((val1.toLong() * val2) % mod).toInt()
        }

    }
}

fun solve() {

    val n = IO.readInt()
    if (n%2 == 0){
        IO.write("white")
        IO.write("1 2")
    }else{
        IO.write("black")
    }

    IO.flushOutput()
    IO.closeOutput()
}

class SuffixArray(val input : String){
    //time complexity is n(log(n))^2

    fun sa() : IntArray{
        val n = input.length
        var cur = IntArray(n) { i -> input[i] -'a' } //will store the current sort order
        for (i in 1 until 20){
            val newCur = IntArray(n) { 0 }
            val newlist = mutableListOf<Triple<Int, Int, Int>>()
            for (j in 0 until n) {
                newlist.add(Triple(j, cur[j], if ( j+ power(2, i) < n) cur[j + power(2, i)] else -1))
            }
            newlist.sortWith(comparator())
            //after sorting
            for (j in 0 until n){
                newCur[newlist[j].first] = if (j > 0 && newlist[j].second == newlist[j - 1].second && newlist[j].third == newlist[j - 1].third) newCur[newlist[j - 1].first] else j
            }
            cur =  newCur

        }
        return cur
    }

    internal class comparator : Comparator<Triple<Int, Int, Int>>{
        override fun compare(o1: Triple<Int, Int, Int>?, o2: Triple<Int, Int, Int>?): Int {
            if (o1!!.second != o2!!.second){
                return o1.second.compareTo(o2.second)
            }else{
                //both are equal what to do now
                return o1.third.compareTo(o2.third)
            }
        }
    }

}

class Primes{
    val limit = 1000
    val composites = IntArray(limit + 1) { 0 }
    val factors= IntArray(limit + 1) { 0 }
    val preFactors = IntArray(limit + 1) { 0 }
    val primes  = mutableListOf<Int>()

    init {
        sieve()
        calcFactors()
    }

    fun sieve(){
        for (i in 2 until limit + 1){
            if (composites[i] == 0){
                primes.add(i)
                var cur = 1
                while (cur*i <= limit){
                    composites[cur*i] = i
                    cur++
                }
            }
        }
    }

    fun calcFactors(){
        for (i in 2 until limit + 1){
            var num = i
            while (num != 1){
                factors[i]++
                num /= composites[num]
            }
        }
        for (i in 2 until limit + 1){
            preFactors[i]= preFactors[i - 1] + factors[i]
        }
    }
}

fun isBitSet(num: Int, i: Int): Boolean {
    return (num.and(1.shl(i)) > 0)
}

fun power(i: Int, j: Int): Int {
    if (j == 0) return 1
    return i * power(i, j - 1)
}

class MinSegmentTree(
        input: Array<Int>
) {
    private val tree: Array<Int>
    private val lazy: Array<Int>

    constructor(size: Int) : this(Array(size) { Int.MAX_VALUE })

    init {
        val size = nextPowerOfTwo(input.size)
        tree = Array(2 * size) { Int.MAX_VALUE }
        lazy = Array(2 * size) { Int.MAX_VALUE }
        for (i in 0 until input.size) {
            tree[i + size] = input[i]
        }
        for (i in (size - 1) downTo 1) {
            tree[i] = Math.min(tree[leftChild(i)], tree[rightChild(i)])
        }
    }

    private fun updateTree(lowerRange: Int, upperRange: Int, lowerBound: Int, upperBound: Int, index: Int, value: Int) {
        updateLazyNode(index, lowerBound, upperBound, lazy[index])
        if (noOverlap(lowerRange, upperRange, lowerBound, upperBound)) return
        else if (completeOverlap(lowerRange, upperRange, lowerBound, upperBound)) updateLazyNode(index, lowerBound, upperBound, value)
        else {
            updateTree(lowerRange, upperRange, lowerBound, midIndex(lowerBound, upperBound), leftChild(index), value)
            updateTree(lowerRange, upperRange, midIndex(lowerBound, upperBound) + 1, upperBound, rightChild(index), value)
            tree[index] = Math.min(tree[leftChild(index)], tree[rightChild(index)])
        }
    }

    private fun queryTree(lowerRange: Int, upperRange: Int, lowerBound: Int, upperBound: Int, index: Int): Int {
        updateLazyNode(index, lowerBound, upperBound, lazy[index])
        if (noOverlap(lowerRange, upperRange, lowerBound, upperBound)) return Int.MAX_VALUE
        else if (completeOverlap(lowerRange, upperRange, lowerBound, upperBound)) return tree[index]
        else {
            return Math.min(queryTree(lowerRange, upperRange, lowerBound, midIndex(lowerBound, upperBound), leftChild(index)),
                    queryTree(lowerRange, upperRange, midIndex(lowerBound, upperBound) + 1, upperBound, rightChild(index)))
        }
    }

    private fun updateLazyNode(index: Int, lowerBound: Int, upperBound: Int, delta: Int) {
        tree[index] += delta
        if (lowerBound != upperBound) {
            lazy[leftChild(index)] += delta
            lazy[rightChild(index)] += delta
        }
        lazy[index] = 0
    }

    fun getElements(N: Int): List<Int> {
        return tree.copyOfRange(tree.size / 2, tree.size / 2 + N).asList()
    }

    fun update(lowerRange: Int, upperRange: Int, value: Int) {
        updateTree(lowerRange, upperRange, 1, lazy.size / 2, 1, value)
    }

    fun query(lowerRange: Int, upperRange: Int): Int {
        return queryTree(lowerRange, upperRange, 1, lazy.size / 2, 1)
    }

    private fun noOverlap(l: Int, u: Int, lb: Int, ub: Int): Boolean = (lb > u || ub < l)

    private fun completeOverlap(l: Int, u: Int, lb: Int, ub: Int): Boolean = (lb >= l && ub <= u)

    private fun nextPowerOfTwo(num: Int): Int {
        var exponent = 2
        while (true) {
            if (exponent >= num) {
                return exponent
            }
            exponent *= 2
        }
    }

    private fun midIndex(l: Int, r: Int) = (l + r) / 2
    private fun parent(i: Int) = i / 2
    private fun leftChild(i: Int) = 2 * i
    private fun rightChild(i: Int) = 2 * i + 1

}

class InputReader(private val stream: InputStream) {
    private val buf = ByteArray(1024)
    private var curChar: Int = 0
    private var numChars: Int = 0
    private val filter: SpaceCharFilter? = null

    fun read(): Int {
        if (numChars == -1)
            throw InputMismatchException()
        if (curChar >= numChars) {
            curChar = 0
            try {
                numChars = stream.read(buf)
            } catch (e: IOException) {
                throw InputMismatchException()
            }

            if (numChars <= 0)
                return -1
        }
        return buf[curChar++].toInt()
    }

    fun readInt(): Int {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        var sgn = 1
        if (c == '-'.toInt()) {
            sgn = -1
            c = read()
        }
        var res = 0
        do {
            if (c < '0'.toInt() || c > '9'.toInt())
                throw InputMismatchException()
            res *= 10
            res += c - '0'.toInt()
            c = read()
        } while (!isSpaceChar(c))
        return res * sgn
    }

    fun readLong(): Long {
        var c = read()
        while (isSpaceChar(c)) {
            c = read()
        }
        var sgn: Long = 1
        if (c == '-'.toInt()) {
            sgn = -1
            c = read()
        }
        var number: Long = 0
        do {
            number *= 10L
            number += (c - '0'.toInt()).toLong()
            c = read()
        } while (!isSpaceChar(c))
        return number * sgn
    }

    fun readString(): String {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        val res = StringBuilder()
        do {
            res.appendCodePoint(c)
            c = read()
        } while (!isSpaceChar(c))
        return res.toString()
    }

    fun isSpaceChar(c: Int): Boolean {
        return filter?.isSpaceChar(c)
                ?: (c == ' '.toInt() || c == '\n'.toInt() || c == '\r'.toInt() || c == '\t'.toInt() || c == -1)
    }

    operator fun next(): String {
        return readString()
    }

    interface SpaceCharFilter {
        fun isSpaceChar(ch: Int): Boolean
    }
}

class OutputWriter {
    private val writer: PrintWriter

    constructor(outputStream: OutputStream) {
        writer = PrintWriter(BufferedWriter(OutputStreamWriter(outputStream)))
    }

    constructor(writer: Writer) {
        this.writer = PrintWriter(writer)
    }

    fun print(vararg objects: Any) {
        for (i in objects.indices) {
            if (i != 0)
                writer.print(' ')
            writer.print(objects[i])
        }
    }

    fun printLine(vararg objects: Any) {
        print(*objects)
        writer.println()
    }

    fun close() {
        writer.close()
    }

    fun flush() {
        writer.flush()
    }

}

class DinitzMaxFlowSolver(val n: Int, val s: Int, val t: Int, val graph: MutableMap<Int, MutableList<Edge>>, val edgeMap: MutableMap<Pair<Int, Int>, Edge>) {

    private val level = IntArray(n + 1) { -1 }  //storing levels of each vertex in level graph
    var maxFlow = 0L

    init {
        solve()
    }

    fun solve() {
        val next = IntArray(n + 1) { 0 }
        while (bfs()) {
            Arrays.fill(next, 0)
            var flow = 0L
            do {
                maxFlow += flow
                flow = dfs(s, next, Long.MAX_VALUE)
            } while (flow != 0L)
        }
    }

    private fun dfs(at: Int, next: IntArray, flow: Long): Long {
        if (at == t) return flow
        var size = 0
        if (graph.containsKey(at)) size = graph[at]!!.size
        while (next[at] < size) {
            val edge = graph[at]!!.get(next[at])
            if (edge.remainingCapacity() > 0 && level[edge.to] == level[at] + 1) {
                val bottleNeck = dfs(edge.to, next, Math.min(flow, edge.remainingCapacity()))
                if (bottleNeck > 0) {
                    edgeMap[Pair(edge.from, edge.to)]!!.flow += bottleNeck
                    edgeMap[Pair(edge.to, edge.from)]!!.flow -= bottleNeck
                    return bottleNeck
                }
            }
            next[at]++
        }
        return 0
    }

    private fun bfs(): Boolean {
        Arrays.fill(level, -1)
        val curLevel = ArrayDeque<Int>()
        curLevel.add(s)
        level[s] = 0

        while (curLevel.isNotEmpty()) {
            val top = curLevel.poll()
            if (graph.containsKey(top)) {
                graph[top]!!.forEach {
                    if (it.remainingCapacity() > 0 && level[it.to] == -1) {
                        level[it.to] = level[top] + 1
                        curLevel.offer(it.to)
                    }
                }
            }
        }
        return level[t] != -1
    }

}

class Edge(val from: Int, val to: Int, val capacity: Long) {
    var flow = 0L
    fun remainingCapacity(): Long {
        return capacity - flow
    }
}

class ConnectedComponents(val g : Graph, val price : IntArray){

    private val visited = HashSet<Int>()
    private val stack = Stack<Int>()
    private val revertedGraph = revertGraph()
    private val component = mutableListOf<Int>()
    var ways= 1L
    var min = 0L
    val mod = 1000000007

    init {
        getConnectedComponents()
    }

    fun getConnectedComponents() {
        g.vertices.forEach {
            if (!visited.contains(it)){
                visited.add(it)
                dfs(it)
            }
        }

        visited.clear()
        while (stack.isNotEmpty()){
            val node = stack.pop()
            if (!visited.contains(node)){
                visited.add(node)
                dfs2(node)
                var take = Int.MAX_VALUE
                for (i in 0 until component.size){
                    if (price[component[i] - 1] < take){
                        take = price[component[i] - 1]
                    }
                }
                min+= take
                ways= (ways*component.filter { price[it - 1] == take }.count())%mod
                component.clear()
            }
        }
    }

    fun dfs(node : Int){
        if (g.edges.containsKey(node)){
            g.edges[node]!!.forEach {
                if (!visited.contains(it)){
                    visited.add(it)
                    dfs(it)
                }
            }
        }
        stack.push(node)
    }

    fun dfs2(node : Int){
        component.add(node)
        if (revertedGraph.edges.containsKey(node)){
            revertedGraph.edges[node]!!.forEach {
                if (!visited.contains(it)){
                    visited.add(it)
                    dfs2(it)
                }
            }
        }
    }

    fun revertGraph() : Graph {
        val newEdges= mutableMapOf<Int, MutableList<Int>>()
        g.edges.forEach {
            val u = it.key
            val vs = it.value
            vs.forEach { v ->
                if (!newEdges.containsKey(v)){
                    newEdges[v]= mutableListOf()
                }
                newEdges[v]!!.add(u)
            }
        }
        return Graph(g.vertices, newEdges)
    }
}

data class Graph(val vertices: MutableList<Int>, val edges : MutableMap<Int, MutableList<Int>>)


fun main() {
    print(readLine()!!.toLong() / 2520)
}


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

val err = System.err
val bf = BufferedReader(InputStreamReader(System.`in`))
var st = StringTokenizer("")

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

fun nxtint() = nxtstring().toInt()

var n: Long = 0
val p10 = LongArray(11)

fun findmax9(): Int {
  var ans = 0
  var num = 0L
  while (true) {
    val ldn = n / p10[ans] % 10
    val od = 9 - ldn
    num += p10[ans] * od
    if (num > n) break
    ++ans
  }
  return ans
}

fun main(args: Array<String>) {
  n = nxtint().toLong()
  p10[0] = 1
  for (i in 1..10) p10[i] = p10[i - 1] * 10
  val max9 = findmax9()
  if (max9 == 0) {
    println(n * (n - 1) / 2)
    return
  }
  var t = 0
  var ans = 0L
  while (true) {
    var num = p10[max9] * t + p10[max9] - 1
    ++t
    var l = 1
    var r = n.toInt()
    while (l < r) {
      var mid: Int = l + (r - l) / 2
      if (num - mid > n) l = mid + 1
      else r = mid
    }
    //err.printf("%d %d\n", num, l)
    if (num - l <= l || num - l > n) break
    val cnt: Long = num - l - l + 1
    ans += cnt / 2
  }
  println(ans)
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.Math.*
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val n = sc.nextLong()

    var nine = 0L
    while (true) {
        if (2 * n - 1 < nine * 10 + 9) break
        nine = nine * 10 + 9
    }

    if (nine == 0L) {
        println(n * (n - 1) / 2)
        return
    }

    val nines = (0 until 9).map { (nine + 1) * it + nine }
    val sum = nines.map { count(it, n) }.sum()

    println(sum / 2)
}

fun count(nine: Long, n: Long): Long {
    val r1 = 1..n
    val r2 = (nine - n)..(nine - 1)

    return max(0, min(r1.endInclusive, r2.endInclusive) - max(r1.start, r2.start) + 1)
}

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

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

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val S = ns().map{it-'a'}.toIntArray()
    val T = ns().map{it-'a'}.toIntArray()
    val N = S.size
    ++S[N-1]
    for (i in N - 1 downTo 0) {
      if (S[i] == 26) {
        S[i] = 0
        ++S[i - 1]
      }
    }
    if (Arrays.equals(S, T)) {
      out.println("No such string")
    } else {
      out.println(S.map { 'a'+it }.joinToString(""))
    }
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun <A, B> pair(a: A, b: B) = RPair(a, b)
data class RPair<A, B>(val _1: A, val _2: B)

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


enum class SetType {
    EMPTY,
    LINE,
    WHOLE_FIELD
}

typealias Line = Triple<Int, Int, Int>

fun Line.setType(): SetType {
    if (first == 0 && second == 0 && third == 0) return SetType.WHOLE_FIELD
    if (first == 0 && second == 0) return SetType.EMPTY
    return SetType.LINE
}

fun calcDet(line1: Line, line2: Line) = line1.first * line2.second - line1.second * line2.first

fun calcIntersections(line1: Line, line2: Line): Int {
    if (line1.setType() == SetType.EMPTY || line2.setType() == SetType.EMPTY) return 0
    if (line1.setType() == SetType.WHOLE_FIELD || line2.setType() == SetType.WHOLE_FIELD) return -1
    val det = calcDet(line1, line2)
    return if (calcDet(line1, line2) != 0) 1 else 0
}

fun main(args: Array<String>) {
    val line1 = readLine()!!.split(" ").filter { it.isNotBlank() }.map { it.toInt() }.toIntArray()
    val line2 = readLine()!!.split(" ").filter { it.isNotBlank() }.map { it.toInt() }.toIntArray()

    val line1T = Triple(line1[0], line1[1], line1[2])
    val line2T = Triple(line2[0], line2[1], line2[2])

    println(calcIntersections(line1T, line2T))
}


enum class SetType {
    EMPTY,
    LINE,
    WHOLE_FIELD
}

typealias Line = Triple<Int, Int, Int>
fun Line.a() = first
fun Line.b() = second
fun Line.c() = third

fun Line.setType(): SetType {
    if (a() == 0 && b() == 0 && c() == 0) return SetType.WHOLE_FIELD
    if (a() == 0 && b() == 0) return SetType.EMPTY
    return SetType.LINE
}

fun calcDet(line1: Line, line2: Line) = line1.a() * line2.b() - line1.b() * line2.a()

fun calcIntersections(line1: Line, line2: Line): Int {
    if (line1.setType() == SetType.EMPTY || line2.setType() == SetType.EMPTY) return 0
    if (line1.setType() == SetType.WHOLE_FIELD || line2.setType() == SetType.WHOLE_FIELD) return -1
    val det = calcDet(line1, line2)
    if (det != 0) return 1

    return if (line1.first != 0) {
        val c1f = line1.c() * line2.a()
        val c2f = line2.c() * line1.a()
        if (c1f == c2f) -1 else 0
    } else {
        val c1f = line1.c() * line2.b()
        val c2f = line2.c() * line1.b()
        if (c1f == c2f) -1 else 0
    }
}

fun main(args: Array<String>) {
    val line1 = readLine()!!.split(" ").filter { it.isNotBlank() }.map { it.toInt() }.toIntArray()
    val line2 = readLine()!!.split(" ").filter { it.isNotBlank() }.map { it.toInt() }.toIntArray()

    val line1T = Triple(line1[0], line1[1], line1[2])
    val line2T = Triple(line2[0], line2[1], line2[2])

    println(calcIntersections(line1T, line2T))
}


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

fun main() {
    val n0 = readLong()

    val M = LongArray(17)
    for(i in 1 until M.size) M[i] = M[i-1] * 10 + 1

    var D = hashMapOf(n0 to 0)

    for(k in M.size-2 downTo 1) {
        if(M[k] > n0) continue

        val Dk = HashMap<Long, Int>()

        for((n, c) in D) {
            Dk.checkMin(n % M[k], c + (n / M[k] * k).toInt())
            val n1 = M[k+1] - n
            Dk.checkMin(n1 % M[k], c + k + 1 + (n1 / M[k] * k).toInt())
        }

        D = Dk
    }

    val ans = D[0]

    println(ans)
}

fun <K> HashMap<K, Int>.checkMin(k: K, v: Int) { if(!containsKey(k) || v < get(k)!!) put(k, v) }

/** 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 readDoubles(n: Int) = List(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }

@JvmField val _writer = PrintWriter(System.out, false)
inline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }
fun iprintln(o: Any?) { println(o) } // immediate println for interactive, bypasses output{} blocks


import kotlin.math.min

val ones = ArrayList<Long>()

fun lowerBound(n: Long): Int{
    var(lo, hi) = 0 to ones.size - 1
    while(lo < hi){
        val mid = (lo + hi) / 2 + (lo + hi) % 2
        if(ones[mid] < n)
            lo = mid
        else
            hi = mid - 1
    }
    return lo
}

val memo = HashMap<Long, Long>()

fun rec(n: Long): Long{
    if(n in memo)
        return memo[n]!!
    val bs = lowerBound(n)
    if(ones[bs + 1] == n){
        memo[n] = (bs + 2).toLong()
        return (bs + 2).toLong()
    }
    var ans = Long.MAX_VALUE
    if(n - ones[bs] < n)
        ans = min(ans, rec(n - ones[bs]) + bs + 1)
    if(ones[bs + 1] - n < n)
        ans = min(ans, rec(ones[bs + 1] - n) + bs + 2)
    memo[n] = ans
    return ans
}

fun main() {
    val n = readLine()!!.toLong()
    for(i in 1..16)
        ones.add("1".repeat(i).toLong())
    memo[0L] = 0L
    for(i in 1L..6L)
        memo[i] = i
    for(i in 7L..11L)
        memo[i] = 13-i
    println(rec(n))
}


import kotlin.math.min

val ones = ArrayList<Long>()

fun lowerBound(n: Long): Int{
    var(lo, hi) = 0 to ones.size - 1
    while(lo < hi){
        val mid = (lo + hi) / 2 + (lo + hi) % 2
        if(ones[mid] < n)
            lo = mid
        else
            hi = mid - 1
    }
    return lo
}

fun rec(n: Long): Long{
    when {
        n == 0L -> return 0L
        n <= 6L -> return n
        n <= 11L -> return 13 - n
    }
    val bs = lowerBound(n)
    if(ones[bs + 1] == n)
        return (bs + 2).toLong()
    var ans = Long.MAX_VALUE
    if(n - ones[bs] < n)
        ans = min(ans, rec(n - ones[bs]) + bs + 1)
    if(ones[bs + 1] - n < n)
        ans = min(ans, rec(ones[bs + 1] - n) + bs + 2)
    return ans
}

fun main() {
    val n = readLine()!!.toLong()
    for(i in 1..16)
        ones.add("1".repeat(i).toLong())
    println(rec(n))
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val S = ns()
    val N = S.length
    val zero = 9
    val MAX = 19
    val INF = 1e9.toInt()
    val dp = Array(N + 1){IntArray(MAX){INF} }
    dp[0][zero] = 0
    for (i in 0 until N) {
      val target = S[N - 1 - i] - '0'
      for (next in 0 until MAX) {
        for (pre in 0 until MAX) {
          if (dp[i][pre] == INF) continue
          val roll = abs((next - zero) + target) // この桁まで
          val rollback = abs(next - pre - roll) // 前の桁を戻す
          val cost = roll * (i + 1) + rollback * i
          dp[i + 1][next] = min(dp[i + 1][next], dp[i][pre] + cost)
        }
      }
    }
    debugDim(dp)
    out.println(dp[N][zero])
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl()
    }
    return res
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


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

}


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


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

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

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val n = readInt()
    val s = readLn()
    val cand = listOf("vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon")

    val ans = cand.find { c -> c.length == n && c.indices.all { i -> s[i] == '.' || c[i] == s[i] } }

    println(ans)
}

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.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 readLines(n: Int) = List(n) { readLn() }
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(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> 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(0x594E215C123 * System.nanoTime()).also { _random = it }

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

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

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

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::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()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


import java.util.*

val scanner = Scanner(System.`in`)

fun readInt(): Int = scanner.nextInt()

fun readString(): String = scanner.next()

fun main() = StringBuilder(readString())
    .also { number ->
        var remainingMoves = readInt()
        var index = 0

        fun getNextMaxDigitIndex(): Int? {
            if (index == number.lastIndex) return null
            var j = 1
            var maxIndex = index + j
            var maxDigit = number[maxIndex].toInt()
            repeat(remainingMoves - 1) {
                number.getOrNull(index + ++j)?.toInt()?.let { digit ->
                    if (digit > maxDigit) {
                        maxIndex = index + j
                        maxDigit = digit
                    }
                }
            }
            return if (number[maxIndex].toInt() > number[index].toInt()) maxIndex else null
        }

        while (index < number.length && remainingMoves > 0) {
            getNextMaxDigitIndex()?.let { nextMaxDigitIndex ->
                val maxDigit = number[nextMaxDigitIndex]
                number.deleteCharAt(nextMaxDigitIndex)
                number.insert(index, maxDigit)
                remainingMoves -= nextMaxDigitIndex - index
            }
            index++
        }
    }
    .run(::println)


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

fun main(args: Array<String>) {
    solve(System.`in`, System.out)
}

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 s = reader.next()

    var i = 0
    var ans = n
    while (i + 1 < n) {
        if (s[i] == 'R' && s[i + 1] == 'U' || s[i] == 'U' && s[i + 1] == 'R') {
            ans--
            i++
        }
        i++
    }
    writer.println(ans)
}

class InputReader(stream: InputStream) {
    val 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 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(args: Array<String>) {
        val n = readLine()!!.toInt()
        var s = ""
        do {
            s = readLine()!!
        } while (s.length != n)
        val r = s.replace("UR|RU".toRegex(), "D")
        println(r.length)
}


fun main(args: Array<String>) {
    val toInt = readLine()!!.toInt()
    var previous = 'D'
    var count = 0
    val readLine = readLine()!!
    readLine.forEach { c ->
        previous = if (previous != 'D' && c != previous) {
            count++
            'D'
        } else {
            c
        }
    }
    println(readLine.length - count)

}


fun main() {
    readLine()
    val s = readLine()!!
    if (s.length == 1) return print(1)
    var pos = -1
    var sol = 0
    while (++pos < s.length) {
        sol++
        if (pos < s.lastIndex && s[pos] != s[pos + 1]) pos++
    }
    print(sol)
}


import java.util.*

fun main(args: Array<String>) {
    Scanner(System.`in`.buffered()).use {
        val n = it.nextInt()
        val s = it.next()

        var ans = s.length
        var i = 0
        while (i < s.length - 1) {
            if ((s[i] == 'U' && s[i + 1] == 'R') || (s[i] == 'R' && s[i + 1] == 'U')) {
                --ans
                i += 2
            } else
                i++
        }

        println(ans)
    }
}


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

fun main(args: Array<String>) {
    solve(System.`in`, System.out)
}

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 s = reader.next()

    var i = 0
    var ans = 0
    while (i + 1 < n) {
        if (s[i] == 'U' && s[i + 1] == 'R') {
            ans++
            i++
        } else if (s[i] == 'R' && s[i + 1] == 'U') {
            ans++
        }

        i++
    }
    ans = n - ans
    writer.println(ans)
}

class InputReader(stream: InputStream) {
    val 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 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
    }
}


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

class Solution : Runnable {
    override fun run() {
        solve()
    }

    fun start() {
        Thread(null, Solution(), "whatever", (1 shl 27).toLong()).start()
    }
}

fun main(args: Array<String>) {
    Solution().start()
}

class IO {
    companion object {

        private val reader: InputReader
        private val writer: OutputWriter

        init {
            if (System.getProperty("ONLINE_JUDGE") == null  ) {
                reader = InputReader(FileInputStream("/Users/300041735/competitiveProgramming/src/codeforces/in.txt"))
                writer = OutputWriter(FileOutputStream("/Users/300041735/competitiveProgramming/src/codeforces/out.txt"))
            } else {
                reader = InputReader(System.`in`)
                writer = OutputWriter(System.`out`)
            }
        }

        private fun readMultipleInts(count: Int): List<Int> {
            val map = mutableListOf<Int>()
            repeat(count) {
                map.add(reader.readInt())
            }
            return map
        }

        fun readInt() = reader.readInt()
        fun readLong() = reader.readLong()
        fun readTwoInts() = readMultipleInts(2)
        fun readThreeInts() = readMultipleInts(3)
        fun readFourInts() = readMultipleInts(4)
        fun readFiveInts() = readMultipleInts(5)
        fun readSixInts() = readMultipleInts(6)
        fun readString() = reader.readString()
        fun readTree(n: Int): MutableMap<Int, MutableList<Int>> {
            val graph = mutableMapOf<Int, MutableList<Int>>()
            repeat(n - 1) {
                val u = reader.readInt()
                val v = reader.readInt()
                if (!graph.containsKey(u)) graph[u] = mutableListOf()
                if (!graph.containsKey(v)) graph[v] = mutableListOf()
                graph[u]!!.add(v)
                graph[v]!!.add(u)
            }
            return graph
        }

        fun readIntArray(n: Int): IntArray {
            return IntArray(n) { readInt() }
        }

        fun readLongArray(n: Int): Array<Long> {
            return Array(n) { readLong() }
        }

        fun write(obj: Any) {
            writer.printLine(obj)
        }

        fun flushOutput() {
            writer.flush()
        }

        fun closeOutput() {
            writer.close()
        }
    }
}

class MATH {
    companion object {

        val mod = 1000000007
        var ispre = false

        val factMod = Array(300002) { 1 }

        fun pre() {
            for (i in 2 until 300001) {
                factMod[i] = ((factMod[i - 1] * i.toLong()) % MATH.mod).toInt()
            }
        }

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

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

        fun inverseMod(a: Int): Int {
            return powMod(a, mod - 2)
        }

        fun powMod(a: Int, b: Int): Int {
            //calculate a to the power b mod m
            if (b == 0) return 1
            return if (b % 2 == 1) {
                prodMod(a, powMod(a, b - 1))
            } else {
                val p = powMod(a, b / 2)
                prodMod(p, p)
            }
        }

        fun ncr(n: Int, r: Int): Int {
            if (!ispre) pre(); ispre = true
            return ((factMod[n].toLong() * inverseMod(((factMod[r].toLong() * factMod[n - r]) % mod).toInt())) % mod).toInt()
        }

        fun prodMod(val1: Int, val2: Int): Int {
            return ((val1.toLong() * val2) % mod).toInt()
        }

    }
}

fun solve() {

    val (n1, n2, k1, k2) = IO.readFourInts()
    val dp = DP(n1, n2, k1,k2)
    IO.write(dp.dp(1, 0, 0, 0 ))

    IO.flushOutput()
    IO.closeOutput()
}

class DP(val n1 : Int, val n2 : Int, val k1 : Int,val  k2 : Int){

    val map = Array(201) { Array(101) { Array(11) { IntArray(11) { -1 } } } }

    fun dp(pos : Int, horses : Int, lastHorses : Int, lastMen : Int) : Int {
        //dp[pos][horses already placed][last placed horsed][last placed men]  200*100*10*10 ~ 2 million states , should be okay
        //possible optimisation if we get TLE dp[pos][horses already placed][last placed whom ?][quantity] 200*100*2*10  ~ 0.4 million states

        if (pos == n1 + n2 + 1) return 1

        if (map[pos][horses][lastHorses][lastMen] != -1) return map[pos][horses][lastHorses][lastMen]
        val horsesRemaingToBePlaced = n2 - horses
        val footMenRemainingToBePlaced = n1 - (pos - 1 - horses)

        var ways= 0

        if (horsesRemaingToBePlaced != 0 && lastHorses < k2){
            //horse can be placed
            ways+= dp(pos + 1, horses + 1, lastHorses + 1, 0 )
        }
        if (footMenRemainingToBePlaced != 0 && lastMen < k1){
            ways+= dp(pos + 1, horses, 0, lastMen + 1)
        }

        map[pos][horses][lastHorses][lastMen] = ways
        return ways
    }
}

data class Graph(val edges: MutableMap<Int, MutableList<Int>>)

class MinSegmentTree(
        input: Array<Int>
) {
    private val tree: Array<Int>
    private val lazy: Array<Int>

    constructor(size: Int) : this(Array(size) { Int.MAX_VALUE })

    init {
        val size = nextPowerOfTwo(input.size)
        tree = Array(2 * size) { Int.MAX_VALUE }
        lazy = Array(2 * size) { Int.MAX_VALUE }
        for (i in 0 until input.size) {
            tree[i + size] = input[i]
        }
        for (i in (size - 1) downTo 1) {
            tree[i] = Math.min(tree[leftChild(i)], tree[rightChild(i)])
        }
    }

    private fun updateTree(lowerRange: Int, upperRange: Int, lowerBound: Int, upperBound: Int, index: Int, value: Int) {
        updateLazyNode(index, lowerBound, upperBound, lazy[index])
        if (noOverlap(lowerRange, upperRange, lowerBound, upperBound)) return
        else if (completeOverlap(lowerRange, upperRange, lowerBound, upperBound)) updateLazyNode(index, lowerBound, upperBound, value)
        else {
            updateTree(lowerRange, upperRange, lowerBound, midIndex(lowerBound, upperBound), leftChild(index), value)
            updateTree(lowerRange, upperRange, midIndex(lowerBound, upperBound) + 1, upperBound, rightChild(index), value)
            tree[index] = Math.min(tree[leftChild(index)], tree[rightChild(index)])
        }
    }

    private fun queryTree(lowerRange: Int, upperRange: Int, lowerBound: Int, upperBound: Int, index: Int): Int {
        updateLazyNode(index, lowerBound, upperBound, lazy[index])
        if (noOverlap(lowerRange, upperRange, lowerBound, upperBound)) return Int.MAX_VALUE
        else if (completeOverlap(lowerRange, upperRange, lowerBound, upperBound)) return tree[index]
        else {
            return Math.min(queryTree(lowerRange, upperRange, lowerBound, midIndex(lowerBound, upperBound), leftChild(index)),
                    queryTree(lowerRange, upperRange, midIndex(lowerBound, upperBound) + 1, upperBound, rightChild(index)))
        }
    }

    private fun updateLazyNode(index: Int, lowerBound: Int, upperBound: Int, delta: Int) {
        tree[index] += delta
        if (lowerBound != upperBound) {
            lazy[leftChild(index)] += delta
            lazy[rightChild(index)] += delta
        }
        lazy[index] = 0
    }

    fun getElements(N: Int): List<Int> {
        return tree.copyOfRange(tree.size / 2, tree.size / 2 + N).asList()
    }

    fun update(lowerRange: Int, upperRange: Int, value: Int) {
        updateTree(lowerRange, upperRange, 1, lazy.size / 2, 1, value)
    }

    fun query(lowerRange: Int, upperRange: Int): Int {
        return queryTree(lowerRange, upperRange, 1, lazy.size / 2, 1)
    }

    private fun noOverlap(l: Int, u: Int, lb: Int, ub: Int): Boolean = (lb > u || ub < l)

    private fun completeOverlap(l: Int, u: Int, lb: Int, ub: Int): Boolean = (lb >= l && ub <= u)

    private fun nextPowerOfTwo(num: Int): Int {
        var exponent = 2
        while (true) {
            if (exponent >= num) {
                return exponent
            }
            exponent *= 2
        }
    }

    private fun midIndex(l: Int, r: Int) = (l + r) / 2
    private fun parent(i: Int) = i / 2
    private fun leftChild(i: Int) = 2 * i
    private fun rightChild(i: Int) = 2 * i + 1

}

class InputReader(private val stream: InputStream) {
    private val buf = ByteArray(1024)
    private var curChar: Int = 0
    private var numChars: Int = 0
    private val filter: SpaceCharFilter? = null

    fun read(): Int {
        if (numChars == -1)
            throw InputMismatchException()
        if (curChar >= numChars) {
            curChar = 0
            try {
                numChars = stream.read(buf)
            } catch (e: IOException) {
                throw InputMismatchException()
            }

            if (numChars <= 0)
                return -1
        }
        return buf[curChar++].toInt()
    }

    fun readInt(): Int {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        var sgn = 1
        if (c == '-'.toInt()) {
            sgn = -1
            c = read()
        }
        var res = 0
        do {
            if (c < '0'.toInt() || c > '9'.toInt())
                throw InputMismatchException()
            res *= 10
            res += c - '0'.toInt()
            c = read()
        } while (!isSpaceChar(c))
        return res * sgn
    }

    fun readLong(): Long {
        var c = read()
        while (isSpaceChar(c)) {
            c = read()
        }
        var sgn: Long = 1
        if (c == '-'.toInt()) {
            sgn = -1
            c = read()
        }
        var number: Long = 0
        do {
            number *= 10L
            number += (c - '0'.toInt()).toLong()
            c = read()
        } while (!isSpaceChar(c))
        return number * sgn
    }

    fun readString(): String {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        val res = StringBuilder()
        do {
            res.appendCodePoint(c)
            c = read()
        } while (!isSpaceChar(c))
        return res.toString()
    }

    fun isSpaceChar(c: Int): Boolean {
        return filter?.isSpaceChar(c)
                ?: (c == ' '.toInt() || c == '\n'.toInt() || c == '\r'.toInt() || c == '\t'.toInt() || c == -1)
    }

    operator fun next(): String {
        return readString()
    }

    interface SpaceCharFilter {
        fun isSpaceChar(ch: Int): Boolean
    }
}

class OutputWriter {
    private val writer: PrintWriter

    constructor(outputStream: OutputStream) {
        writer = PrintWriter(BufferedWriter(OutputStreamWriter(outputStream)))
    }

    constructor(writer: Writer) {
        this.writer = PrintWriter(writer)
    }

    fun print(vararg objects: Any) {
        for (i in objects.indices) {
            if (i != 0)
                writer.print(' ')
            writer.print(objects[i])
        }
    }

    fun printLine(vararg objects: Any) {
        print(*objects)
        writer.println()
    }

    fun close() {
        writer.close()
    }

    fun flush() {
        writer.flush()
    }

}

class DinitzMaxFlowSolver(val n: Int, val s: Int, val t: Int, val graph: MutableMap<Int, MutableList<Edge>>, val edgeMap: MutableMap<Pair<Int, Int>, Edge>) {

    private val level = IntArray(n + 1) { -1 }  //storing levels of each vertex in level graph
    var maxFlow = 0L

    init {
        solve()
    }

    fun solve() {
        val next = IntArray(n + 1) { 0 }
        while (bfs()) {
            Arrays.fill(next, 0)
            var flow = 0L
            do {
                maxFlow += flow
                flow = dfs(s, next, Long.MAX_VALUE)
            } while (flow != 0L)
        }
    }

    private fun dfs(at: Int, next: IntArray, flow: Long): Long {
        if (at == t) return flow
        var size = 0
        if (graph.containsKey(at)) size = graph[at]!!.size
        while (next[at] < size) {
            val edge = graph[at]!!.get(next[at])
            if (edge.remainingCapacity() > 0 && level[edge.to] == level[at] + 1) {
                val bottleNeck = dfs(edge.to, next, Math.min(flow, edge.remainingCapacity()))
                if (bottleNeck > 0) {
                    edgeMap[Pair(edge.from, edge.to)]!!.flow += bottleNeck
                    edgeMap[Pair(edge.to, edge.from)]!!.flow -= bottleNeck
                    return bottleNeck
                }
            }
            next[at]++
        }
        return 0
    }

    private fun bfs(): Boolean {
        Arrays.fill(level, -1)
        val curLevel = ArrayDeque<Int>()
        curLevel.add(s)
        level[s] = 0

        while (curLevel.isNotEmpty()) {
            val top = curLevel.poll()
            if (graph.containsKey(top)) {
                graph[top]!!.forEach {
                    if (it.remainingCapacity() > 0 && level[it.to] == -1) {
                        level[it.to] = level[top] + 1
                        curLevel.offer(it.to)
                    }
                }
            }
        }
        return level[t] != -1
    }

}

class Edge(val from: Int, val to: Int, val capacity: Long) {
    var flow = 0L
    fun remainingCapacity(): Long {
        return capacity - flow
    }
}


import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

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

val scanner = Scanner(System.`in`)
val n1 =scanner.nextInt()
val n2 = scanner.nextInt()
val k1 = scanner.nextInt()
val k2 = scanner.nextInt()
val arr = Array<Array<Array<IntArray>>>(n1 + 1) { Array<Array<IntArray>>(n2 + 1) { Array<IntArray>(k1 + 1) { IntArray(k2 + 1) { -1 } } } }
val mod = 100000000

fun run() {

    println(Q(n1, n2, 0, 0))

}

fun Q(q1: Int, q2: Int, w1: Int, w2: Int): Int {
    if (arr[q1][q2][w1][w2] != -1)
        return arr[q1][q2][w1][w2]
    var res = 0
    if (q1 != 0 && w1 != k1)
        res += Q(q1 - 1, q2, w1 + 1, 0)
    if (q2 != 0 && w2 != k2)
        res += Q(q1, q2 - 1, 0, w2 + 1)
    if (q1 == 0 && q2 == 0)
        res = 1
    res %= mod
    arr[q1][q2][w1][w2] = res
    return res
}

//fun run() {
//
//    val scanner = Scanner(System.`in`)
//    val n1 = scanner.nextInt()
//    val n2 = scanner.nextInt()
//    val k1 = scanner.nextInt()
//    val k2 = scanner.nextInt()
//    val arr = Array<Array<Array<IntArray>>>(n1 + 1) { Array<Array<IntArray>>(n2 + 1) { Array<IntArray>(k1 + 1) { IntArray(k2 + 1) } } }
//    val mod = 100000000
//    arr[0][0][0][0] = 1
//    for (i1 in 0 until n1) {
//        for (i2 in 0 until n2) {
//            for (j1 in 0 until k1) {
//                for (j2 in 0 until k2) {
//                    arr[i1][i2][j1][j2] %= mod
//                    arr[i1 + 1][i2][j1 + 1][j2] += arr[i1][i2][j1][j2]
//                    arr[i1][i2 + 1][j1][j2 + 1] += arr[i1][i2][j1][j2]
//                    arr[i1][i2 + 1][j1][j2] += arr[i1][i2][j1][j2]
//                    arr[i1 + 1][i2][j1][j2] += arr[i1][i2][j1][j2]
//                }
//            }
//        }
//    }
//    var res = 0
//    for (i in 0..k1) {
//        for (j in 0..k2) {
//            res += arr[n1][n2][i][j]
//            res %= mod
//        }
//    }
//    println(res)
//}

class Scanner(s: InputStream) {
    var st: StringTokenizer? = null
    var br: BufferedReader = BufferedReader(InputStreamReader(s))
    @Throws(IOException::class)
    operator fun next(): String {
        while (st == null || !st!!.hasMoreTokens())
            st = StringTokenizer(br.readLine())
        return st!!.nextToken()
    }
    @Throws(IOException::class)
    fun nextInt(): Int {
        return Integer.parseInt(next())
    }
    @Throws(IOException::class)
    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }
    @Throws(IOException::class)
    fun nextLine(): String {
        return br.readLine()
    }
    @Throws(IOException::class)
    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
    @Throws(IOException::class)
    fun ready(): Boolean {
        return br.ready()
    }
}
fun IntArray.print() {
    println(Arrays.toString(this))
}
fun Array<IntArray>.print() {
    for (i in this)
        i.print()
}
fun LongArray.print() {
    println(Arrays.toString(this))
}
fun Array<LongArray>.print() {
    for (i in this)
        i.print()
}
fun BooleanArray.print() {
    println(Arrays.toString(this))
}
fun nod(a: Long, b: Long): Long {
    var a1 = a
    var b1 = b
    while (a1 != 0L && b1 != 0L) {
        if (a1 < b1)
            b1 %= a1
        else
            a1 %= b1
    }
    return a1 + b1
}
fun nok(a: Long, b: Long): Long = a * b / nod(a, b)


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

    val numHalfDigits = readInt()
    val ticket = readLine()!!
    val firstHalf = ticket.substring(0 until numHalfDigits).map { c -> c.toInt() }.sorted()
    val secondHalf = ticket.substring(numHalfDigits).map { c -> c.toInt() }.sorted()
    if (firstHalf[0] == secondHalf[0]) return print("NO")
    val (bigger, smaller) = if (firstHalf[0] > secondHalf[0]) firstHalf to secondHalf else secondHalf to firstHalf
    for (pos in bigger.indices)
        if (bigger[pos] <= smaller[pos]) return print("NO")
    print("YES")
}


// https://codeforces.com/problemset/problem/38/B Chess train
import kotlin.math.*;

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

enum class FigType {
    ROOK, KNIGHT
}

fun chessFromString(s : String, type:FigType):ChessPos {
    val xx = (s[0] - 'a').toInt()
    val yy = (s[1]+"").toInt() - 1
    return ChessPos(xx,yy,type)
}

/** chess position as two ints from 0 */
class ChessPos(val x:Int, val y:Int, val type : FigType) {

    fun beats(o:ChessPos) : Boolean {
        var b : Boolean
        if (type == FigType.KNIGHT) {
            b = ((abs(x - o.x) == 1) && (abs(y - o.y) == 2))
            b = b || (abs(x - o.x) == 2 && Math.abs(y - o.y) == 1)
        } else {
            b = x == o.x
            b = b || (y == o.y)
        }
        return b
    }

    fun equals(o:ChessPos) : Boolean {
        val b = (x == o.x) && (y == o.y)
        return b
    }
}

fun main() {
    var numWays = 0
    val rook = chessFromString(readLn(), FigType.ROOK)
    val knight = chessFromString(readLn(), FigType.KNIGHT)
    for (x in 0..7) {
        for (y in 0..7) {
            val f = ChessPos(x,y,FigType.KNIGHT)
            if (f.equals(rook) || f.equals(knight)) {
                continue
            }
            if (rook.beats(f) || knight.beats(f) || f.beats(rook)) {
                continue
            } else {
                numWays++
            }
        }
    }
    println(numWays)
}


import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.*
private fun readLn() = readLine()!! // string
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() //long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map {it.toLong()} // list of longs

val M = 1e5.toInt()+5
val MOD = 1e9.toInt() + 7

fun msk(r: Int) :Int
{
    var sol = 0;var exp = 0
    var c = r
    while(c>0)
    {
        if(c%10 == 4 || c%10 == 7)
        {
            var t = c%10
            for(q in 0 until exp) t*= 10
            exp++
            sol += t
        }
        c = c/10
    }
    return sol
}

fun main() {
    val (a,b) = readInts()
    for(i in (a+1) until 1e7.toInt())
    {
        if(msk(i) == b)
        {
            println(i)
            return
        }
    }
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.AssertionError
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

tailrec fun gcd(a: Long, b: Long): Long {
  if (a < b) return gcd(b, a)
  if (b == 0L) return a
  return gcd(b, a % b)
}
class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val T = nl()
    val A = nl()
    val B = nl()

    fun answer(x: Long) {
      val d = gcd(x - 1, T)
      out.println("${(x - 1)/d}/${T/d}")
    }

    if (A == B) {
      answer(T + 1)
      return
    }

    val a = A / gcd(A, B)
    if (a > T / B) {
      answer(min(T + 1, min(A, B)))
      return
    }
    val lcm = a * B
    val size = ((T + 1 + lcm - 1)/ lcm)
    val r = (T + 1) % lcm
    debug{"$lcm $size $r"}
    if (size == 1L) {
      answer(min(T + 1, min(A, B)))
      return
    }

    var ans = 0L
    ans += min(A, B) * (size - 1)
    ans += min(r + 1, min(A, B))
    debug{"$ans"}
    answer(ans)
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private inline fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private inline fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private inline fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }

  private inline fun assert(b: Boolean) = run{if (!b) throw AssertionError()}
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.AssertionError
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

tailrec fun gcd(a: Long, b: Long): Long {
  if (a < b) return gcd(b, a)
  if (b == 0L) return a
  return gcd(b, a % b)
}
class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val T = nl()
    val A = nl()
    val B = nl()

    fun answer(x: Long) {
      val d = gcd(x - 1, T)
      out.println("${(x - 1)/d}/${T/d}")
    }

    if (A == B) {
      answer(T + 1)
      return
    }

    val a = A / gcd(A, B)
    if (a > T / B) {
      answer(min(T + 1, min(A, B)))
      return
    }
    val lcm = a * B
    val size = (T + 1)/ lcm
    val r = (T + 1) % lcm
    debug{"$lcm $size $r"}

    var ans = 0L
    ans += min(A, B) * size
    if (r != 0L) ans += min(r, min(A, B))
    debug{"$ans"}
    answer(ans)
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private inline fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private inline fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private inline fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }

  private inline fun assert(b: Boolean) = run{if (!b) throw AssertionError()}
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


fun main(){
    repeat(8){
        var line = readLine()!!
        var flag =
        if (line.contains("WW") || line.contains("BB")){
            println("NO")
            return
        }else{

        }
    }
    println("YES")
}


import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.*
fun main(args: Array<String>) {

    val scanner = Scanner(System.`in`)
    for (i in 0 until 8) {
        val str = scanner.next()
        for (j in 0 until 8) {
            if (str[(j + 1) % 8] == str[j]) {
                println("NO")
                return
            }
        }
    }
    println("YES")

}

class Scanner(s: InputStream) {
    var st: StringTokenizer? = null
    var br: BufferedReader = BufferedReader(InputStreamReader(s))
    @Throws(IOException::class)
    operator fun next(): String {
        while (st == null || !st!!.hasMoreTokens())
            st = StringTokenizer(br.readLine())
        return st!!.nextToken()
    }
    @Throws(IOException::class)
    fun nextInt(): Int {
        return Integer.parseInt(next())
    }
    @Throws(IOException::class)
    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }
    @Throws(IOException::class)
    fun nextLine(): String {
        return br.readLine()
    }
    @Throws(IOException::class)
    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
    @Throws(IOException::class)
    fun ready(): Boolean {
        return br.ready()
    }
}
//class Pair(var a: Int, var b: Int): Comparable<Pair> {
//    override fun compareTo(other: Pair): Int {
//        return b - a - other.b + other.a
//    }
//}


fun main() {
    val r = System.`in`.bufferedReader()
    val n = r.readLine()!!.toLong()
    var x = n
    val list = arrayListOf<Long>()

    var i = 2L;
    while (i * i <= x) {
      while (x % i == 0L) {
        list.add(i)
        x /= i
      }
      i += 1
    }
    if (x != n && x != 1L) {
      list.add(x);
    }

    if (list.size > 2) {
      println(1)
      println(list.get(0) * list.get(1))
    } else if (list.size == 2) {
      println(2)
    } else {
      println(1)
      println(0)
    }
}


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

fun main(args : Array<String>) {
  //====== Input preparations ========================================================
//  val fin = BufferedReader(FileReader("c.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 ============================================================
  val s = next()
  val cnt = Array(26, {0})
  for (c in s)
    cnt[c - 'A']++

  var dbl = ' '
  for (i in 0..25) {
    if (cnt[i] > 1) {
      dbl = 'A' + i
      break
    }
  }
  val pos1 = s.indexOf(dbl)
  val pos2 = s.indexOf(dbl, pos1 + 1)
  if (pos2 == pos1 + 1) {
    fout.println("Impossible")
    fout.close()
    return
  }
  val res = Array(2) {Array(13) {'!'}}
  var top = 0
  var down = 0
  var s1 = (pos1 + pos2) / 2
  var s2 = s1 + 1
  while (s1 > pos1)
    res[0][top++] = s[s1--]
  while (s2 < pos2)
    res[1][down++] = s[s2++]
  res[1][down++] = dbl
  fun next(pos: Pair<Int, Int>) : Pair<Int, Int> {
    val (r,c) = pos
    if (r == 1 && c == 12)
      return 0 to 12
    if (r == 1)
      return 1 to (c+1)
    return 0 to (c-1)
  }
  var (row,col) = 1 to down
  for (c in s.substring(pos2+1)) {
    res[row][col] = c
    val pos = next(row to col)
    row = pos.first
    col = pos.second
  }
  for (c in s.substring(0, pos1)) {
    res[row][col] = c
    val pos = next(row to col)
    row = pos.first
    col = pos.second
  }
  for (arr in res) {
    for (c in arr)
      fout.print(c)
    fout.println()
  }
  fout.close()
  fin.close()
}


fun POW(N:Int ,P: Int ,mod : Int):Int{
    var x=1
    var n=N
    var p=P
    while (p > 0) {
        if (p%2 == 0) {
            n = n*n %mod
            p /= 2
        } else {
            x = x*n %mod
            p -= 1
        }
    }

    return x
}

fun main(){
    var (n,K) = readLine()!!.split(' ').map { it.toInt() }
    val mod=1000000007

    var FACT=mutableListOf<Int>()
    var F=mutableListOf<Int>()
    var FACT_INV=mutableListOf<Int>()

    FACT.add(1)
    F.add(0)

    for (i in 1..1000010){
        FACT.add(FACT[i-1]*i%mod)
        F.add((F[i-1]+POW(i,K,mod))%mod)
    }

    //println(FACT[1000010])

    FACT_INV.add(POW(FACT[1000010],mod-2,mod))

    for (i in 1000010 downTo 1){
        FACT_INV.add(FACT_INV[1000010-i]*i%mod)
    }

    //println(FACT_INV[0])
    //println(FACT_INV[1000010])
    FACT_INV = FACT_INV.asReversed()

    //println(FACT_INV[0])
    //println(FACT_INV[1000010])

    var ANS=0L
    var PI=1L

    if (n<=K+2){
        println(F[n.toInt()])
        return
    }

    for (i in 1..K+2){
        PI=PI*(n-i)%mod
        if ((K+2-i)%2==0){
            ANS=ANS+F[i.toInt()]*FACT_INV[(K+2-i).toInt()]%mod*FACT_INV[(i-1).toInt()]%mod*POW(n-i,mod-2,mod)
            ANS=(ANS+mod)%mod
        }
        else{
            ANS=ANS-F[i.toInt()]*FACT_INV[(K+2-i).toInt()]%mod*FACT_INV[(i-1).toInt()]%mod*POW(n-i,mod-2,mod)
            ANS=(ANS+mod)%mod
        }
    }
    println((ANS*PI+mod)%mod)
}


fun POW(N:Int ,P: Int ,mod : Int):Int{
    var x=1
    var n=N
    var p=P
    while (p > 0) {
        if (p%2 == 0) {
            n = (n.toLong()*n %mod).toInt()
            p /= 2
        } else {
            x = (x.toLong()*n %mod).toInt()
            p -= 1
        }
    }

    return x
}

fun main(){
    var (n,K) = readLine()!!.split(' ').map { it.toInt() }
    val mod=1000000007

    var FACT=mutableListOf<Int>()
    var F=mutableListOf<Int>()
    var FACT_INV=mutableListOf<Int>()

    FACT.add(1)
    F.add(0)

    for (i in 1..1000010){
        FACT.add((FACT[i-1].toLong()*i%mod).toInt())
        F.add((F[i-1]+POW(i,K,mod))%mod)
    }

    //println(FACT[1000010])

    FACT_INV.add(POW(FACT[1000010],mod-2,mod))

    for (i in 1000010 downTo 1){
        FACT_INV.add((FACT_INV[1000010-i].toLong()*i%mod).toInt())
    }

    //println(FACT_INV[0])
    //println(FACT_INV[1000010])
    FACT_INV = FACT_INV.asReversed()

    //println(FACT_INV[0])
    //println(FACT_INV[1000010])

    var ANS=0L
    var PI=1L

    if (n<=K+2){
        println(F[n])
        return
    }

    for (i in 1..K+2){
        PI=PI*(n-i)%mod
        if ((K+2-i)%2==0){
            ANS=ANS+F[i.toInt()].toLong()*FACT_INV[(K+2-i).toInt()]%mod*FACT_INV[(i-1).toInt()]%mod*POW(n-i,mod-2,mod)
            ANS=(ANS+mod)%mod
        }
        else{
            ANS=ANS-F[i.toInt()].toLong()*FACT_INV[(K+2-i).toInt()]%mod*FACT_INV[(i-1).toInt()]%mod*POW(n-i,mod-2,mod)
            ANS=(ANS+mod)%mod
        }
    }
    println((ANS*PI+mod)%mod)
}


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

    val n = readInt()
    var xs = readInts().sorted()
    var sol = 0
    while (xs.isNotEmpty()) {
        sol++
        var numElements = 0
        val newXs = mutableListOf<Int>()
        for (x in xs) {
            if (x >= numElements) numElements++ else newXs.add(x)
        }
        xs = newXs
    }
    print(sol)
}


import kotlin.math.max

/**
 *
 *This solution works due to the small input, but the solution is O(n^2). A linear solution can be found here:
 * https://codeforces.com/contest/388/submission/8807640
 * This solution uses -~f, which is the same than (f+1). If f is 3, ~f is -4 and -~f is 4. Probably uses it to save
 * some characters. The kotlin version of this solution is below
 */

//fun main() {
//    fun readInt() = readLine()!!.toInt()
//    fun readLong() = readLine()!!.toLong()
//    fun readInts() = readLine()!!.split(" ").map(String::toInt)
//    fun readLongs() = readLine()!!.split(" ").map(String::toLong)
//
//    val n = readInt()
//    var xs = readInts().sorted()
//    var sol = 0
//    while (xs.isNotEmpty()) {
//        sol++
//        var numElements = 0
//        val newXs = mutableListOf<Int>()
//        for (x in xs) {
//            if (x >= numElements) numElements++ else newXs.add(x)
//        }
//        xs = newXs
//    }
//    print(sol)
//}

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

    readLine()
    val xs = readInts().sorted()
    var sol = 0
    for((index, x) in xs.withIndex()) sol = max(sol, index / (x+1))
    print(sol + 1)
}


fun solve(n:Long, m:Long, k:Long):Long? {
  var ret:Long? = 0L
  if( k == 0L )
    ret = n * m
  else if( (n-1) + (m-1) < k )
    ret = -1
  else {
    val shortSide = listOf(n, m).max()
    val longSide = listOf(n, m).max()

    // 両方の辺を割らないといけない場合
    if( longSide!! < (k+1) ) {
      ret = listOf( solve(1, m, (k + 1) - n)!!, solve(n, 1, (k + 1) - m)!! ).max()
    }
    // 片方向からだけ割って、大きい方を採用
    else {
      val nCut = ( n / (k+1) ) * m
      val mCut = ( m / (k+1) ) * n
      ret = listOf(nCut, mCut).max()
    }
  }
  return ret
}

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


import kotlin.math.min

fun main() {
    val (n, x, y) = readLine()!!.split(" ").map { it.toLong() }
    fun minChanges(z: Long): Long {
        var res = 0
        var curr = 0
        for (chara in z.toString(2)) {
            if (chara == '1') {
                curr++
            } else {
                res += min(2, curr)
                curr = 0
            }
        }
        res += min(2, curr)
        return res.toLong() * x
    }
    var answer = Long.MAX_VALUE
    for (e in 0..29) {
        answer = min(answer, (e.toLong() * y) + ((n shr e) * x) + minChanges(n % (1L shl e)))
    }
    println(answer)
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val A = nl()
    val B = nl()
    var ans = 0L
    for (m in 1 until B) {
      val cum = A * (A + 1) / 2 % MOD
      val cnt = A
      ans += (m * cnt + m * B % MOD * cum) % MOD
    }
    out.println(ans % MOD)
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n, offset) { ni() }
  }

  private inline fun map(n: Int, offset: Int = 0, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i + offset)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun <A, B> pair(a: A, b: B) = RPair(a, b)
data class RPair<A, B>(val _1: A, val _2: B)

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val A = nl()
    val B = nl()
    var ans = 0L
    for (m in 1 until B) {
      val cum = A * (A + 1) / 2 % MOD
      val cnt = A
      ans += (m * cnt + m * B % MOD * cum) % MOD
    }
    out.println(ans)
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n, offset) { ni() }
  }

  private inline fun map(n: Int, offset: Int = 0, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i + offset)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun <A, B> pair(a: A, b: B) = RPair(a, b)
data class RPair<A, B>(val _1: A, val _2: B)

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


fun main() {
    val k = 2 * readLine()!!.toInt()
    val occs = mutableMapOf<Char, Int>().withDefault { 0 }
    repeat(4) {
        for (c in readLine()!!)
            if (c != '.') occs[c] = occs.getValue(c) + 1
    }
    print(if(occs.isEmpty() || occs.values.max()!! <= k) "YES" else "NO")
}


import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

fun main() {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    val (n, q) = jin.readLine().split(" ").map { it.toInt() }
    val flowers = jin.readLine().split(" ").map { it.toInt() }
    val types = mutableMapOf<Int, TreeSet<Segment>>()
    val bit = RangeBIT(n)
    val overall = TreeSet<Segment>(compareBy { it.from })
    for (j in 1..n) {
        val f = flowers[j - 1]
        if (f !in types) {
            types[f] = TreeSet<Segment>(compareBy { it.from })
            types[f]!!.add(Segment(0, 0, f))
        }
        val j2 = types[f]!!.last().to
        bit.update(1, j - j2, 1L)
        bit.update(n + 2 - j, n + 1 - j2, -1L)
        types[f]!!.add(Segment(j, j, f))
        overall.add(Segment(j, j, f))

    }
    fun changeContribution(segment: Segment, sign: Long) {
        val left = types[segment.type]!!.lower(segment)!!
        bit.update(1, 1, sign * (segment.to - segment.from).toLong())
        bit.update(n + 2 - segment.to, n + 1 - segment.from, -sign)
        bit.update(1, segment.from - left.to, sign)
        bit.update(n + 2 - segment.from, n + 1 - left.to, -sign)
    }
    fun remove(segment: Segment) {
        changeContribution(segment, -1L)
        val right = types[segment.type]!!.higher(segment)
        if (right != null) {
            changeContribution(right, -1L)
        }
        overall.remove(segment)
        types[segment.type]!!.remove(segment)
        if (right != null) {
            changeContribution(right, 1L)
        }
    }
    fun add(segment: Segment) {
        if (segment.type !in types) {
            types[segment.type] = TreeSet<Segment>(compareBy { it.from })
            types[segment.type]!!.add(Segment(0, 0, segment.type))
        }
        val right = types[segment.type]!!.higher(segment)
        if (right != null) {
            changeContribution(right, -1L)
        }
        overall.add(segment)
        types[segment.type]!!.add(segment)
        changeContribution(segment, 1L)
        if (right != null) {
            changeContribution(right, 1L)
        }
    }
    val out = StringBuilder()
    for (j in 1..q) {
        val line = jin.readLine().split(" ").map { it.toInt() }
        if (line[0] == 1) {
            val l = line[1]
            val r = line[2]
            val x = line[3]
            while (true) {
                val segment = overall.floor(Segment(r, r, 0))
                if (segment == null || segment.to < l) {
                    break
                }
                remove(segment)
                if (segment.to > r) {
                    add(Segment(r + 1, segment.to, segment.type))
                }
                if (segment.from < l) {
                    add(Segment(segment.from, l - 1, segment.type))
                    break
                }
            }
            add(Segment(l, r, x))
            //println(overall)
            /*for (k in 1..n) {
                print("${bit[1, k]} ")
            }*/
            //println()
        } else {
            val k = line[1]
            out.appendln(bit[1, k])
        }
    }
    print(out)
}

data class Segment(val from: Int, val to: Int, val type: Int)

class RangeBIT internal constructor(treeTo: Int) {
    val value: LongArray
    val weightedVal: LongArray
    fun updateHelper(index: Int, delta: Long) {
        val weightedDelta = index.toLong() * delta
        var j = index
        while (j < value.size) {
            value[j] += delta
            weightedVal[j] += weightedDelta
            j += j and -j
        }
    }

    fun update(from: Int, to: Int, delta: Long) {
        //println("update($from, $to) + $delta")
        if (from <= to) {
            updateHelper(from, delta)
            updateHelper(to + 1, -delta)
        }
    }

    fun query(to: Int): Long {
        var res: Long = 0
        var weightedRes: Long = 0
        var j = to
        while (j > 0) {
            res += value[j]
            weightedRes += weightedVal[j]
            j -= j and -j
        }
        return (to + 1).toLong() * res - weightedRes
    }

    operator fun get(from: Int, to: Int): Long {
        return if (to < from) {
            0
        } else query(to) - query(from - 1)
    }

    init {
        value = LongArray(treeTo + 2)
        weightedVal = LongArray(treeTo + 2)
    }
}

/*
10 10
1 2 6 7 6 4 6 8 9 2
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
2 10

 */


fun main(args : Array<String>) {

    val (a, b) = readLine()!!.split(' ')
    var al = a.toInt()
    var ar = b.toInt()

    val (x, y) = readLine()!!.split(' ')
    var bl = x.toInt()
    var br = y.toInt()

    if(touch(al, br)==1){
        println("YES")
    }
    else if(touch(ar, bl)==1){
        println("YES")
    }
    else
        println("NO")
}

fun touch(a:Int, b: Int): Int {
    if(a==b) {return 1}
    else if(a>b){
        if((a-b) < 2){
            return 1
        }
        else return 0
    }
    else if(a<b){
         if((a+1)*2>=b){
             return 1
         }
         else return 0
    }
    else return 0
}


fun main() {
    val cmd = readLine()!!
    val path = mutableSetOf<Pair<Int, Int>>()
    var x = 0
    var y = 0
    path.add(Pair(0, 0))
    var ok = true
    for (step in cmd) {
        when (step) {
            'L' -> x--
            'R' -> x++
            'U' -> y--
            'D' -> y++
        }
        if (path.contains(Pair(x, y))) {
            ok = false
            println("BUG")
            break
        }
        path.add(Pair(x, y))
    }
    if (ok) println("OK")
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val N = ni()
    val (L, R) = na2(N)

    var ans = 0.0

    for (i in 0 until N) {
      for (j in 0 until N) {
        if (i == j) continue
        for (x in L[j] .. R[j]) {
          var prob = 1.0
          for (k in 0 until N) {
            if (k == j) continue

            prob *= if (k == i) {
              val l = max(if (i < j) x else x + 1, L[i])
              val r = R[i]
              max(0, r - l + 1)
            } else {
              val l = L[k]
              val r = min(if (j < k) x else x - 1, R[k])
              max(0, r - l + 1)
            }
          }
          ans += prob * x
        }
      }
    }

    debug{"ans:$ans"}
    for (i in 0 until N) {
      ans /= (R[i] - L[i] + 1)
    }

    out.println("%.10f".format(ans))
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


fun main() {
    val (p1, t1) = readln().split(' ').let { (p, t) -> p.toInt() to t.toLong() }
    val (p2, t2) = readln().split(' ').let { (p, t) -> p.toInt() to t.toLong() }
    val (h, s) = readln().split(' ').let { (h, s) -> h.toInt() to s.toLong() }
    val minTime = LongArray(h + 1){Long.MAX_VALUE shr 1}.also { it[0] = 0L }
    for (c1 in 1 .. h) {
        val time = t1 * c1
        val c2 = time / t2
        val damage = p1 * c1 + p2 * c2 - s * if (c2 > 0) (c1 + c2 - 1) else (c1 + c2)
        for (i in minTime.indices) {
            val j = minOf(h.toLong(), i + damage).toInt()
            minTime[j] = minOf(minTime[j], minTime[i] + time)
        }
    }
    for (c2 in 1 .. h) {
        val time = t2 * c2
        val c1 = time / t1
        val damage = p1 * c1 + p2 * c2 - s * if (c1 > 0) (c1 + c2 - 1) else (c1 + c2)
        for (i in minTime.indices) {
            val j = minOf(h.toLong(), i + damage).toInt()
            minTime[j] = minOf(minTime[j], minTime[i] + time)
        }
    }
    val result = minTime[h]
    println(result)
}


fun main(args: Array<String>) {
        val n = readLine()!!.toLong()
        if((n % 2).toLong() == 0.toLong())
            print(2)
    else
        print(1)
    }


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val Xp = ni()
    val Yp = ni()
    val Xv = ni()
    val Yv = ni()

    var win = false
    val diagonal = min(Xv, Yv)
    for (i in 1 .. diagonal) {
      val x = Xv - i
      val y = Yv - i
      if (Xp >= x && Yp >= y) {
        val tp = Xp - x + Yp - y
        val tv = i
        win = win || tp <= tv
      }
    }

    for (i in 1 .. max(Xv, Yv) - diagonal) {
      val x = max(0, Xv - diagonal - i)
      val y = max(0, Yv - diagonal - i)
      if (Xp >= x && Yp >= y) {
        val tp = Xp - x + Yp - y
        val tv = i + diagonal
        win = win || tp <= tv
      }
    }

    if (win) out.println("Polycarp")
    else out.println("Vasiliy")
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n, offset) { ni() }
  }

  private inline fun map(n: Int, offset: Int = 0, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i + offset)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun <A, B> pair(a: A, b: B) = RPair(a, b)
data class RPair<A, B>(val _1: A, val _2: B)

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


fun getN(input: Int): Int {
    val p: Double = (Math.sqrt(8.0 * input + 1) - 1.0) / 2.0
    return p.toInt() + 1
}

fun main(args: Array<String>) {
    var k = readLine()?.toInt()!!
    var o = 'a'
    if (k == 0)
        print('a')
    else
        while (k != 0) {
            val p = getN(k)
            k -= ((p * (p - 1)) / 2)
            for (i in 1..p)
                print(o)
            o++
        }
}


import java.util.*

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

    val queue = ArrayDeque<Int>()
    val n = readInt()
    repeat(n) {
        var current = 1
        while (queue.isNotEmpty() && queue.peekLast() == current) {
            queue.removeLast()
            current++
        }
        queue.add(current)
    }
    print(queue.joinToString(" "))
}