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


fun main() {
    var fTeam = readLine()!!.toInt()
    var sTeam = readLine()!!.toInt()
    var fMax = readLine()!!.toInt()
    var sMax = readLine()!!.toInt()
    var total = readLine()!!.toInt()

    var fTeam1 = fTeam
    var sTeam1 = sTeam
    var fMax1 = fMax
    var sMax1 = sMax
    var total1 = total

    var ansMax = 0
    var ansMin = 0

    if (fMax < sMax) {
        while (total >= fMax && fTeam > 0) {
            ansMax += 1
            fTeam--
            total -= fMax
        }
        while (total >= sMax && sTeam > 0) {
            ansMax += 1
            sTeam--
            total -= sMax
        }
    } else {
        while (total >= sMax && sTeam > 0) {
            ansMax += 1
            sTeam--
            total -= sMax
        }
        while (total >= fMax && fTeam > 0) {
            ansMax += 1
            fTeam--
            total -= fMax
        }
    }

    var sum = fMax1 * fTeam1 + fMax1 * sTeam1
    if (total1 >= sum) {
        ansMin = fTeam1 + sTeam1
    } else {

        total1 -= (fMax1 - 1) * fTeam1

        total1 -= (sMax1 - 1) * sTeam1

        if (total1 <= 0) {
            ansMin = 0
        } else {
            ansMin = total1
        }
    }

    println("$ansMin $ansMax")
}


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

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

val out=mutableListOf<String>()
fun printLine(s:String){out.add(s)}
fun output(){println(out.joinToString("\n"))}

fun TreeMap<Char,Int>.add(i:Char,x:Int){
    set(i,getOrDefault(i,0)+x)
}
fun main(){
    var a=Array(3){readLn().toCharArray()}
    var cnt=TreeMap<Char,Int>()
    for(j in 0..2)for(i in a[j])cnt.add(i,1)
    var o=cnt.getOrDefault('0',0)
    var x=cnt.getOrDefault('X',0)
    if(o>x || x>o+1)printLine("illegal")
    else{
        fun win(c:Char):Boolean{
            for(j in 0..2)if(a[j][0]==c&&a[j][1]==c&&a[j][2]==c)return true
            for(j in 0..2)if(a[0][j]==c&&a[1][j]==c&&a[2][j]==c)return true
            if(a[0][0]==c&&a[1][1]==c&&a[2][2]==c)return true
            if(a[2][0]==c&&a[1][1]==c&&a[0][2]==c)return true
            return false
        }
        if(win('X')&&win('0'))printLine("illegal")
        else{
            if(win('X')){
                var ok=false
                for(i in 0..2)for(j in 0..2){
                    a[i][j]='.'
                    if(!win('X'))ok=true
                    a[i][j]='X'
                }
                if(ok&&x==o+1)printLine("the first player won")
                else printLine("illegal")
            }else if(win('0')){
                var ok=false
                for(i in 0..2)for(j in 0..2){
                    a[i][j]='.'
                    if(!win('0'))ok=true
                    a[i][j]='0'
                }
                if(ok&&x==o)printLine("the second player won")
                else printLine("illegal")
            }else{
                if(x+o==9)printLine("draw")
                else if(x>o)printLine("second")
                else printLine("first")
            }
        }
    }
    output()
}


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

fun main(readLine: () -> String?) {
    val problem = readProblem(readLine)
    val solution = solve(problem)
    printSolution(solution)
}

// READ PROBLEM

private fun readProblem(readLine: () -> String?): Problem {
    val input = (readLine() + readLine() + readLine())
    return Problem(input.map(::charToPlayer))
}

private fun charToPlayer(c: Char): Player? {
    when (c) {
        'X' -> return Player.X
        '0' -> return Player.O
        else -> return null
    }
}

private class Problem(val board: List<Player?>) {
    override fun toString(): String {
        return board.joinToString(" ")
    }

    fun countX(): Int {
        return board.filter { it == Player.X }.count()
    }

    fun countO(): Int {
        return board.filter { it == Player.O }.count()
    }

    fun hasThreeX(): Boolean {
        val xs = board.map { it == Player.X }
        return isWinning(xs)
    }

    fun hasThreeO(): Boolean {
        val os = board.map { it == Player.O }
        return isWinning(os)
    }

    private fun isWinning(b: List<Boolean>): Boolean {
        return (b[0] && b[1] && b[2])
                || (b[3] && b[4] && b[5])
                || (b[6] && b[7] && b[8])
                || (b[0] && b[3] && b[6])
                || (b[1] && b[4] && b[7])
                || (b[2] && b[5] && b[8])
                || (b[0] && b[4] && b[8])
                || (b[2] && b[4] && b[6])
    }
}

private enum class Player {
    X, O
}

// SOLVE PROBLEM

private fun solve(prob: Problem): Solution {
    // x - it's the first player
    // o - it's the second player
    val xNo = prob.countX()
    val oNo = prob.countO()
    val xWon = prob.hasThreeX()
    val oWon = prob.hasThreeO()

    when {
        (xNo < oNo) -> return Solution.ILLEGAL
        (xNo > (oNo + 1)) -> return Solution.ILLEGAL
        (xWon && oWon) -> return Solution.ILLEGAL
        (xWon && (xNo > oNo)) -> return Solution.FIRST_WON
        (xWon) -> return Solution.ILLEGAL
        (oWon && (xNo == oNo)) -> return Solution.SECOND_WON
        (oWon) -> return Solution.ILLEGAL
        (xNo == oNo) -> return Solution.FIRST
        (xNo > oNo) -> return Solution.SECOND
        else -> return Solution.ILLEGAL
    }
}

// PRINT SOLUTION

private enum class Solution(val txt: String) {
    FIRST("first"),
    SECOND("second"),
    ILLEGAL("illegal"),
    FIRST_WON("the first player won"),
    SECOND_WON("the second player won"),
    DRAW("draw");

    fun print(consumer: (String) -> Unit) {
        consumer(txt)
    }
}

private fun printSolution(solution: Solution) {
    solution.print(::println)
}


import java.lang.Exception

fun main() {
    // 0 || X || .
    var num1 = 0 //The first player draws X goes
    var num2 = 0 //The second player draws 0 goes
    var spaceNum = 0 // space are '.'
    val table = arrayListOf(readLine()!!.toCharArray())
    var isFull = !table[0].any() { it == '.' }
    table.add(readLine()!!.toCharArray())
    isFull = isFull && !table[1].any() { it == '.' }
    table.add(readLine()!!.toCharArray())
    isFull = isFull && !table[2].any() { it == '.' }
    for (k in table.indices) {
        for (i in table[k].indices) {
            when {
                table[k][i] == 'X' -> {
                    num1++
                }
                table[k][i] == '0' -> {
                    num2++
                }
                table[k][i] == '.' -> {
                    spaceNum++
                }
            }
        }
    }
    //println("num1 : $num1, num2 : $num2")
    if (num1 - num2 != 0 && num1 - num2 != 1) {
        println("illegal")
        return
    }
    val checkChar = arrayOf('X', '0')
    var won = arrayOf(0, 0)
    for (c in 0..1) {
        for (i in 0..2) { // fin
            if (checkChar[c] == table[i][0] && table[i][0] == table[i][1] && table[i][1] == table[i][2]) {
                won[c]++
            }
            if (checkChar[c] == table[0][i] && table[0][i] == table[1][i] && table[1][i] == table[2][i]) {
                won[c]++
            }
        }
        if (checkChar[c] == table[0][0] && table[0][0] == table[1][1] && table[1][1] == table[2][2]) {
            won[c]++
        }
        if (checkChar[c] == table[0][2] && table[0][2] == table[1][1] && table[1][1] == table[2][0]) {
            won[c]++
        }
    }
    //println("check : $checkChar")

    if (won[0] >= 1 && won[1] >= 1) {
        println("illegal")
        return
    } else if (won[0] >= 1) {
        println("the first player won")
        return
    } else if (won[1] >= 1) {
        println("the second player won")
        return
    }

    if (!isFull) {
        if (num1 - num2 == 0) {
            println("first")
        } else if (num1 - num2 == 1) {
            println("second")
        }
        return
    } else {
        println("draw")
    }
}


import java.util.*

val FIRST = 'X'
val SECOND = '0'

fun main() {
    val reader = Scanner(System.`in`)

    val board = mutableListOf<String>()
    repeat(3) { board.add(reader.nextLine().trim()) }

    val zeros = board.sumBy { row -> row.count { it == '0' } }
    val xs = board.sumBy { row -> row.count { it == 'X' } }

    fun won(c: Char): Boolean {
        for (i in 0 until 3) {
            if (board[i].all { it == c }) return true
            if (board.all { row -> row[i] == c }) return true
        }

        if ((0 until 3).map { board[it][it] }.all { it == c }) return true
        if ((0 until 3).map { board[it][2 - it] }.all { it == c }) return true

        return false
    }

    when (xs - zeros) {
        1 -> when {
            won(SECOND) -> println("illegal")
            won(FIRST) -> println("the first player won")
            else -> println("second")
        }
        0 ->
            when {
                won(FIRST) -> println("illegal")
                won(SECOND) -> println("the second player won")
                xs == 5 -> println("draw")
                else -> println("first")
            }
        else -> println("illegal")
    }

}


import kotlin.properties.Delegates
import kotlin.reflect.KProperty

class Memorize<T, R>(val func: (T) -> R) {
    val cache = mutableMapOf<T, R>()

    operator fun getValue(thisRef: Any?, property: KProperty<*>) = { n: T ->
        cache.getOrPut(n) { func(n) }
    }
}

var k by Delegates.notNull<Long>()
var l by Delegates.notNull<Long>()
val f: (Pair<Long, Boolean>) -> Long by Memorize { (weight, hasLeast) ->
    when {
        weight < 0 -> 0
        weight == 0L -> if (hasLeast) 1L else 0L
        hasLeast -> (1..k).fold(0L) { acc: Long, l: Long -> acc + f(Pair(weight - l, true)) }
        else -> { (if (k >= l) (l..k).fold(0L) { acc: Long, l: Long ->
                        acc + f(Pair(weight - l, true))
            } else 0L) + (1..minOf(k, l - 1)).fold(0L) { acc: Long, l: Long ->
            acc + f(Pair(weight - l, false)) }
        }
    }//.also { println("weight: $weight hasleast: $hasLeast res: $it") }
}

fun main() {
    val r = System.`in`.bufferedReader()
    //val s = StringBuilder()
    //val n = r.readLine()!!.toInt()
    val (weight, kth, least) = r.readLine()!!.split(" ").map { it.toLong() }
    k = kth
    l = least
    println(f(Pair(weight, false)))
    //val n = r.readLine()!!.toInt()
}


fun main() {
    val n = readLine()!!.toInt()
    var s = 0L
    var i = 1
    while(s < n) {
        s+=i
        i++
    }
    println(i-1)
}


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:Long ,P: Long ,mod : Long):Long{
    var x=1L
    var n=N
    var p=P
    while (p > 0) {
        if (p%2 == 0L) {
            n = n*n %mod
            p /= 2
        } else {
            x = x*n %mod
            p -= 1
        }
    }

    return x
}

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

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

    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.toLong(),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==0L){
            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 main(args : Array<String>) = with(java.util.Scanner(System.`in`)){
    var n = nextInt()
    var k = nextInt()
    var res : Int = n/k
    if(res%2==0) println("NO")
    else println("YES")
}


import java.util.*

fun main(args: Array<String>) {
    var scanner = Scanner(System.`in`)

    var n = scanner.nextInt()
    var k = scanner.nextInt()

    var t = n / k

    if (t % 2 == 0) {
        print("NO")
    } else {
        print("YES")
    }
    scanner.close()
}


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

fun main(args: Array<String>) {
    val sc = Scanner()
    var n = sc.nxtInt()
    var k = sc.nxtInt()
    println(if((n/k)%2==1)"YES" else "NO")
}

class Scanner(){
    var br:BufferedReader?=null
    var st:StringTokenizer?=null
    init {
        br = BufferedReader(InputStreamReader(System.`in`))
    }
    private fun tokenize()
    {
        while(st==null || !st!!.hasMoreTokens())st = StringTokenizer(br!!.readLine())
    }
    fun readLine():String{
        return br!!.readLine()
    }
    fun nxt():String
    {
        tokenize()
        return st!!.nextToken()
    }

    fun nxtInt():Int{
        return nxt().toInt()
    }
    fun nxtDouble():Double
    {
        return nxt().toDouble()
    }
    fun nxtString():String
    {
        return nxt()
    }
}


fun main() {
        for (r in 0..4) {
            val index = readLine()!!.split(" ").map { it.toInt() }.indexOf(1)
            if(index != -1) {
                println(abs(2 - r) + abs(2 - index))
                return
            }
        }
    }


fun main(args: Array<String>) {
    val matrix = Array<Array<Int>>(5, {_ -> readLine()!!.split(' ').map(String::toInt).toTypedArray()})
    for (i in matrix.indices) {
        for (j in matrix[i].indices) {
            if (matrix[i][j] == 1) {
                var a = if (i >= 2) i - 2 else 2 - i
                var b = if (j >= 2) j - 2 else 2 - j
                // print("a = $a\n")
                // print("b = $b\n")
                print((a + b).toString() + "\n")
            }
        }
    }
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    //val n = r.readLine()!!.toInt()
    val (m, n) = r.readLine()!!.split(" ").map { it.toInt() }
    val x = m%10
    var ans = 1
    while ((x*ans)%10!=n || (x*ans)%10 != 0){
        ans++
    }
    println(ans)
}


fun main(args: Array<String>) {
    val n = readLine()!!.toInt();
    val m = readLine()!!.toInt();
    var sum = 0;
    var max = 0;
    for (i in 1..n) {
        var a = readLine()!!.toInt();
        sum += a;
        max = if (a > max) a else max;
    }
    var rest = m - (max * n - sum);
    var minK = max + rest / n + (if (rest % n == 0) 0 else 1);
    var maxK = max + m;
    println("$minK $maxK");
}


package codeforces
private object Read {
    fun readLn() = readLine()!! // string line
    fun readInt() = readLn().toInt() // single int
    fun readLong() = readLn().toLong() // single long
    fun readDouble() = readLn().toDouble() // single double
    fun readStrings() = readLn().split(" ") // list of strings
    fun readInts() = readStrings().map { it.toInt() } // list of ints
    fun readLongs() = readStrings().map { it.toLong() } // list of longs
    fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles
}

private fun arpasExam(degree: Int): Int = if (degree == 0) 1
else {
    when (degree % 4) {
        1 -> 8
        2 -> 4
        3 -> 2
        0 -> 6
        else -> 0
    }
}

fun main() {
    println(arpasExam(Read.readInt()))
}


private object Read {
    fun readLn() = readLine()!! // string line
    fun readInt() = readLn().toInt() // single int
    fun readLong() = readLn().toLong() // single long
    fun readDouble() = readLn().toDouble() // single double
    fun readStrings() = readLn().split(" ") // list of strings
    fun readInts() = readStrings().map { it.toInt() } // list of ints
    fun readLongs() = readStrings().map { it.toLong() } // list of longs
    fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles
}

private fun arpasExam(degree: Int) = when (degree % 4) {
    1 -> 8
    2 -> 4
    3 -> 2
    0 -> 6
    else -> 0
}

fun main() {
    println(arpasExam(Read.readInt()))
}


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

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

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

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

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

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

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

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

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


fun main() {
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    var (a, b) = r.readLine()!!.split(" ").map { it.toLong() }
    var ans = 0L
    while (a % b != 0L) {
        ans += a / b
        a = b.also { b = a % b }
    }
    ans += a
    println(ans)
}


import kotlin.math.*

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }

fun main(){
    val (n, k) = readInts()
    val a = readInts().sorted()
    println(a)
    var cnt = IntArray(200005, {0})
    var ans = IntArray(200005, {0})
    for (i in 0 until n){
        var temp = a[i]
        var d = 0
        while (temp > 0){
            if (cnt[temp] < k) {
                cnt[temp]++;
                ans[temp] += d
            }
            temp /= 2
            d++
        }
    }
    var res = Int.MAX_VALUE
    for (i in 1..a[n - 1]){
        if (cnt[i] == k) res = min(res, ans[i])
    }
    print(res)
}


import java.io.PrintWriter
import java.util.SortedMap
import java.util.StringTokenizer
import java.util.TreeMap

val MAXN = 200000

fun main() {
    val (n, k) = readInts(2)
    val A = readInts(n)
    val Cnt = A.groupingBy { it }.eachCountTo(HashMap())
    val bit = BIT(MAXN)

    var ans = Int.MAX_VALUE

    for((a, cn) in Cnt) bit.add(a, cn)
    cnt@ for((a, cn) in Cnt) {
        var need = k - cn
        var tot = 0
        var l = a
        var delta = 0
        var cost = 0

        while(need > 0) {
            l = l shl 1
            if(l > MAXN) continue@cnt
            cost++
            delta = (delta shl 1) + 1

            val get = minOf(need, bit.sum(l .. l + delta))
            need -= get
            tot += get * cost
        }

        if(tot < ans) ans = tot
    }

    println(ans)
}

class BIT(val size: Int) {
    private val A = IntArray(size + 1)
    private val logn = generateSequence(size) { it shr 1 }.takeWhile { it > 1 }.count()

    // zeroes all the bits except the least significant one
    @Suppress("NOTHING_TO_INLINE")
    private inline fun lsb(i: Int) = i and -i

    fun sum(end: Int): Int {
        var i = minOf(end, size)
        var sum = 0
        while(i > 0) {
            sum += A[i]
            i -= lsb(i)
        }
        return sum
    }

    fun sum(range: IntRange) = sum(range.last) - sum(range.first - 1)

    fun add(index: Int, value: Int) {
        var i = index // BIT is internally 1-indexed
        while(i <= size) {
            A[i] += value
            i += lsb(i)
        }
    }
}

fun readLn() = readLine()!!
private var tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(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() }

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


fun main() {
    val (a, b) = readLongs().sortedDescending()

    val ans = run {
        var minr = Long.MAX_VALUE
        var mink = -1
        for(k in 0..Int.MAX_VALUE) {
            val r = (a+k).lcm(b+k)
            if(r < minr) {
                minr = r
                mink = k
            }

            if(a+k >= minr) return@run mink
        }
        error("Should've TLE by now")
    }

    println(ans)
}

tailrec fun Long.gcd(other: Long): Long = if(other == 0L) this else other.gcd(rem(other))
fun Long.lcm(other: Long) = times(other) / gcd(other)

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

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


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

import java.io.PrintWriter
import java.util.StringTokenizer
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() {
    output {
        val a = readInt()
        val b = readInt()

        val min = min(a, b)

        val ans = abs(a - b).divisors()
            .map { q -> -min umod q }
            .allMinBy { k -> lcm(a + k, b + k) }.minBy { it }!!

        println(ans)
    }
}

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

tailrec fun gcd(a: Int, b: Int): Int = if(a == 0) abs(b) else gcd(b % a, a)
fun lcm(a: Int, b: Int): Long = a / gcd(a, b) * b.toLong()

fun Int.divisors() = sequence {
    val n = this@divisors
    if(n <= 0) return@sequence
    val tail = mutableListOf<Int>()

    for(p in 1..Int.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0) {
            yield(p)
            if(sq != n) tail.add(n / p)
        }
    }

    yieldAll(tail.asReversed())
}

inline fun <T, R: Comparable<R>> Sequence<T>.allMinBy(selector: (T) -> R): List<T> {
    val result = mutableListOf<T>()
    var min: R? = null

    for(it in this) {
        val r = selector(it)
        if(min == null || r < min) {
            min = r
            result.clear()
            result.add(it)
        } else if(r.compareTo(min) == 0) { result.add(it) }
    }

    return result
}

/** 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)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

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

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

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

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

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

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

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

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


import java.util.Scanner

fun main(){

    var a = nl()
    var b = nl()

    if(b<a){
        var t = a
        a = b
        b = t
    }

    var diff = b - a
    var best = lcm(a,b)
    var ans = 0L
    var sqrt = Math.sqrt(diff.toDouble()).toLong()
    for(i in 1..sqrt){
        if(diff%i==0L){
            var difI = diff / i
            var A = Math.ceil(a.toDouble()/difI).toLong() * difI
            var k = A - a
            var lcm = lcm(a+k, b+k)
            if(lcm < best){
                best = lcm
                ans = k
            }
        }
    }
    println(ans)
}

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

fun lcm(a: Long, b: Long): Long {
    return Math.abs(a / gcd(a, b) * b)
}

var input = Scanner(System.`in`)

fun ni() = input.nextInt()

fun nia(n: Int) = Array(n) { ni() }

fun nim(n: Int, m: Int) = Array(n) { nia(m) }

fun nl() = input.nextLong()

fun nla(n: Int) = Array(n) { nl() }

fun nlm(n: Int, m: Int) = Array(n) { nla(m) }

fun ns() = input.next()

fun nsa(n: Int) = Array(n) { ns() }


import java.util.Scanner

fun main(){
    var a = nl()
    var b = nl()
    var diff = b - a
    var times = Math.ceil(a.toDouble() / diff.toDouble()).toLong()
    var A = diff*times
    var expected = A-a
    var best = lcm(a+expected, b+expected)
    var k = expected
    for(i in 0 until Math.min(expected, 1_000_000)){
        var l = lcm(a+i, b+i)
        if(best > l){
            best = l
            k = i
        }
    }
    println(k)
}

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

fun lcm(a: Long, b: Long): Long {
    return Math.abs(a / gcd(a, b) * b)
}

var input = Scanner(System.`in`)

fun ni() = input.nextInt()

fun nia(n: Int) = Array(n) { ni() }

fun nim(n: Int, m: Int) = Array(n) { nia(m) }

fun nl() = input.nextLong()

fun nla(n: Int) = Array(n) { nl() }

fun nlm(n: Int, m: Int) = Array(n) { nla(m) }

fun ns() = input.next()

fun nsa(n: Int) = Array(n) { ns() }


import java.util.*

fun main(args: Array<String>) {
var sc = Scanner(System.`in`)
val x = sc.nextInt()
    val h = sc.nextInt()
    val m = sc.nextInt()
    if (m==7){
        println(0)
        return
    }else {
        var dec = m-x
        var occ = 1
        while (true){
            if (dec%10==7)break
            if (dec<0){
                dec=60+dec
                occ--
            }else  if (dec<60){
                dec-=x
            }else {
                dec+=x-60
            }
            occ++
        }
        println(occ)
    }
}

/* var acc = m - x
     var dec = m + x
     var occ = 1
     while (true) {
         if (((acc)%10 == 7 || (dec )%10== 7)){
             break
         }
         acc-=x
         println(acc)
         dec+=x
         println(dec)
         occ++
         println(occ)
     }
     println(occ)*/


fun getMin(a, b, c)
{
    if (a <= b && a <= c) return a
    if (b <= c) return b
    return c
}

fun main()
{
    val nn = readLine()!!.split(" ").map { it.toInt() }
    val mini = getMin(nn[0], nn[1] - 1, nn[2] - 2) + 1
    println(mini * 3)
}


fun main() {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val readString = reader.readLine().split(" ")
    val y = readString[0].toInt()
    val b = readString[1].toInt()
    val r = readString[2].toInt()
    println(getMaxOrnaments(y, b, r))
}

fun getMaxOrnaments(y: Int, b: Int, r: Int): Int {
    val input = arrayOf(y, b - 1, r - 2)
    val x = input[input.indices.minBy { input[it] }!!]
    return 3 * x + 3
}


fun main(args: Array<String>) {
    val y = args[0].toInt()
    val b = args[1].toInt()
    val r = args[2].toInt()
    println(getMaxOrnaments(y, b, r))
}

fun getMaxOrnaments(y: Int, b: Int, r: Int): Int {
    val input = arrayOf(y, b - 1, r - 2)
    val x = input[input.indices.minBy { input[it] }!!]
    return 3 * x + 3
}


import kotlin.math.min

fun main(args : Array<String>) {

    val NT = readLine()?.toInt() ?: 0

    for(test in 1..NT){
        val (a, b, c) = readLine()!!.split(" ").map { it.toInt() }
        val d = min(a, min(b - 1, c - 2))
        val ans = 3 * (d + 1)

        println("Case #$test: $ans")

    }

}


package higherOrderFunKotlin

import java.util.Scanner

    fun main(args: Array<String>) {

        val sc = Scanner(System.`in`)

        val y = sc.nextInt()
        val b = sc.nextInt() - 1
        val r = sc.nextInt() - 2

        val result = Math.min(Math.min(y, b), r) * 3 + 3

        println(result)
    }


fun main(args:Array<String>){
	var t = 0
	var x = 0
	var y = 0
	t = Integer.valueOf(readLine())
	x = Integer.valueOf(readLine())
	y = Integer.valueOf(readLine())
	var ans = 0
	for(i in 1..t+1){
		var temp = i
		temp +=1
		var temp2 = i
		temp2 +=2
		if(temp<=x && temp2<=y){
			ans = i + temp + temp2
		}
	}
	println("$ans")
}


import javax.swing.text.MutableAttributeSet

class Main {

    companion object {
        @JvmStatic
        fun main(args: Array<String>) {

            var inputList =readLine()!!.split(" ").toList()

            var beginList = mutableListOf(1, 2, 3)
            while (true) {

                if (beginList.count { b -> inputList.count { b <= it.toString().toInt() } == 3} != 3)
                    break
                else
                    beginList.replaceAll { it + 1 }

            }
//            beginList.replaceAll { it - 1 }
            println(beginList.sum())

        }
    }
}


fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main() {

    val (a,b,c) = readInts()
    println((6 + 3*minOf(a,b-1,c-2)))
}


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

fun main() {
  var (y,b,r) = readInts();
  println(max(y,max(b-1,r-2))*3+3)
}


fun main() {
    var y = readLine()!!.toInt()
    var b = readLine()!!.toInt()
    var r = readLine()!!.toInt()

    if (r <= b) {
        b = r - 1
        if (b <= y) {
            y = b - 1
        } else {
            b = y + 1
            r = b + 1
        }
    } else {
        if (b <= y) {
            y = b - 1
            r = b + 1
        }
        else {
            b = y + 1
            r = b + 1
        }
    }
    println(y + b + r)
}

fun log(n: Int) {
    println("Log: $n")
}


import java.lang.Math.min
import java.util.Scanner

fun main()
{
    val reader = Scanner(System.`in`)

    var y = reader.nextInt()
    var b = reader.nextInt()
    var r = reader.nextInt()
    var ans = min(y,b-1)
    ans = min(r-28 1,ans)
    ans = ans*3 + 3;8
    println(ans)

}


import kotlin.math.max

fun main(args: Array<String>) {
    val (y, b, r) = readLine()!!.split(Regex.fromLiteral("\\s")).map {
        it.toInt()
    }
    println(max(y + 2, max(b + 1, r)) * 3 - 3)
}


fun main(args: Array<String>): int {
    val inputNums = args[0].split(" ")
    var min = 1
    inputNums.forEachIndexed { index, s ->
        if (index + s.toInt() > min) {
            min = s.toInt()
        }
    }
    return (min+1)*3
}


fun main(args: Array<String>) {
    val inputNums = args[0].split(" ")
    var max = Int.MAX_VALUE
    inputNums.forEachIndexed { index, s ->
        if (s.toInt() - index < max) {
            max = s.toInt() - index
        }
    }
    println( (max+1) *3)
}


import java.util.Scanner

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readLong() = readLn().toLong()
fun readBigInt(radix: Int = 10) = readLn().toBigInteger(radix)
fun readBigDecimal() = readLn().toBigDecimal()
fun readLinesSeq(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.take(limit)
fun readStrings(delim: Char = ' ') = readLn().split(delim)
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }

fun readIntArray() = readInts().toIntArray()
fun readLnIntArray(n: Int) = IntArray(n) { readInt() }
fun readLongArray() = readLongs().toLongArray()
fun readLnLongArray(n: Int) = LongArray(n) { readLong() }

fun main(){
	val (x, y, z) = readLine()!!.split(" ").map { it.toInt() }
    while (x > y - 1 || x > z - 2){
        x = x - 1
    }
    println(3 * x + 3)
}


package com.example.circleprogressbar

import java.lang.Math.min

fun main(args : Array<String>) {
    val (y,b,r) = readInts()
    var c = min(min(y +2, b + 1), r)
    println(c*3-3)
}
private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints


import kotlin.io.*

fun main() {
    var temp = readLine()

    val tokens = temp.split(" ")
    var list = mutableListOf<Int>()
    for (token in tokens) {
        list.add(token.toInt())
    }
    val min = list.min()
    var total = 0
    when {
        list[2] == min -> total = list[2] + (list[2]-1) + (list[2]-2)
        list[1] == min -> total = list[1] + (list[1]-1) + (list[1]+1)
        else -> total = list[0] + (list[0]+1) + (list[0]+2)
    }
    println(total)
}


fun main() {
    val s = readLine()
    val s2 = s.split(' ')
    var yellows = s2[0].toInt()
    var blues = s2[1].toInt()
    var reds = s2[2].toInt()

    if (yellows >= blues) {
        yellows -= (yellows - blues) + 1
    }
    if (blues != yellows + 1) {
        blues = yellows + 1
    }
    if (blues >= reds) {
        blues -= (blues - reds) + 1
        yellows -= (blues - reds) + 2
    }
    if (reds != blues + 1) {
        reds = blues + 1
    }
    print(yellows + blues + reds)
}


fun  main( args :  Array<String>) {

    val str= readLine()!!
    val str = "13 3 6"
    val ar = str.split(" ")
    val y = ar[0].toInt()
    val b = ar[1].toInt()
    val r = ar[2].toInt()
    val n = minOf(y + 1, b, r - 1)
    println(n*3)


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

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

    val numHolds = readInt()
    val heights = readInts()
    var sol = Int.MAX_VALUE
    for (pos in 1 until numHolds - 1) sol = max(heights[pos] - heights[pos - 1],
        min(sol, heights[pos + 1] - heights[pos - 1]))
    sol = max(sol, heights.last() - heights.lastIndex - 1)
    print(sol)
}


fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val lengthArray = readLine()!!.split(" ").asSequence().map { it.toInt() }.toList()

    if (n == 3) {
        println(lengthArray[2] - lengthArray[0])
        return
    }

    var min = lengthArray[1] - lengthArray[0] + lengthArray[2] - lengthArray[1]
    var max = lengthArray[1] - lengthArray[0]

    for (i in 2 until n - 1) {
        val left = lengthArray[i] - lengthArray[i - 1]
        val right = lengthArray[i + 1] - lengthArray[i]

        if (left > max) {
            max = left
        }

        if (left + right < min) {
            min = left + right
        }
    }

    println(if (min > max) min else max)
}


fun main(args: Array<String>) {
    val reader = java.util.Scanner(System.`in`)
    val n = reader.nextInt()
    val c = reader.nextInt()
    val ps = ArrayList<Int>(n)
    val pssum = ArrayList<Int>(n)
    val pssumrev = ArrayList<Int>(n)

    val ts = ArrayList<Int>(n)
    for (i in 1..n) {
        ps.add(reader.nextInt())
        pssum.add(0)
        pssumrev.add(0)
    }

    for (i in 1..n)
        ts.add(reader.nextInt())

    var sum : Int=0
    var sumrev : Int = 0
    for (i in ts.indices) {
        sum += ts[i]
        sumrev += ts[n-i-1]
        pssum[i]=sum
        pssumrev[n-i-1]=sumrev
    }

    val a= ps.zip(pssum){a, b -> if (a<c*b) 0 else a-c*b}.sum()
    val b= ps.zip(pssumrev){a, b -> if (a<c*b) 0 else a-c*b}.sum()
    val r = if (a == b) "Tie" else if (a<b) "Limak" else "Radewoosh"
    println(r)

}


import java.util.*

fun main(args: Array<String>) {

    var sc = Scanner(System.`in`)

    var n = sc.nextInt()
    var a = sc.nextInt()
    val arr= IntArray(n+1)
    for (i in 1 ..n )arr[i]=sc.nextInt()

    var count =0
    for ( i in 1 ..n){
        if(arr[i] == 1 ){
            if (!(2*a-i >=0 && 2*a-i<=n && arr[2*a-i]==0)){
                count++
            }
        }
    }

    println(count)
}


package Codeforces

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

    var max = maxOf(m, list.size - m)
    var left = m - 2
    var right = m
    var count = 0
    var i = 0
    while (i < max) {
        if (left >= 0 && right < list.size) {
            if (list[left] == 1 && list[right] == 1) {
                count += 2
            }
        } else if (left >= 0) {
            if (list[left] == 1) count++
        } else if (right < list.size) {
            if (list[right] == 1) count++
        }
        i++
        right++
        left--
    }
    if (list[m - 1] == 1) {
        count++
    }

    println(count)

}


import java.util.*
fun main(args: Array<String>) {
    var sc = Scanner(System.`in`)
    var n = sc.nextInt()
    var k = sc.nextInt()
    val b= IntArray(n+1)
    for (i in 1 ..n )b[i]=sc.nextInt()

    var c =0
    for ( i in 1 ..n){
        if(b[i] == 1 ){
            var d=i-k
            var j=k-d
            var l=b[j]
            if(j<1||j>n||b[i]==l) c++
        }
    }

    println(c)
}


fun main(){
    var (n,k)=readLine()!!.split(' ').map(String::toInt)
    var a=readLine()!!.split(' ').map(String::toInt)
    var c=0
    for(i in 0..n-1){
        if(a[i]==1){
            var e=i
            var d=e-k
            var j=k-d
            var l=a[j-1]
            if(j<0||j>n-1||a[i]==l) c++
        }
    }
    println(c)
}


import java.util.*
fun main(args: Array<String>) {
    var sc = Scanner(System.`in`)
    var n = sc.nextInt()
    var a = sc.nextInt()
    val b= IntArray(n+1)
    for (i in 1 ..n )b[i]=sc.nextInt()

    var c =0
    for ( i in 1 ..n){
        if(b[i] == 1 ){
            var d=i-k
            var j=k-d
            var l=b[j]
            if(j<1||j>n||b[i]==l) c++
        }
    }

    println(c)
}


import java.io.*
import java.util.*
import java.lang.Math.*

const val STRESS = false
const val STRESS_ITER = 100

data class Solver(val io: FastIO) {
    fun FastIO.solve() {
        val n = nextInt()
        val a = IntList(n / 2, { nextInt() - 1 })
        var a1 = 0
        var a2 = 0
        a.sort()
        for (i in 0 until a.size) {
            a1 += abs(a[i] - i * 2)
            a2 += abs(a[i] - i * 2 - 1)
        }
        println(min(a1, a2))
    }

    fun run() {
        io.use { it.solve() }
    }
}

fun main(args: Array<String>) {
    if (System.getProperty("KLOCAL") != null) {
        if (STRESS) {
            Stresser.doStress()
        } else {
            Solver(FastIO(FileInputStream("input.txt"), System.out)).run()
        }
    } else {
        Solver(FastIO(System.`in`, System.out)).run()
    }
}

data class SlowSolver(val io: FastIO) {
    fun FastIO.slowSolve() {

    }

    fun run() {
        io.use { it.slowSolve() }
    }
}

class Stresser {
    companion object {
        const val INPUT = "input.txt"
        const val OUTPUT = "output.txt"
        const val SLOW = "slow.txt"

        fun PrintWriter.generateTest() {
            val rand = Random(31)

        }

        fun doStress() {
            for (it in 1..STRESS_ITER) {
                System.err.println(it)
                PrintWriter(INPUT).use { it.generateTest() }
                SlowSolver(FastIO(FileInputStream(INPUT), FileOutputStream(SLOW))).run()
                Solver(FastIO(FileInputStream(INPUT), FileOutputStream(OUTPUT))).run()
                compareFiles()
            }
        }

        fun compareFiles() {
            val out = File(OUTPUT).readLines().toMutableList()
            val slw = File(SLOW).readLines().toMutableList()
            while (out.size < slw.size) {
                out.add("\n")
            }
            while (out.size > slw.size) {
                slw.add("\n")
            }
            for (i in 0 until out.size) {
                if (out[i].trimEnd() != slw[i].trimEnd()) {
                    throw AssertionError("\nline ${i + 1}\nout: ${out[i]}\nslw: ${slw[i]}")
                }
            }
        }
    }
}

class FastIO(input: InputStream, output: OutputStream) : PrintWriter(output, false) {
    val br = BufferedReader(InputStreamReader(input))
    var stok = StringTokenizer("")

    fun nextToken(): String? {
        while (!stok.hasMoreTokens()) {
            val s = br.readLine() ?: return null
            stok = StringTokenizer(s)
        }
        return stok.nextToken()
    }

    fun nextInt(): Int {
        return nextToken()!!.toInt()
    }

    fun nextLong(): Long {
        return nextToken()!!.toLong()
    }

    fun nextDouble(): Double {
        return nextToken()!!.toDouble()
    }

    fun print(vararg args: Any?) {
        args.forEachIndexed { i, arg ->
            if (i != 0) {
                print(" ")
            }
            print(arg)
        }
    }

    fun println(vararg args: Any?) {
        print(*args)
        println()
    }
}

class IntList {
    private var a: IntArray
    var size = 0

    constructor() {
        a = IntArray(4)
    }

    constructor(n: Int, x: Int = 0) {
        a = if (x == 0) {
            IntArray(n)
        } else {
            IntArray(n, { x })
        }
        size = n
    }

    constructor(n: Int, init: (Int) -> Int) {
        a = IntArray(n, init)
        size = n
    }

    fun add(x: Int) {
        ensureCapacity()
        a[size++] = x
    }

    fun front(): Int {
        return a[0]
    }

    fun back(): Int {
        return a[size - 1]
    }

    fun pop(): Int {
        return a[--size]
    }

    operator fun get(i: Int): Int {
        return a[i]
    }

    operator fun set(i: Int, x: Int) {
        a[i] = x
    }

    fun removeAt(i: Int) {
        var i = i
        while (i + 1 < size) {
            a[i] = a[i + 1]
            i++
        }
        --size
    }

    fun rotate(distance: Int) {
        if (size == 0)
            return
        var distance = distance % size
        if (distance < 0)
            distance += size
        if (distance == 0)
            return

        var cycleStart = 0
        var nMoved = 0
        while (nMoved != size) {
            var displaced = a[cycleStart]
            var i = cycleStart
            do {
                i += distance
                if (i >= size)
                    i -= size
                val tmp = a[i]
                a[i] = displaced
                displaced = tmp
                nMoved++
            } while (i != cycleStart)
            cycleStart++
        }
    }

    fun isEmpty(): Boolean {
        return size == 0
    }

    operator fun contains(x: Int): Boolean {
        for (i in 0 until size) {
            if (a[i] == x) {
                return true
            }
        }
        return false
    }

    override fun equals(other: Any?): Boolean {
        if (other == null || other !is IntList || size != other.size) {
            return false
        }

        for (i in 0 until size) {
            if (a[i] != other.a[i]) {
                return false
            }
        }

        return true
    }

    operator fun compareTo(other: IntList): Int {
        var i = 0
        while (i < min(size, other.size)) {
            if (a[i] < other.a[i]) {
                return -1
            }
            if (a[i] > other.a[i]) {
                return 1
            }
        }
        if (size < other.size) {
            return -1
        }
        if (size > other.size) {
            return 1
        }
        return 0
    }

    fun sort(from: Int = 0, to: Int = size) {
        a.sort(from, to)
    }

    fun reverse() {
        var i = 0
        while (i * 2 < size) {
            val x = a[i]
            a[i] = a[size - 1 - i]
            a[size - 1 - i] = x
            i++
        }
    }

    fun shuffle(rand: Random = Random()) {
        for (i in 1 until size) {
            val j = rand.nextInt(i + 1)
            if (i != j) {
                val x = a[i]
                a[i] = a[j]
                a[j] = x
            }
        }
    }

    fun nextPermutation(): Boolean {
        var i = size - 2
        while (i >= 0) {
            if (a[i] < a[i + 1]) {
                var b = size - 1
                while (true) {
                    if (a[b] > a[i]) {
                        var t = a[i]
                        a[i] = a[b]
                        a[b] = t
                        ++i
                        b = size - 1
                        while (i < b) {
                            t = a[i]
                            a[i] = a[b]
                            a[b] = t
                            ++i
                            --b
                        }
                        return true
                    }
                    --b
                }
            }
            --i
        }
        return false
    }

    fun forEach(block: (x: Int) -> Unit) {
        for (i in 0 until size) {
            block(a[i])
        }
    }

    fun forEachIndexed(block: (i: Int, x: Int) -> Unit) {
        for (i in 0 until size) {
            block(i, a[i])
        }
    }

    fun getArray(): IntArray {
        return a.copyOf(size)
    }

    private fun ensureCapacity() {
        if (size == a.size) {
            a = a.copyOf(size * 2)
        }
    }
}

class LongList {
    private var a: LongArray
    var size = 0

    constructor() {
        a = LongArray(4)
    }

    constructor(n: Int, x: Long = 0) {
        a = if (x == 0L) {
            LongArray(n)
        } else {
            LongArray(n, { x })
        }
        size = n
    }

    constructor(n: Int, init: (Int) -> Long) {
        a = LongArray(n, init)
        size = n
    }

    fun add(x: Long) {
        ensureCapacity()
        a[size++] = x
    }

    fun front(): Long {
        return a[0]
    }

    fun back(): Long {
        return a[size - 1]
    }

    fun pop(): Long {
        return a[--size]
    }

    operator fun get(i: Int): Long {
        return a[i]
    }

    operator fun set(i: Int, x: Long) {
        a[i] = x
    }

    fun removeAt(i: Int) {
        var i = i
        while (i + 1 < size) {
            a[i] = a[i + 1]
            i++
        }
        --size
    }

    fun rotate(distance: Int) {
        if (size == 0)
            return
        var distance = distance % size
        if (distance < 0)
            distance += size
        if (distance == 0)
            return

        var cycleStart = 0
        var nMoved = 0
        while (nMoved != size) {
            var displaced = a[cycleStart]
            var i = cycleStart
            do {
                i += distance
                if (i >= size)
                    i -= size
                val tmp = a[i]
                a[i] = displaced
                displaced = tmp
                nMoved++
            } while (i != cycleStart)
            cycleStart++
        }
    }

    fun isEmpty(): Boolean {
        return size == 0
    }

    operator fun contains(x: Long): Boolean {
        for (i in 0 until size) {
            if (a[i] == x) {
                return true
            }
        }
        return false
    }

    override fun equals(other: Any?): Boolean {
        if (other == null || other !is LongList || size != other.size) {
            return false
        }

        for (i in 0 until size) {
            if (a[i] != other.a[i]) {
                return false
            }
        }

        return true
    }

    operator fun compareTo(other: LongList): Int {
        var i = 0
        while (i < min(size, other.size)) {
            if (a[i] < other.a[i]) {
                return -1
            }
            if (a[i] > other.a[i]) {
                return 1
            }
        }
        if (size < other.size) {
            return -1
        }
        if (size > other.size) {
            return 1
        }
        return 0
    }

    fun sort(from: Int = 0, to: Int = size) {
        a.sort(from, to)
    }

    fun reverse() {
        var i = 0
        while (i * 2 < size) {
            val x = a[i]
            a[i] = a[size - 1 - i]
            a[size - 1 - i] = x
            i++
        }
    }

    fun shuffle(rand: Random = Random()) {
        for (i in 1 until size) {
            val j = rand.nextInt(i + 1)
            if (i != j) {
                val x = a[i]
                a[i] = a[j]
                a[j] = x
            }
        }
    }

    fun nextPermutation(): Boolean {
        var i = size - 2
        while (i >= 0) {
            if (a[i] < a[i + 1]) {
                var b = size - 1
                while (true) {
                    if (a[b] > a[i]) {
                        var t = a[i]
                        a[i] = a[b]
                        a[b] = t
                        ++i
                        b = size - 1
                        while (i < b) {
                            t = a[i]
                            a[i] = a[b]
                            a[b] = t
                            ++i
                            --b
                        }
                        return true
                    }
                    --b
                }
            }
            --i
        }
        return false
    }

    fun forEach(block: (x: Long) -> Unit) {
        for (i in 0 until size) {
            block(a[i])
        }
    }

    fun forEachIndexed(block: (i: Int, x: Long) -> Unit) {
        for (i in 0 until size) {
            block(i, a[i])
        }
    }

    fun getArray(): LongArray {
        return a.copyOf(size)
    }

    private fun ensureCapacity() {
        if (size == a.size) {
            a = a.copyOf(size * 2)
        }
    }
}

class DoubleList {
    private var a: DoubleArray
    var size = 0

    constructor() {
        a = DoubleArray(4)
    }

    constructor(n: Int, x: Double = .0) {
        a = if (x == .0) {
            DoubleArray(n)
        } else {
            DoubleArray(n, { x })
        }
        size = n
    }

    constructor(n: Int, init: (Int) -> Double) {
        a = DoubleArray(n, init)
        size = n
    }

    fun add(x: Double) {
        ensureCapacity()
        a[size++] = x
    }

    fun front(): Double {
        return a[0]
    }

    fun back(): Double {
        return a[size - 1]
    }

    fun pop(): Double {
        return a[--size]
    }

    operator fun get(i: Int): Double {
        return a[i]
    }

    operator fun set(i: Int, x: Double) {
        a[i] = x
    }

    fun removeAt(i: Int) {
        var i = i
        while (i + 1 < size) {
            a[i] = a[i + 1]
            i++
        }
        --size
    }

    fun rotate(distance: Int) {
        if (size == 0)
            return
        var distance = distance % size
        if (distance < 0)
            distance += size
        if (distance == 0)
            return

        var cycleStart = 0
        var nMoved = 0
        while (nMoved != size) {
            var displaced = a[cycleStart]
            var i = cycleStart
            do {
                i += distance
                if (i >= size)
                    i -= size
                val tmp = a[i]
                a[i] = displaced
                displaced = tmp
                nMoved++
            } while (i != cycleStart)
            cycleStart++
        }
    }

    fun isEmpty(): Boolean {
        return size == 0
    }

    operator fun contains(x: Double): Boolean {
        for (i in 0 until size) {
            if (a[i] == x) {
                return true
            }
        }
        return false
    }

    override fun equals(other: Any?): Boolean {
        if (other == null || other !is DoubleList || size != other.size) {
            return false
        }

        for (i in 0 until size) {
            if (a[i] != other.a[i]) {
                return false
            }
        }

        return true
    }

    operator fun compareTo(other: DoubleList): Int {
        var i = 0
        while (i < min(size, other.size)) {
            if (a[i] < other.a[i]) {
                return -1
            }
            if (a[i] > other.a[i]) {
                return 1
            }
        }
        if (size < other.size) {
            return -1
        }
        if (size > other.size) {
            return 1
        }
        return 0
    }

    fun sort(from: Int = 0, to: Int = size) {
        a.sort(from, to)
    }

    fun reverse() {
        var i = 0
        while (i * 2 < size) {
            val x = a[i]
            a[i] = a[size - 1 - i]
            a[size - 1 - i] = x
            i++
        }
    }

    fun shuffle(rand: Random = Random()) {
        for (i in 1 until size) {
            val j = rand.nextInt(i + 1)
            if (i != j) {
                val x = a[i]
                a[i] = a[j]
                a[j] = x
            }
        }
    }

    fun nextPermutation(): Boolean {
        var i = size - 2
        while (i >= 0) {
            if (a[i] < a[i + 1]) {
                var b = size - 1
                while (true) {
                    if (a[b] > a[i]) {
                        var t = a[i]
                        a[i] = a[b]
                        a[b] = t
                        ++i
                        b = size - 1
                        while (i < b) {
                            t = a[i]
                            a[i] = a[b]
                            a[b] = t
                            ++i
                            --b
                        }
                        return true
                    }
                    --b
                }
            }
            --i
        }
        return false
    }

    fun forEach(block: (x: Double) -> Unit) {
        for (i in 0 until size) {
            block(a[i])
        }
    }

    fun forEachIndexed(block: (i: Int, x: Double) -> Unit) {
        for (i in 0 until size) {
            block(i, a[i])
        }
    }

    fun getArray(): DoubleArray {
        return a.copyOf(size)
    }

    private fun ensureCapacity() {
        if (size == a.size) {
            a = a.copyOf(size * 2)
        }
    }
}

class BooleanList {
    private var a: BooleanArray
    var size = 0

    constructor() {
        a = BooleanArray(4)
    }

    constructor(n: Int, x: Boolean = false) {
        a = if (x == false) {
            BooleanArray(n)
        } else {
            BooleanArray(n, { x })
        }
        size = n
    }

    constructor(n: Int, init: (Int) -> Boolean) {
        a = BooleanArray(n, init)
        size = n
    }

    fun add(x: Boolean) {
        ensureCapacity()
        a[size++] = x
    }

    fun front(): Boolean {
        return a[0]
    }

    fun back(): Boolean {
        return a[size - 1]
    }

    fun pop(): Boolean {
        return a[--size]
    }

    operator fun get(i: Int): Boolean {
        return a[i]
    }

    operator fun set(i: Int, x: Boolean) {
        a[i] = x
    }

    fun removeAt(i: Int) {
        var i = i
        while (i + 1 < size) {
            a[i] = a[i + 1]
            i++
        }
        --size
    }

    fun rotate(distance: Int) {
        if (size == 0)
            return
        var distance = distance % size
        if (distance < 0)
            distance += size
        if (distance == 0)
            return

        var cycleStart = 0
        var nMoved = 0
        while (nMoved != size) {
            var displaced = a[cycleStart]
            var i = cycleStart
            do {
                i += distance
                if (i >= size)
                    i -= size
                val tmp = a[i]
                a[i] = displaced
                displaced = tmp
                nMoved++
            } while (i != cycleStart)
            cycleStart++
        }
    }

    fun isEmpty(): Boolean {
        return size == 0
    }

    operator fun contains(x: Boolean): Boolean {
        for (i in 0 until size) {
            if (a[i] == x) {
                return true
            }
        }
        return false
    }

    override fun equals(other: Any?): Boolean {
        if (other == null || other !is BooleanList || size != other.size) {
            return false
        }

        for (i in 0 until size) {
            if (a[i] != other.a[i]) {
                return false
            }
        }

        return true
    }

    operator fun compareTo(other: BooleanList): Int {
        var i = 0
        while (i < min(size, other.size)) {
            if (a[i] < other.a[i]) {
                return -1
            }
            if (a[i] > other.a[i]) {
                return 1
            }
        }
        if (size < other.size) {
            return -1
        }
        if (size > other.size) {
            return 1
        }
        return 0
    }

    fun reverse() {
        var i = 0
        while (i * 2 < size) {
            val x = a[i]
            a[i] = a[size - 1 - i]
            a[size - 1 - i] = x
            i++
        }
    }

    fun shuffle(rand: Random = Random()) {
        for (i in 1 until size) {
            val j = rand.nextInt(i + 1)
            if (i != j) {
                val x = a[i]
                a[i] = a[j]
                a[j] = x
            }
        }
    }

    fun nextPermutation(): Boolean {
        var i = size - 2
        while (i >= 0) {
            if (a[i] < a[i + 1]) {
                var b = size - 1
                while (true) {
                    if (a[b] > a[i]) {
                        var t = a[i]
                        a[i] = a[b]
                        a[b] = t
                        ++i
                        b = size - 1
                        while (i < b) {
                            t = a[i]
                            a[i] = a[b]
                            a[b] = t
                            ++i
                            --b
                        }
                        return true
                    }
                    --b
                }
            }
            --i
        }
        return false
    }

    fun forEach(block: (x: Boolean) -> Unit) {
        for (i in 0 until size) {
            block(a[i])
        }
    }

    fun forEachIndexed(block: (i: Int, x: Boolean) -> Unit) {
        for (i in 0 until size) {
            block(i, a[i])
        }
    }

    fun getArray(): BooleanArray {
        return a.copyOf(size)
    }

    private fun ensureCapacity() {
        if (size == a.size) {
            a = a.copyOf(size * 2)
        }
    }
}


import kotlin.math.abs
import kotlin.math.min

fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    var arr : Array<Int> = readLine()!!.split(' ').map { it.toInt() }.toTypedArray()
    var moves1 = 0
    var moves2 = 0
    for (i in 1..(n/2)) {
        moves1 += abs(arr[i-1] - (i*2))
        moves2 += abs(arr[i-1] - (i*2 -1))
    }
    println(min(moves1, moves2))
}


import java.io.*
import java.util.*
import kotlin.math.abs
import kotlin.math.min

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

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

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

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

    internal fun nline() = st.nextToken("\n")

    private fun ni(offset: Int = 0) = next().toInt() + offset
    private fun nii(offset: Int = 0) = Pair(ni(offset), ni(offset))
    private fun niii(offset: Int = 0) = Triple(ni(offset), ni(offset), ni(offset))

    private fun nia(n: Int, offset: Int = 0) = IntArray(n) { ni(offset) }
    private fun niaa(m: Int, n: Int, offset: Int = 0) = Array(m) { nia(n, offset) }

    private fun nl(offset: Long = 0L) = next().toLong() + offset
    private fun nll(offset: Long = 0L) = Pair(nl(offset), nl(offset))
    private fun nlll(offset: Long = 0L) = Triple(nl(offset), nl(offset), nl(offset))

    private fun nla(n: Int, offset: Long = 0L) = LongArray(n, { nl(offset) })
    private fun nlaa(m: Int, n: Int, offset: Long = 0L) = Array(m) { nla(n, offset) }

    private fun nd(offset: Double = 0.0) = next().toDouble() + offset
    private fun ndd(offset: Double = 0.0) = Pair(nd(offset), nd(offset))
    private fun nddd(offset: Double = 0.0) = Triple(nd(offset), nd(offset), nd(offset))

    private fun nda(n: Int, offset: Double = 0.0) = DoubleArray(n) { nd(offset) }
    private fun ndaa(m: Int, n: Int, offset: Double = 0.0) = Array(m) { nda(n, offset) }

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

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

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

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

    inline fun p(arr: IntArray?, separator: String = " ", range: IntRange? = arr?.indices) = this.also {
        range?.forEach { prep(it > 0, separator, arr?.get(it)) }
    }

    inline fun p(arr: LongArray?, separator: String = " ", range: IntRange? = arr?.indices) = this.also {
        range?.forEach { prep(it > 0, separator, arr?.get(it)) }
    }

    inline fun p(arr: DoubleArray?, separator: String = " ", range: IntRange? = arr?.indices) = this.also {
        range?.forEach { prep(it > 0, separator, arr?.get(it)) }
    }

    inline fun <T> p(arr: Array<T>?, separator: String = " ", range: IntRange? = arr?.indices) = this.also {
        range?.forEach { prep(it > 0, separator, arr?.get(it)) }
    }

    inline fun <T> p(list: List<T>?, separator: String = " ", range: IntRange? = list?.indices) = this.also {
        range?.forEach { prep(it > 0, separator, list?.get(it)) }
    }

    inline fun <T> p(stack: Stack<T>?, separator: String = " ", range: IntRange? = stack?.indices) = this.also {
        range?.forEach { prep(it > 0, separator, stack?.get(it)) }
    }

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

    inline fun flush() = out.flush()

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

    fun run() {
        val n = ni()
        val p = nia(n / 2, -1)
        var chan = 0
        var count = 0
        for (pi in p) {
            chan += abs(pi - count)
            count += 2
        }

        var le = 0
        count = 1
        for (pi in p) {
            le += abs(pi - count)
            count += 2
        }
        pln(min(chan,le))
    }

}

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


import java.util.*

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

    val r = Array(n / 2) { nextInt() }

    val e = Array(n / 2) { 2 + it * 2 }
    val o = Array(n / 2) { 1 + it * 2 }

    val eSum = (0 until n / 2).sumBy { Math.abs(r[it] - e[it]) }
    val oSum = (0 until n / 2).sumBy { Math.abs(r[it] - o[it]) }

    println(Math.min(eSum, oSum))
}


import kotlin.math.absoluteValue
import kotlin.math.min

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

    readLine()
    val positions = readInts()
    var sol = Int.MAX_VALUE
    for (start in 1..2) {
        var target = start
        var oneSol = 0
        for (position in positions) {
            oneSol += (position - target).absoluteValue
            target += 2
        }
        sol = min(sol, oneSol)
    }
    print(sol)
}


import java.util.*
import kotlin.math.abs
import kotlin.math.min

private val scan = Scanner(System.`in`)

fun main(args: Array<String>) {

    val n = scan.nextLong()
    val a = (0 until n/2).map { scan.nextLong() - 1 }

    val oddSum = a.mapIndexed { index, value -> abs(value - (2 * index + 1)) }.sum()
    val evenSum = a.mapIndexed { index, value -> abs(value - 2 * index) }.sum()

    println(min(oddSum, evenSum))
}


import java.util.Scanner

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var n = scan.nextInt()
    var m = scan.nextInt()
    var a = scan.nextInt()
    var b = scan.nextInt()
    if (n%m==0) print(0)
    else {
        val p=(n+m-1)/m
        if ((n-(m*(p-1)))*b<(m*p-n)*a) print ((n-(m*(p-1)))*b)
        else print ((m*p-n)*a)
    }
}


import java.util.Scanner

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var n = scan.nextLong()
    var m = scan.nextLong()
    var a = scan.nextLong()
    var b = scan.nextLong()
    if (n%m==0) print(0)
    else {
        val p=(n+m-1)/m
        if ((n-(m*(p-1)))*b<(m*p-n)*a) print ((n-(m*(p-1)))*b)
        else print ((m*p-n)*a)
    }
}


import java.util.*
fun main(args: Array<String>) = with(Scanner(System.`in`)) {
    val a = nextInt()
    val b = nextInt()
    val c = nextInt()
    val d = x(a,c) * x(b,c)
    println(d)
}

fun x(a : Int , b:Int) : Long {
    val x = if (a % b == 0) 0 else 1
    return a / b + x
}


fun main(args: Array<String>) {
    val (sn, sm, sa) = readLine()!!.split(' ')
    val n = sn.toInt()
    val m = sm.toInt()
    val a = sa.toInt()

    println((Math.ceil(n/a) * Math.ceil(m/a)).toInt())
}


import kotlin.math.floor

fun main(args: Array<String>) {
    val (n, m, a) = readLine()!!.split(" ").map { it.toDouble() }
    println(floor(n / a) * floor(n / b))
}


fun main(){
    var n = Integer.valueOf(readLine())
    var m = Integer.valueOf(readLine())
    var a = Integer.valueOf(readLine())

    if(n <= a && m<=a){
        println(1)
        return
    }

    if (n<=a){
        if (m % a != 0){
            println(m/a+1)
        }else{
            println(m/a)
        }
        return
    }

    if (m<=a){
        if (n % a != 0){
            println(n/a+1)
        }else{
            println(n/a)
        }
        return
    }

    if(n % a == 0){
        if (m % a != 0) {
            println((m/a+1)*(n/a))
        }else{
            println((m/a)*(n/a))
        }
        return
    }

    if (m % a == 0){
        if (n % a != 0){
            println((n/a+1)*(m/a))
        }else{
            println((n/a)*(m/a))
        }
        return
    }
    if (m % a != 0 &&  n % a != 0){
        println((n/a+1)*(m/a+1))
        return
    }
}


val input = readLine()!!.split(" ")

val n = input[0].toInt()
val m = input[1].toInt()
val a = input[2].toInt()

println((n / a + if (n % a == 0) 0 else 1) * (m / a + if (m % a == 0) 0 else 1))


import java.util.*

fun main(args: Array<String>) {
    val input = Scanner(System.`in`)
    var n:Long = input.nextInt()
    var m:Long = input.nextInt()
    var a:Long = input.nextInt()
    var x:Long = n/a
    var y:Long = m/a
    if(x * a < n){
    	x++
    }
    if(y * a < m){
    	y++
    }
    println(x*y)
}


fun main(args:Array<String>){
    var n = readLine()!!.toInt()
    var m = readLine()!!.toInt()
    var a = readLine()!!.toInt()

    var rows:Int = (n/a) + 1
    var cols:Int = (m/a) + 1

    print(rows+cols)
}


fun main(vararg args: String){
    val n = readLine()!!.toInt()
    val m = readLine()!!.toInt()
    val a = readLine()!!.toInt()
    var count = 0

    for (i in 0 until n step a){
        for (j in 0 until m step a){
            count++
        }
    }

    println(count)
}


fun main(vararg args: String){
    val (first, second, third) = readLine()!!.split(' ')
    val m = first.toInt()
    val n = second.toInt()
    val a = third.toInt()
    var count = 0

    for (i in 0 until n step a){
        for (j in 0 until m step a){
            count++
        }
    }

    println(count)
}


fun main() {
    val (n, m, a) = readLine()!!.split(' ').map(String::toLong)
    println(((n + a - 1) / a) * ((n + a - 1) / a) - if (n % a != 0 && m % a != 0) 1 else 0)
}


package net.imyoyo

import java.util.*

fun main(args: Array<String>) {
    val input = Scanner(System.`in`);
    val n = input.nextInt()
    val m = input.nextInt()
    val a = input.nextInt()
    println(ceilDivide(n.toLong(), a.toLong()) * ceilDivide(m.toLong(), a.toLong()))
}

fun ceilDivide(positiveDividend: Long, positiveDivisor: Long): Long {
    return (positiveDividend + positiveDivisor - 1) / positiveDivisor
}


package codeForces

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

    val res = Math.ceil((n.toDouble() / a)).toLong() * Math.ceil((m.toDouble() / a)).toLong()
    print(res)
}


import kotlin.math.sqrt

private fun divisors(n: Int): List<Int> {
    val ds = mutableListOf<Int>()
    var i = 2
    while (i * i <= n) {
        if (n % i == 0) {
            ds.add(i)
            ds.add(n / i)
        }
        i++
    }
    return ds.toList()
}

private fun isPrime(n:Int) :Boolean {
    var isPrime = true;
    for (i in 2..sqrt(n.toFloat()).toInt())
        if (n%i==0) {isPrime=false; break}
    return isPrime
}

fun solution(ss: String): Boolean {
    val s = ss.trim { it=='0' }
    if (s.length==1) return false
    if (s.all { it==s.first() }) return true
    val ns = s.map { it.toInt() - '0'.toInt() }
    val sum = ns.sum()
    val r =
    when {
        isPrime(sum) -> false
        else -> {
            var canDivide = false
            var l = 0
            forloop@ for (i in divisors(sum)) {
                var b: Int
                whileloop@ while (l <= ns.lastIndex) {
                    canDivide=false
                    b=sum/i
                    while (b > 0 && l<=ns.lastIndex) b -= ns[l++]
                    if (b == 0) {
                        canDivide =  true
                        continue@whileloop
                    }
                    else {
                        l=0
                        canDivide = false
                        continue@forloop
                    }
                }

                if (canDivide) break
            }
            canDivide
        }
    }
    return r
}

fun main(args: Array<String>) {
    readLine()!!
    println(if (solution(readLine()!!)) "YES" else "NO")
}


import kotlin.math.sqrt

private fun divisors(n: Int): List<Int> {
    val ds = mutableListOf<Int>()
    var i = 2
    while (i * i <= n) {
        if (n % i == 0) {
            ds.add(i)
            ds.add(n / i)
        }
        i++
    }
    return ds.toList()
}

private fun isPrime(n:Int) :Boolean {
    var isPrime = true;
    for (i in 2..sqrt(n.toFloat()).toInt())
        if (n%i==0) {isPrime=false; break}
    return isPrime
}

fun solution(s: String): Boolean {
    if (s.all { it==s.first() }) return true
    val ns = s.map { it.toInt() - '0'.toInt() }
    val sum = ns.sum()
    val r =
    when {
        isPrime(sum) -> false
        else -> {
            var canDivide = false
            var l = 0
            forloop@ for (i in divisors(sum)) {
                var b: Int
                whileloop@ while (l < ns.size) {
                    b=i
                    while (b > 0) b -= ns[l++]
                    if (b == 0)
                        continue@whileloop
                    else
                        continue@forloop
                }
                canDivide = true
            }
            canDivide
        }
    }
    return r
}

fun main(args: Array<String>) {
    readLine()!!
    println(if (solution(readLine()!!)) "YES" else "NO")
}


import org.junit.jupiter.api.Test

import org.junit.jupiter.api.Assertions.*

internal class _1058KtTest {

    @Test
    fun solution() {
        assertEquals(true,solution("73452"))
        assertEquals(false,solution("1248"))
        assertEquals(true, solution("00"))
        assertEquals(true,solution("999999999999999999999999999999999999999999999918888888888888888888888888888888888888888888888888887"))
        assertEquals(false, solution("24954512677"))
    }
}


package ru.hse.spb

fun checkIn(character: Char, maxChar: Char) = character in 'a'..maxChar

fun main() {
    val numberOfRequiredLetters = readLine()?.toInt()
    val pattern = readLine()

    if (numberOfRequiredLetters == null || pattern == null) {
        println("Wrong input")
        return
    }

    val sz = pattern.length
    var free = 0
    val maxChar = ('a' + numberOfRequiredLetters - 1)
    val unusedChars = ('a'..maxChar).toHashSet()
    val stringArray = Array(sz) {'?'}

    for ((i, j) in (0 until sz).zip(sz - 1 downTo 1)) {
        val first = pattern[i]
        val second = pattern[j]

        if (first == '?' && second == '?') {
            free++
            continue
        }

        if (first == '?') {
            stringArray[i] = second
            stringArray[j] = second
        } else {
            stringArray[i] = first
            stringArray[j] = first
        }

        if (!checkIn(stringArray[i], maxChar)) {
            println("IMPOSSIBLE")
            return
        }
        unusedChars.remove(stringArray[i])
    }

    if (free < unusedChars.size) {
        println("IMPOSSIBLE")
        return
    }

    for ((i, j) in (0 until sz).zip(sz - 1 downTo 1)) {
        if (stringArray[i] != '?') {
            continue
        }

        val unusedCharacter = unusedChars.firstOrNull() ?: 'a'
        stringArray[i] = unusedCharacter
        stringArray[j] = unusedCharacter
        unusedChars.remove(unusedCharacter)
    }

    println(stringArray.joinToString(separator = ""))
}


package ru.hse.spb

import java.util.*

fun main(args: Array<String>) {
    val input = Scanner(System.`in`)
    val k = input.nextInt()
    val pattern: String = input.next()

    val len = pattern.length
    var possible = true
    var free = 0

    val answer = CharArray(len)
    val used = BooleanArray(k)

    loop@ for (symbol in pattern) {
        val number = symbol.minus('a')
        when {
            number < 0 -> continue@loop
            number >= k -> possible = false
            else -> used[number] = true
        }
    }

    for (index in 0..(len - 1) / 2) {
        val left = pattern[index]
        val right = pattern[len - 1 - index]

        when {
            left != '?' && right != '?' && left != right -> possible = false
            left == '?' && right != '?' -> {
                answer[index] = right
                answer[len - 1 - index] = right
            }
            left != '?' && right == '?' -> {
                answer[index] = left
                answer[len - 1 - index] = left
            }
            left == '?' && right == '?' -> free++
            left == right -> {
                answer[index] = left
                answer[len - 1 - index] = right
            }
        }
    }

    val need = k - (used.filter { it }).size
    free -= need

    var currentPosition = 0
    (0..(len - 1) / 2)
            .asSequence()
            .filter { pattern[it] == '?' && pattern[len - 1 - it] == '?' }
            .forEach {
                if (free-- > 0) {
                    answer[it] = 'a'
                    answer[len - 1 - it] = 'a'
                } else {
                    while (currentPosition < k && used[currentPosition]) {
                        currentPosition++
                    }

                    if (currentPosition >= k) {
                        possible = false
                    }
                    val symbol = 'a'.plus(currentPosition++)
                    answer[it] = symbol
                    answer[len - 1 - it] = symbol
                }
            }

    if (possible) {
        println(String(answer))
    } else {
        println("IMPOSSIBLE")
    }
}


package ru.spbau.mit

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

class Solver(k: Int, private val bookTitle: CharArray) {
    companion object {
        fun read(inputStream: InputStream) : Solver {
            val input = Scanner(inputStream)
            val k = input.nextInt()
            val bookTitle = input.next().toCharArray()
            return Solver(k, bookTitle)
        }

        val IMPOSSIBLE = "IMPOSSIBLE".toCharArray()
    }

    private val unusedLetters  = (('a' until 'a' + k) - bookTitle.toSortedSet()).toSortedSet()
    private val halfOfBookTitleSize = bookTitle.size / 2

    fun solve(): CharArray {
        if (!removePairedQuestionMarks())
            return IMPOSSIBLE
        if (!removeSingleQuestionMarks())
            return IMPOSSIBLE
        return bookTitle
    }

    private fun removeSingleQuestionMarks(): Boolean {
        var i = 0
        while (i < halfOfBookTitleSize) {
            val correspondingIndex = getCorrespondingIndex(i)
            if (bookTitle[i] == '?' || bookTitle[correspondingIndex] == '?') {
                if (bookTitle[i] == '?') {
                    bookTitle[i] = bookTitle[correspondingIndex]
                } else {
                    bookTitle[correspondingIndex] = bookTitle[i]
                }
            } else {
                if (bookTitle[i] != bookTitle[correspondingIndex]) {
                    return false
                }
            }
            i++
        }
        return true
    }

    private fun removePairedQuestionMarks(): Boolean {
        var i = halfOfBookTitleSize
        while (i < bookTitle.size) {
            val correspondingIndex = getCorrespondingIndex(i)
            if (bookTitle[i] == '?' && bookTitle[correspondingIndex] == '?') {
                bookTitle[i] = getAndExtractMaxUnusedLetterOrA()
                bookTitle[correspondingIndex] = bookTitle[i]
            }
            i++
        }
        return unusedLetters.isEmpty()
    }

    private fun getAndExtractMaxUnusedLetterOrA(): Char {
        if (unusedLetters.isEmpty())
            return 'a'
        val lastFromUnusedLetters = unusedLetters.last()
        unusedLetters.remove(lastFromUnusedLetters)
        return lastFromUnusedLetters
    }

    private fun getCorrespondingIndex(i: Int): Int = bookTitle.size - i - 1
}

fun main(args: Array<String>) {
    print(Solver.read(System.`in`).solve())
}


package ru.spbau.mit

import java.util.*

class Solver(k: Int, internal val bookTitle: CharArray) {
    companion object {
        private val IMPOSSIBLE = "IMPOSSIBLE".toCharArray()
    }
    private val unusedLetters: ArrayDeque<Char>
    init {
        val firstKLetters = 'a' until 'a' + k
        val usedLetters = bookTitle.toSet()
        unusedLetters = ArrayDeque(firstKLetters - usedLetters)
    }

    fun solve(): CharArray {
        val ok = removePairedQuestionMarks() && removeSingleQuestionMarks()
        return if (ok) bookTitle else IMPOSSIBLE
    }

    internal fun removeSingleQuestionMarks(): Boolean {
        for (i in 0 until bookTitle.size / 2) {
            val currentSymbol = bookTitle[i]
            val correspondingIndex = i.getCorrespondingIndex
            val correspondingSymbol = bookTitle[correspondingIndex]
            when {
                currentSymbol == '?' -> bookTitle[i] = correspondingSymbol
                correspondingSymbol == '?' -> bookTitle[correspondingIndex] = currentSymbol
                currentSymbol != correspondingSymbol -> return false
            }
        }
        return true
    }

    internal fun removePairedQuestionMarks(): Boolean {
        for (i in 0 until bookTitle.size / 2) {
            val currentSymbol = bookTitle[i]
            val correspondingIndex = i.getCorrespondingIndex
            val correspondingSymbol = bookTitle[correspondingIndex]
            if (currentSymbol == '?' && correspondingSymbol == '?') {
                bookTitle[i] = getAndExtractMaxUnusedLetterOrA()
                bookTitle[correspondingIndex] = bookTitle[i]
            }
        }
        return unusedLetters.isEmpty()
    }

    private fun getAndExtractMaxUnusedLetterOrA(): Char {
        return if (unusedLetters.isEmpty()) 'a' else unusedLetters.removeLast()
    }

    private val Int.getCorrespondingIndex:Int get() = bookTitle.size - this - 1
}

fun main(args: Array<String>) {
    val input = Scanner(System.`in`)
    val k = input.nextInt()
    val bookTitle = input.next().toCharArray()
    print(Solver(k, bookTitle).solve())
}


/**
 * Class that solves codeforces problem.
 * It tries to replace wild cards(?) to letters to create lexicographically smallest palindrome.
 */
class PatternHandler(private val pattern: CharArray,
                     private val alphabet: Int) {

    private val IMPOSSIBLE_MESSAGE = "IMPOSSIBLE"
    private val usedChars = BitSet(alphabet)

    init {
        pattern
                .filter { it != '?' }
                .map { getIndex(it) }
                .forEach { usedChars[it] = true }
    }

    /**
     * Returns index of symbol in usedChars array
     */
    private fun getIndex(symbol: Char): Int = symbol - 'a'

    /**
     * Returns index of symbol in usedChars array
     */
    private fun getSymbol(index: Int): Char = 'a' + index

    /**
     * Get index letter that should be on the wild card sign.
     * It's take the most biggest lexicographically letter,
     * because we are starting to remove wild cards from center of the palindrome.
     */
    private fun getAppropriateLetterIndex(): Int {
        val index = usedChars.previousClearBit(alphabet - 1)

        return if (index == -1) {
            0
        } else {
            index
        }
    }

    /**
     * l, r -- indices in pattern.
     * If they are both wild cards they will be replaced by most biggest lexicographically letter.
     */
    private fun removeWildCardPairs(l: Int, r: Int) {
        if (pattern[l] == '?' && pattern[r] == '?') {
            val letterIndex = getAppropriateLetterIndex()
            val letter = getSymbol(letterIndex)
            usedChars[letterIndex] = true
            pattern[l] = letter
            pattern[r] = letter
        }
    }

    /**
     * Cleaning rest of wild cards.
     * If there any of chars at indices l, r equals wild card, then it should be replaced by another char.
     */
    private fun cleanWildCards(l: Int, r: Int) {
        if (pattern[l] == '?') {
            pattern[l] = pattern[r]
        }

        if (pattern[r] == '?') {
            pattern[r] = pattern[l]
        }
    }

    /**
     * Solving codeforces task.
     * It returns processed symmetric palindrome if it's possible.
     * Otherwise it returns IMPOSSIBLE_MESSAGE
     */
    fun solve(): String {
        if (alphabet > pattern.size) {
            return IMPOSSIBLE_MESSAGE
        }

        var r = pattern.size / 2
        while (r < pattern.size) {
            val indent = r - pattern.size / 2
            val l = r - (pattern.size + 1) % 2 - 2 * indent

            // process pattern
            removeWildCardPairs(l, r)
            cleanWildCards(l, r)

            if (pattern[l] != pattern[r]) {
                return IMPOSSIBLE_MESSAGE
            }

            r++
        }

        if (usedChars.cardinality() != alphabet) {
            return IMPOSSIBLE_MESSAGE
        }

        return String(pattern)
    }
}

/**
 * CLI for task: http://codeforces.com/contest/59/problem/C
 * Successful submission: http://codeforces.com/contest/59/my
 * Input contains of two lines. At the first line there is a number k.
 * On the second line there is pattern for constructing palindrome.
 */
fun main(args: Array<String>) {
    val k = Integer.parseInt(readLine())
    val pattern = readLine()!!
    val result = PatternHandler(pattern.toCharArray(), k).solve()
    print(result)
}


package ru.hse.spb

import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashSet
import kotlin.math.PI
import kotlin.math.atan

data class Vector(val xCoordinate : Int, val yCoordinate : Int, val identifier : Int)

fun getVectorAngle(vector : Vector) =
        when {
            vector.xCoordinate > 0 -> atan(vector.yCoordinate / vector.xCoordinate.toDouble())
            vector.xCoordinate < 0 -> PI + atan(vector.yCoordinate / vector.xCoordinate.toDouble())
            else ->
                if (vector.yCoordinate > 0) {
                    PI / 2
                } else {
                    -PI / 2
                }
        }

fun readVectors() : ArrayList<Vector> {
    val reader = Scanner(System.`in`)
    val vectorsNumber = reader.nextInt()
    val listOfVectors = ArrayList<Vector>()

    for (identifier in 1..vectorsNumber) {
        val xCoordinate = reader.nextInt()
        val yCoordinate = reader.nextInt()
        val vector = Vector(xCoordinate, yCoordinate, identifier)

        listOfVectors.add(vector)
    }

    return listOfVectors
}

fun getNearliestVectorPair(listOfVectors : ArrayList<Vector>) : Pair<Vector, Vector> {
    listOfVectors.sortWith(compareByDescending { getVectorAngle(it) })

    var bestAngleDifference : Double = 2 * PI + getVectorAngle(listOfVectors.last()) - getVectorAngle(listOfVectors.first())
    var bestFirstIndex = 0
    var bestSecondIndex = listOfVectors.size - 1

    for (i in 0 until listOfVectors.size - 1) {
        val angleDifference = getVectorAngle(listOfVectors[i]) - getVectorAngle(listOfVectors[i + 1])

        if (angleDifference < bestAngleDifference) {
            bestFirstIndex = i
            bestSecondIndex = i + 1
            bestAngleDifference = angleDifference
        }
    }

    return Pair(listOfVectors[bestFirstIndex], listOfVectors[bestSecondIndex])
}

fun getSymbolsFromString(string : String) : HashSet<Char> {
    val stringSymbols = HashSet<Char>()
    for (symbol in string) {
        if (!stringSymbols.contains(symbol)) {
            stringSymbols.add(symbol)
        }
    }

    return stringSymbols
}

fun getStringMissingSymbols(string: String) : ArrayList<Char> {
    val stringSymbols = getSymbolsFromString(string)
    val missingSymbols = ArrayList<Char>()

    for (symbol in 'a'..'z') {
        if (!stringSymbols.contains(symbol)) {
            missingSymbols.add(symbol)
        }
    }

    return missingSymbols
}

fun hasAnswer(string: String) : Boolean {
    for (i in 0..(string.length + 1) / 2) {
        if (string[i] != '?' && string[string.length - 1 - i] != '?') {
            if (string[i] != string[string.length - 1 - i]) {
                return false
            }
        }
    }

    return true
}

fun solveProblem(string: String, mustHaveCharsNumber : Int) : ArrayList<Char>? {
    val chars = ArrayList<Char>()
    val missingSymbols = getStringMissingSymbols(string)
    var index = 0

    if (!hasAnswer(string)) {
        return null
    }

    for (char in string) {
        chars.add(char)
    }

    for (i in 0 until (string.length + 1) / 2) {
        if (string[i] == '?' && string[string.length - 1 - i] == '?') {
            if (index == missingSymbols.size) {
                chars[i] = 'a'
                chars[string.length - 1 - i] = 'a'
            } else {
                chars[i] = missingSymbols[index]
                chars[string.length - 1 - i] = missingSymbols[index]
                index++
            }
        } else if (string[i] == '?') {
            chars[i] = string[string.length - 1 - i]
            chars[string.length - 1 - i] = string[string.length - 1 - i]
        } else {
            chars[i] = string[i]
            chars[string.length - 1 - i] = string[i]
        }
    }

    return if (index < missingSymbols.size && missingSymbols[index] - 'a' <= mustHaveCharsNumber) {
        chars
    } else {
        null
    }
}

fun main() {
    val reader = Scanner(System.`in`)
    val mustHaveCharsNumber = reader.nextInt()
    val string = reader.next()
    val resultString = solveProblem(string, mustHaveCharsNumber)

    if (resultString == null) {
        print("IMPOSSIBLE")
    } else {
        for (char in resultString) {
            print(char)
        }
    }
}