// codeforces 224A
object Parallelipiped extends App {
  val ss = (Console.readLine.split(" ")) map (_.toInt)
  val sxy = ss(0)
  val syz = ss(1)
  val sxz = ss(2)

  def lxyz():Int = {
    val vars = for {
      x <- 1 to 10000
      if sxy % x == 0
      val y = sxy / x
      if syz % y == 0
      val z = syz / y
      if x*z == sxz
    } yield (x + y + z)
    vars(0) * 4
  }

  println(lxyz())
}

import java.util.Scanner
import java.io.PrintWriter
import scala.annotation.tailrec
import scala.collection.mutable
import scala.util.Random

object P224A extends App {
  val sc = new Scanner(System.in)
  val out = new PrintWriter(System.out)

  val X, Y, Z = sc.nextLong

  val xyz = math.sqrt(X * Y * Z).round

  val a = xyz / X
  val b = xyz / Y
  val c = xyz / Z

  val answer = 4 * (a + b + c)

  out.println(answer)
  out.close
}

import java.io._
import java.util.Locale
import scala.annotation.tailrec

object Easy {
  val reader = new BufferedReader(new InputStreamReader(System.in))
  def readInt = reader.readLine().toInt
  def readInts = reader.readLine().split(" ").map(_.toInt)
  def readLongs = reader.readLine().split(" ").map(_.toLong)

  val Array(ab, bc, ac) = readInts
  def intStream(i: Int): Stream[Int] = i #:: intStream(i + 1)
  def a = intStream(1).filter(ab % _ == 0).filter(ac % _ == 0)
  def ans = a.filter(a => ab / a  * ac / a == bc).head

  def main(a: Array[String]) {
    println(4 * (ans + ab / ans + ac / ans))
  }
}

object test5 extends App {
    val Array(x,y,z)=readLine.split(" ").map(_.toInt)
    for(a<-1 to x if x%a==0)
    {
		val b=x/a
		if(y%a==0)
		{
			val c=y/a
			if(b*c==z)
			{
				println((a+b+c)*4)
				exit
			}
		}
    }
}

/*
a*b=x

a*c=y && b*c=z ||
b*c=y && a*c=z
*/

object Main {
  def main(args: Array[String]) {
    val ss = readLine().split(" ").map(_.toInt).sorted
    val s1 = ss(0)
    val s2 = ss(1)
    val s3 = ss(2)

    val ls0 = for {
      i <- 1 to s1
      j = (s1 / i).toInt
      if i * j == s1
    } yield(i, j)
    val ls = for {
      (i, j) <- ls0
      k = (ss(1) / i).toInt
      if i * k == s2
      if j * k == s3
    } yield(i, j, k)
    println((ls(0)._1 + ls(0)._2 + ls(0)._3) * 4)
  }
}

import collection.mutable.ArrayBuffer
import java.io.InputStreamReader
import java.io.BufferedReader
import scala.collection.JavaConversions._

object CodeForces138_1 {

  val in = System.in
  val out = System.out

  def grabData {
    val reader = new BufferedReader(new InputStreamReader(in))
    //val array = new ArrayBuffer[]()
    var line = reader.readLine()
    while(line != null) {

      line = reader.readLine()
    }
    //array
  }

  def grabData2 = {
    val reader = new BufferedReader(new InputStreamReader(in))
    val line = reader.readLine()
    line.split(' ').toSeq.map(_.toInt)
  }

  def main(args: Array[String]) {
    val sses = grabData2
    val s1:Double = sses(0)
    val s2:Double = sses(1)
    val s3:Double = sses(2)
    val c = Math.sqrt(s2*s3/s1)
    val a = s3/c
    val b = s2/c
    out.print(((c+a+b)*4).toInt)
  }

}

object A {
    def main(args : Array[String]) : Unit = {
        val Array(x, y, z) = readLine.split(" ").map(s => s toInt);

        def side(x : Int, y : Int, z : Int) : Double = {
            scala.math.sqrt(x * y / z)
        }

        val sm = side(x, y, z) + side(y, z, x) + side(z, x, y)

        println((4 * sm) toInt)
    }
}

import java.util.StringTokenizer

object _224A extends App {
  var token = new StringTokenizer("")

  def next = {
    while (!token.hasMoreTokens()) token = new StringTokenizer(readLine)
    token.nextToken()
  }

  val a = next.toInt
  val b = next.toInt
  val c = next.toInt
  val cb = a.toLong * b * c
  val wb = Math.sqrt(cb).round
  val zb = (for {
    i <- (wb - 10) to (wb + 10)
    if (i > 0)
    if (i * i == cb)
  } yield i).head

  val t = zb / a
  val tt = zb / b
  val ttt = zb / c
  println(4 * (t + tt + ttt))
}

object Solution extends App {
  val in = scala.io.Source.stdin.getLines()
  val Array(x1, x2, x3) = in.next().split(' ').map(_.toInt)

  def findSolution(x1: Int, x2: Int, x3: Int) = {
    (1 to x1).collectFirst {
      case a if x3 == x2 / a * x1 / a =>
        (a, x2 / a, x1 / a)
      case a if x2 == x3 / a * x1 / a =>
        (a, x3 / a, x1 / a)
    }
  }

  println(findSolution(x1, x2, x3).map(i => 4 * (i._1 + i._2 + i._3)).get)

}

object A224 {

  import IO._
  import collection.{mutable => cu}
  def gcd(a: Long, b: Long): Long = {
    if(b == 0) a else gcd(b, a%b)
  }
  def main(args: Array[String]): Unit = {
    val in = readLongs(3).sorted
    var break = false
    for(i <- 1 to in.min.toInt if !break) {
      val a = i
      val b = in(0)/a
      val c = in(2)/a
      if(b*c == in(1)) {
        println(4 * (a + b + c))
        break = true
      }
    }
  }

  object IO {
    @inline def read: String = scala.io.StdIn.readLine

    @inline def tokenizeLine = new java.util.StringTokenizer(read)

    def readInts(n: Int): Array[Int] = {
      val tl = tokenizeLine;
      Array.fill(n)(tl.nextToken.toInt)
    }

    def readLongs(n: Int): Array[Long] = {
      val tl = tokenizeLine;
      Array.fill(n)(tl.nextToken.toLong)
    }

    def readBigs(n: Int): Array[BigInt] = {
      val tl = tokenizeLine;
      Array.fill(n)(BigInt(tl.nextToken))
    }
  }

}

object A224 {

  import IO._
  import collection.{mutable => cu}
  def gcd(a: Long, b: Long): Long = {
    if(b == 0) a else gcd(b, a%b)
  }
  def main(args: Array[String]): Unit = {
    val in = readLongs(3)
    var break = false
    for(i <- 1 to in.min.toInt if !break) {
      val a = i
      val b = in(0)/a
      val c = in(2)/a
      if(b*c == in(1)) {
        println(4 * (a + b + c))
        break = true
      }
    }
  }

  object IO {
    @inline def read: String = scala.io.StdIn.readLine

    @inline def tokenizeLine = new java.util.StringTokenizer(read)

    def readInts(n: Int): Array[Int] = {
      val tl = tokenizeLine;
      Array.fill(n)(tl.nextToken.toInt)
    }

    def readLongs(n: Int): Array[Long] = {
      val tl = tokenizeLine;
      Array.fill(n)(tl.nextToken.toLong)
    }

    def readBigs(n: Int): Array[BigInt] = {
      val tl = tokenizeLine;
      Array.fill(n)(BigInt(tl.nextToken))
    }
  }

}


import scala.collection.mutable._
import scala.math._
import scala.util.control.Breaks.break
import scala.util.control.Breaks.breakable
import java.util._
object Main extends App {
  val sc = new Scanner(System.in)
  def gcd(a: Int, b: Int): Int = if(b == 0) a else gcd(b, a%b)
  var t = Array[Int](sc.nextInt,sc.nextInt)
  var n = sc.nextInt
  def sim(s: Int): Int = {
    val g = gcd(n,t(s))
    val ns = (s+1)%2
    if(n < g) ns
    else { n-=g; sim(ns) }
  }
  println(sim(0))
}

import scala.util.Sorting
import scala.io.StdIn

object App {

  def main(args: Array[String]) {

    val Array(a, b, n) = StdIn.readLine().split(" ").map(_.toInt)

    val A:Array[Int] = Array(a,b)
    var cur = 0
    var curn = n
    while(gcd(curn,A(cur)) <= curn) {
      curn-=gcd(curn,A(cur));
      if(cur == 0) {
        cur = 1
      } else {
        cur = 0
      }
    }
    if(cur == 0) {
      cur = 1
    } else {
      cur = 0
    }
    print(cur)

    def gcd(x:Int, y:Int):Int = {
      if(x % y == 0)
        y
      else
        gcd( y % x, x)
    }

  }

}

import java.util.Scanner

object TEST extends App {
  val a : Array[Int] = readLine.split(" ").map(_.toInt)

  def gcd(x: Int, y: Int): Int = if(y==0) x else gcd(y,x%y)

  def play(state :Int,n: Int):Int =if(n==0)  state^1 else  play(state^1,n-gcd(n,a(state)))

  print(play(0,a(2)))
}

import scala.annotation.tailrec
object Main {

  def main(args: Array[String]): Unit = {
    @tailrec
    def gcd(x:Int,y:Int):Int= y match{
      case 0 => return x;
      case _ => return gcd(y,x%y);
    }
    var fix = readLine().split(" ").map(_.toInt)
    @tailrec
    def rec(t:Int,n:Int):Int= n match{
      case _ if gcd(fix(t),n)>n => return 1-t;
      case _ => return rec(1-t,n-gcd(fix(t),n))
    }
    println(rec(0,fix(2)))
  }

}

import scala.annotation.tailrec
object Main {

  def main(args: Array[String]): Unit = {
    @tailrec
    def gcd(x:Int,y:Int):Int={
      if(y==0)return x;
      return gcd(y,x%y);
    }
    var fix = readLine().split(" ").map(_.toInt)
    @tailrec
    def rec(t:Int,n:Int):Int={
      val req = gcd(fix(t),n)
      if(req>n)return 1-t;
      return rec(1-t,n-req)
    }
    println(rec(0,fix(2)))
  }

}

import scala.collection.immutable.Nil

object A00119 extends App {
  def parseInt(str: String, count: Int): Seq[Int] = {
    val scanner = new java.util.Scanner(str)
    val res = (1 to count) map (_ => scanner.nextInt())
    scanner.close()
    res
  }
  def scanInts(count: Int): Seq[Int] = parseInt(Console.readLine, count)
  def readMatrix(row: Int, col: Int) = (1 to row) map (x => scanInts(col))

  def oneIntLine = {
    val Seq(count) = parseInt(Console.readLine(), 1);
    count
  }

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

  def nextVals(x: (Int, Int, Int)): (Int, Int, Int) =
    if (x._3 == 0) null
    else (x._2, x._1, x._3 - gcd(x._1, x._3))

  def valStream(x: (Int, Int, Int)): Stream[(Int, Int, Int)] = {
    val n = nextVals(x)
    if (n == null) Stream.Empty
    else x #:: valStream(n)
  }

  val Seq(a, b, n) = readMatrix(1, 3).head

  println((valStream((a, b, n)).length - 1) % 2)

}

object Main {

    def gcd(x: Int, y: Int): Int = {
        var a = x; var b = y
        while (b > 0) {
            a %= b
            val k = a
            a = b
            b = k
        }
        return a
    }

    def main(args: Array[String]): Unit = {
        var Array(a, b, n) = readLine split " " map(_.toInt)
        var cur = 1
        while (n > 0) {
            val k = if (cur == 1) a else b
            n -= gcd(k, n)
            cur += 1;
            cur %= 2
        }

        println (cur)
    }
}

object One19A extends App {

	val Array(a, b, n) = readLine.split(' ').map(_.toInt)

	def recursive(tog: Boolean, left: Int): Boolean = if (tog) {
		val cal = left - gcd(a, left)
		if (cal >= 0) recursive(!tog, cal) else tog
	} else {
		val cal = left - gcd(b, left)
		if (cal >= 0) recursive(!tog, cal) else tog
	}

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

	if (recursive(true, n)) {
		println(1)
	} else {
		println(0)
	}
}

import scala.io.StdIn

object Main extends App {
  val str = StdIn.readLine().split(" ").map(_.toInt)
  val a = str(0)
  val b = str(1)
  var n = str(2)
  var moveCount = 0

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

  while(n >= 0) {
    if (moveCount == 0) {
      val move = gcd(a, n)
      n = n - move
      moveCount = 1
    } else {
      val move = gcd(b, n)
      n = n - move
      moveCount = 0
    }
  }

  if (moveCount == 1) println(1)
  else println(0)
}

object Solutuin119A extends App {

  def norm(a: Int, b: Int): (Int, Int) = (scala.math.min(a,b), scala.math.max(a, b))

  def gcd(a: Int, b: Int): Int = {
    val n = norm(a, b)
    n._2 % n._1 match {
      case 0 => n._1
      case m => gcd(m, n._1)
    }
  }

  def solution() {
    val a = _int
    val b = _int
    val n = _int
    val qqq = Map(0 -> a, 1 -> b)

    def wins(n: Int, turn: Int): Int = n match {
      case 0 => (turn + 1) % 2
      case _ => wins(n - gcd(n, qqq(turn)), (turn + 1) % 2)
    }

    println(wins(n, 0))
  }

  //////////////////////////////////////////////////
  import java.util.Scanner
  val SC: Scanner = new Scanner(System.in)
  def _line: String = SC.nextLine
  def _int: Int = SC.nextInt
  def _long: Long = SC.nextLong
  def _string: String = SC.next
  solution()
}

object Solution extends App{
  def gcd(a: Int, b: Int): Int = {
    if(b == 0) a else gcd(b, a % b)
  }

  val in = scala.io.Source.stdin.getLines()
  var Array(a, b, n) = in.next().split(" ").map(_.toInt)
  var count = 0
  var take = gcd(a, n)
  while (n > take) {
    n -= take
    count += 1
    if (count % 2 == 1)
      take = gcd(b, n)
    else
      take = gcd(a, n)
  }
  println(count % 2)
}

import scala.collection.JavaConversions._
import scala.collection.mutable.ArraySeq

object Codeforces119A {
    def gcd(a: Int,b: Int): Int = {
       if(b ==0) a else gcd(b, a%b)
    }

    def main(args: Array[String]) {
        val arr: ArraySeq[Int] = scala.io.StdIn.readLine().split(" ").map(Integer.parseInt)
        var currentPlayer = 0       // Simon
        var g: Int = 0
        while (arr(2) >= 0) {
            g = gcd(arr(currentPlayer), arr(2))
            if (arr(2) < g) {
                println(1-currentPlayer)
                return
            }
            else {
                arr(2) -= g
                currentPlayer = 1 - currentPlayer
            }
        }
    }
}

object A119 {
  @inline def tokenizeLine = new java.util.StringTokenizer(scala.io.StdIn.readLine)

  def readInts(n: Int) = {
    val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt)
  }

  def readLongs(n: Int) = {
    val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toLong)
  }

  def readBigs(n: Int) = {
    val tl = tokenizeLine; Array.fill(n)(BigInt(tl.nextToken))
  }

  def gcd(a: Int, b: Int): Int = if(b==0) a else gcd(b, a%b)
  def main(args: Array[String]): Unit = {
    var Array(a, b, n) = readInts(3)
    val arr = Array(a, b)
    var player = 0
    while(n > 0) {
      val gc = gcd(arr(player), n)
      n -= gc
      player = 1-player
    }
    println(1-player)
  }
}

import java.util.Scanner
import java.io.PrintWriter
import scala.annotation.tailrec
import scala.collection.mutable
import scala.util.Random

object P119A extends App {
  val sc = new Scanner(System.in)
  val out = new PrintWriter(System.out)

  val A, B, N = sc.nextInt

  @tailrec
  def euclid(a: Int, b: Int): Int =
    if (b == 0) a
    else euclid(b, a % b)

  def gcd(a: Int, b: Int): Int =
    if (a > b) euclid(a, b)
    else euclid(b, a)

  def antisimon(x: Int): Int = {
    val r = gcd(x, B)
    if (x < r) 0
    else simon(x - r)
  }

  def simon(x: Int): Int = {
    val r = gcd(x, A)
    if (x < r) 1
    else antisimon(x - r)
  }

  val solve: Int = simon(N)

  out.println(solve)
  out.close
}

object EpicGame {
	def main (args: Array[String]) {
		val scanner = new java.util.Scanner(System.in);
		val a = scanner.nextInt();
		val b = scanner.nextInt();
		var n = scanner.nextInt();
		var turn = 0 // 0 for Simon's turn
		while (n > 0) {
		  n -= gcd(n, if (turn == 0) a else b)
		  turn = 1 - turn
		}
		print(1 - turn)
	}

	def gcd (x: Int, y: Int) : Int = {
	  if (x > y) {
	    gcd(x - y, y)
	  }
	  else {
	    if (x == y) {
	      x
	    }
	    else {
	      gcd (x, y - x)
	    }
	  }

	}
}

object Codeforces119A extends App{

  def GCDFind(first:Int,second:Int):Int={
    var a:Int=first
    var b:Int=second
    var temp:Int=0
    if (b>a){
      temp=a
      a=b
      b=temp
    }
    temp=b
    while((a%temp!=0)||(b%temp!=0)){
      temp=a-(a/b)*b
      a=b
      b=temp
    }
    return temp
  }

  def EpicGame(simon:Int,antisimon:Int,totalstone:Int):Int={
    var currentstone:Int=totalstone
    var temp:Int=0
    while(currentstone!=0){
      temp=GCDFind(simon,currentstone)
      currentstone = currentstone-temp
      if (currentstone==0){
        return 0
      }
      temp=GCDFind(antisimon,currentstone)
      currentstone = currentstone-temp
      if (currentstone==0){
        return 1
      }
    }
    return 1
  }
  val oldgroup=scala.io.StdIn.readLine.split(" ")
  var ingroup=oldgroup.map(_.toInt)
  println(EpicGame(ingroup(0),ingroup(1),ingroup(2)))

}

import java.io._
import scala.annotation.tailrec

object Easy {
  val reader = new BufferedReader(new InputStreamReader(System.in))
  def readInt = reader.readLine().toInt
  def readInts = reader.readLine().split(" ").map(_.toInt)

  @tailrec
  def gcd(a: Int, b: Int): Int = if(b == 0) a else gcd(b, a % b)

  @tailrec
  def ans(a: Array[Int], i: Int, n: Int): Int = if(n == 0) 1 - i else ans(a, (i + 1) % 2, n - gcd(n, a(i)))

  def main(a: Array[String]) {
    val a = readInts
    println(ans(a, 0, a(2)))
  }
}

object Main {
  def gcd(a: Int, b: Int): Int =
    if (a % b == 0) b
    else gcd(b, a % b)

  def main(args: Array[String]) {
    val arr = readLine().split(" ").map(_.toInt)
    val a = arr(0)
    val b = arr(1)
    var n = arr(2)
    var turn = 1
    while (n != 0) {
      if (turn == 1) {
        n -= gcd(n, a)
        turn = 0
      } else {
        n -= gcd(n, b)
        turn = 1
      }
    }
    println(turn)
  }
}

import java.util.Scanner

object CF119A {
  def gcd(a:Int,b:Int):Int = b match{
    case 0=> a
    case b=> gcd(b,a%b)
  }

  def main(args: Array[String]){
    val sc:Scanner = new Scanner(System.in)
    val a = sc.nextInt; val b = sc.nextInt; var s = sc.nextInt
    var turn = 0
    while(gcd(if (turn==0) a else b,s) <= s){
      s -= gcd(if (turn==0) a else b,s)
      turn = (turn+1)%2
    }
    turn = (turn+1)%2
    println(turn);
  }
}

import scala.io.StdIn.readLine

/**
 * @author slie742
 */
object EpicGame {

  def gcd(a: Int,b:Int) : Int = {
    b match {
      case 0 => a
      case _ => gcd(b,a%b)
    }
  }

  def solve(a: Int, b: Int, n:Int) : Int = {
    def go(rem: Int, turn: Int) : Int = turn match {
        case 0 => if (rem < gcd(a,rem)) 1
                  else go(rem - gcd(a,rem),1)
        case _ => if (rem < gcd(b,rem)) 0
                  else go(rem - gcd(b,rem),0)
      }
    go(n,0)
  }

  def main(args: Array[String]) {
    val line = readLine.split(' ').map(_.toInt)
    println(solve(line(0),line(1),line(2)))
  }

}

import scala.collection.mutable._
import scala.math._
import scala.util.control.Breaks.break
import scala.util.control.Breaks.breakable
import java.util._
object Main extends App {
  val sc = new Scanner(System.in)
  def gcd(a: Int, b: Int): Int = if(b == 0) a else gcd(b, a%b)
  var t = Array[Int](sc.nextInt,sc.nextInt)
  var n = sc.nextInt
  def sim(s: Int): Int = {
    val g = gcd(n,t(s))
    if(n > g) return (s+1)%2
    else { n-=g; sim((s+1)%2) }
  }
  println(sim(0))
}


object A extends App {

  @inline def tokenizeLine = new java.util.StringTokenizer(readLine)
  def readInts(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt) }
  val as = readInts(3)
  val bs = readInts(3)

  val have = (0 to 2).map(i => ((as(i) - bs(i)) / 2) max 0).sum
  val need = (0 to 2).map(i => (bs(i) - as(i)) max 0).sum

  println(if (have >= need) "Yes" else "No")
}

object A{
  //import scala.collection.mutable.PriorityQueue
  //import scala.collection.mutable.ArrayBuffer
  import util.control.Breaks._
  import java.io.{PrintWriter,InputStream,BufferedReader,InputStreamReader}
  import java.util.{Locale, Scanner,StringTokenizer}
  class InputReader(val stream:InputStream ) {
    var st:StringTokenizer=new StringTokenizer("")
    val reader=new BufferedReader(new InputStreamReader(stream), 32768);

    def next():String = {
        while (!st.hasMoreTokens()){
          val currentLine = reader.readLine
          st=new StringTokenizer(currentLine)
        }
        return st.nextToken
    }

    def nextInt():Int = {
        return next.toInt
    }

    def nextLong():Long = {
    	return next.toLong
    }
    def nextDouble:Double = {
      return next.toDouble
    }
  }

  def main(args: Array[String]){

    val in = new InputReader(System.in)
    val out = new PrintWriter(System.out)

    def nextInt = in.nextInt
    def nextLong = in.nextLong
    def nextDouble = in.nextDouble
    def nextString = in.next
    //code starts here
    val has=for(i<-0 until 3) yield nextInt
    val want=for(i<-0 until 3) yield nextInt
    var sum=0
    for(i<-0 until 3){
      if(has(i)>want(i)){
        sum+=(has(i)-want(i))/2
      }else{
        sum+=has(i)-want(i)
      }

    }
    if(sum>=0){
      out.print("Yes")
    }else{
      out.print("No")
    }

    //code ends here
    out.flush
    out.close
  }
}

import io.StdIn._

object Main{
  def main (args: Array[String]){
    val yes = "Yes"
    val no = "No"

    val Array(a, b, c) = readLine.split(' ').map(_.toInt)
    val Array(x, y, z) = readLine.split(' ').map(_.toInt)

    var dif = new Array[Int](3)
    dif(0) = a - x
    dif(1) = b - y
    dif(2) = c - z

    var over = 0
    var husoku = 0
    for(i <- 0 to 2){
      if (dif(i) >= 0) over += dif(i) / 2
      else husoku += Math.abs(dif(i))
    }

    if(over >= husoku) println(yes)
    else println(no)
  }
}

object Solution extends App {
  val in = scala.io.Source.stdin.getLines()
  val r = in.next().split(' ').map(_.toInt).zip(in.next().split(' ').map(_.toInt)).foldLeft(0, 0) {
    case((minus, plus), (have, need)) if need <= have => (minus, plus + (have - need) / 2)
    case((minus, plus), (have, need)) => (minus + need - have, plus)
  }
  if (r._1 > r._2)
    println("No")
  else
    println("Yes")
}

object A606 {

  import IO._
  import collection.{mutable => cu}

  def main(args: Array[String]): Unit = {
    val Array(a,b,c) = readInts(3)
    val Array(x,y,z) = readInts(3)
    if(solve(a,b,c,x,y,z)) {
      println("Yes")
    } else {
      println("No")
    }
  }

  def solve(a: Int, b: Int, c: Int, x: Int, y: Int, z: Int): Boolean = {
    if(x == 0 && y == 0 && z == 0)
      true
    else {
      if (a >= x) {
        solve(b, c, a - x, y, z, 0)
      } else {
        val short = x-a
        if((c-z)/2 > 0) {
          val extra = math.min(short, (c-z)/2)
          solve(a+extra, b, c - extra*2, x, y, z)
        } else if((b-y)/2 > 0) {
          val extra = math.min(short, (b-y)/2)
          solve(a+extra, b - extra*2, c, x, y, z)
        } else {
          false
        }
      }
    }
  }

  object IO {
    @inline def read: String = scala.io.StdIn.readLine

    @inline def tokenizeLine = new java.util.StringTokenizer(read)

    def readInts(n: Int): Array[Int] = {
      val tl = tokenizeLine;
      Array.fill(n)(tl.nextToken.toInt)
    }

    def readLongs(n: Int): Array[Long] = {
      val tl = tokenizeLine;
      Array.fill(n)(tl.nextToken.toLong)
    }

    def readBigs(n: Int): Array[BigInt] = {
      val tl = tokenizeLine;
      Array.fill(n)(BigInt(tl.nextToken))
    }
  }

}

object A606 {

  import IO._
  import collection.{mutable => cu}

  def main(args: Array[String]): Unit = {
    val Array(a,b,c) = readInts(3)
    val Array(x,y,z) = readInts(3)
    if(solve(a,b,c,x,y,z)) {
      println("Yes")
    } else {
      println("No")
    }
  }

  def solve(a: Int, b: Int, c: Int, x: Int, y: Int, z: Int): Boolean = {
    if(x == 0 && y == 0 && z == 0)
      true
    else {
      if (a >= x) {
        solve(b, c, a - x, y, z, 0)
      } else {
        val short = x-a
        if((b-y)/2 > 0) {
          val extra = (b-y)/2
          solve(a+extra, b - extra*2, c, x, y, z)
        } else if((c-z)/2 > 0) {
          val extra = (c-z)/2
          solve(a+extra, b, c - extra*2, x, y, z)
        } else {
          false
        }
      }
    }
  }

  object IO {
    @inline def read: String = scala.io.StdIn.readLine

    @inline def tokenizeLine = new java.util.StringTokenizer(read)

    def readInts(n: Int): Array[Int] = {
      val tl = tokenizeLine;
      Array.fill(n)(tl.nextToken.toInt)
    }

    def readLongs(n: Int): Array[Long] = {
      val tl = tokenizeLine;
      Array.fill(n)(tl.nextToken.toLong)
    }

    def readBigs(n: Int): Array[BigInt] = {
      val tl = tokenizeLine;
      Array.fill(n)(BigInt(tl.nextToken))
    }
  }

}

import scala.collection._

object A extends App {

  @inline def tokenizeLine = new java.util.StringTokenizer(readLine)
  def readInts(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt) }
  def readLongs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toLong) }
  def readBigs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(BigInt(tl.nextToken)) }

  case class X(a: Int, b: Int, c: Int)

  val Array(a, b, c) = readInts(3)
  val start = X(a, b, c)

  val Array(x, y, z) = readInts(3)
  val goal = X(x, y, z)

  val end = System.currentTimeMillis() + 1500
  val visited = mutable.Set.empty[X]

  def check(q: X): Unit = {
    //println(q)
    if (!visited(q) && System.currentTimeMillis < end) {
      visited += q
      if (q == goal) {
        println("Yes")
        System.exit(0)
      } else {
        if (q.a > goal.a) {
          check(X(q.a - 2, q.b + 1, q.c))
          check(X(q.a - 2, q.b, q.c + 1))
        }
        if (q.b > goal.b) {
          check(X(q.a + 1, q.b - 2, q.c))
          check(X(q.a, q.b - 2, q.c + 1))
        }
        if (q.c > goal.c) {
          check(X(q.a + 1, q.b, q.c - 2))
          check(X(q.a, q.b + 1, q.c - 2))
        }
      }
    }
  }

  check(start)

  println("No")
}

import scala.collection._

object A extends App {

  @inline def tokenizeLine = new java.util.StringTokenizer(readLine)
  def readInts(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt) }
  def readLongs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toLong) }
  def readBigs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(BigInt(tl.nextToken)) }

  case class X(a: Int, b: Int, c: Int)

  val Array(a, b, c) = readInts(3)
  val start = X(a, b, c)

  val Array(x, y, z) = readInts(3)
  val goal = X(x, y, z)

  val end = System.currentTimeMillis() + 1500
  val visited = mutable.Set.empty[X]

  def check(q: X): Unit = {
    //println(q)
    if (!visited(q) && System.currentTimeMillis < end) {
      visited += q
      if (q.a >= goal.a && q.b >= goal.b && q.c >= goal.c) {
        println("Yes")
        System.exit(0)
      } else {
        if (q.a > goal.a + 2000) {
          check(X(q.a - 1000, q.b + 500, q.c))
          check(X(q.a - 1000, q.b, q.c + 500))
        }
        if (q.b > goal.b + 2000) {
          check(X(q.a + 500, q.b - 1000, q.c))
          check(X(q.a, q.b - 1000, q.c + 500))
        }
        if (q.c > goal.c + 2000) {
          check(X(q.a + 500, q.b, q.c - 1000))
          check(X(q.a, q.b + 500, q.c - 1000))
        }
        if (q.a > goal.a) {
          check(X(q.a - 2, q.b + 1, q.c))
          check(X(q.a - 2, q.b, q.c + 1))
        }
        if (q.b > goal.b) {
          check(X(q.a + 1, q.b - 2, q.c))
          check(X(q.a, q.b - 2, q.c + 1))
        }
        if (q.c > goal.c) {
          check(X(q.a + 1, q.b, q.c - 2))
          check(X(q.a, q.b + 1, q.c - 2))
        }
      }
    }
  }

  check(start)

  println("No")
}

import scala.collection._

object A extends App {

  @inline def tokenizeLine = new java.util.StringTokenizer(readLine)
  def readInts(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt) }
  def readLongs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toLong) }
  def readBigs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(BigInt(tl.nextToken)) }

  case class X(a: Int, b: Int, c: Int)

  val Array(a, b, c) = readInts(3)
  val start = X(a, b, c)

  val Array(x, y, z) = readInts(3)
  val goal = X(x, y, z)

  val end = System.currentTimeMillis() + 1500
  val visited = mutable.Set.empty[X]

  def check(q: X): Unit = {
    //println(q)
    if (!visited(q) && System.currentTimeMillis < end) {
      visited += q
      if (q.a >= goal.a && q.b >= goal.b && q.c >= goal.c) {
        println("Yes")
        System.exit(0)
      } else {
        if (q.a > goal.a + 4000) {
          check(X(q.a - 1000, q.b + 500, q.c))
          check(X(q.a - 1000, q.b, q.c + 500))
        }
        if (q.b > goal.b + 4000) {
          check(X(q.a + 500, q.b - 1000, q.c))
          check(X(q.a, q.b - 1000, q.c + 500))
        }
        if (q.c > goal.c + 4000) {
          check(X(q.a + 500, q.b, q.c - 1000))
          check(X(q.a, q.b + 500, q.c - 1000))
        }
        if (q.a > goal.a) {
          check(X(q.a - 2, q.b + 1, q.c))
          check(X(q.a - 2, q.b, q.c + 1))
        }
        if (q.b > goal.b) {
          check(X(q.a + 1, q.b - 2, q.c))
          check(X(q.a, q.b - 2, q.c + 1))
        }
        if (q.c > goal.c) {
          check(X(q.a + 1, q.b, q.c - 2))
          check(X(q.a, q.b + 1, q.c - 2))
        }
      }
    }
  }

  check(start)

  println("No")
}


object E extends App {

  @inline def tokenizeLine = new java.util.StringTokenizer(readLine)
  def readInts(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt) }

  val Array(n, k) = readInts(2)
  val MOD = 998244353L
  val MODB = BigInt(MOD)
  val TWO = BigInt(2)

  val counts = Array.fill(n + 1)(0L)
  var prev = 0L
  for (kh <- 1 to (k min n)) {
    val dp = Array.fill(n + 1, 2)(0L)
    for (i <- 1 to n) {
      if (i <= kh) {
        val pp = TWO.modPow((i min kh) - 1, MODB).toLong
        dp(i)(0) = pp
        dp(i)(1) = pp
      } else {
        var p = 1L
        for (j <- 1 to (i min kh)) {
          dp(i)(0) = (dp(i)(0) + dp(i - j)(1)) % MOD
          dp(i)(1) = (dp(i)(1) + dp(i - j)(0)) % MOD
          p = 2 * p % MOD
        }
      }
    }
    val total = (dp(n)(0) + dp(n)(1)) % MOD
    counts(kh) = (total - prev + MOD) % MOD
    prev = total
  }

  var res = 0L
  for (kh <- 1 to n) {
    for (kv <- 1 to n) {
      if (kh * kv < k) res = (res + counts(kh) * counts(kv)) % MOD
    }
  }

  println(res * TWO.modInverse(MODB) % MOD)
}

object Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 998244353
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N, K = sc.nextInt()
    val s = System.nanoTime()
    var dp, ndp = Array.ofDim[Int](N + 2, N + 2)
    dp(0)(0) = 1
    rep(N) { i =>
      import java.util
      rep(ndp.length)(i => util.Arrays.fill(ndp(i), 0))
      rep(i + 1) { j =>
        rep(i + 1) { k =>
          ndp(j + 1)(max(k, j + 1)) = (ndp(j + 1)(max(k, j + 1)) + dp(j)(k)) % MOD
          ndp(1)(max(k, 1)) = (ndp(1)(max(k, 1)) + dp(j)(k)) % MOD
        }
      }
      val tmp = dp
      dp = ndp
      ndp = tmp
    }

    val cnt = Array.ofDim[Long](N + 1)
    rep(N + 1) { j =>
      rep(N + 1) { k =>
        cnt(k) = (cnt(k) + dp(j)(k)) % MOD
      }
    }
    val cum = Array.ofDim[Long](N + 1)
    cum(0) = cnt(0)
    rep(N){ k =>
      cum(k + 1) = (cum(k + 1) + cum(k) + cnt(k + 1)) % MOD
    }

    var ans = 0L
    rep(N, 1) { i =>
      val j = min(N, (K - 1) / i)
      ans = (ans + cnt(i) * cum(j)) % MOD
    }

    ans = ans * (MOD + 1) / 2 % MOD

    out.println(ans)

    val e = System.nanoTime()
    System.err.println(s"${(e-s)/1000000}")
  }

  def main(args: Array[String]): Unit = {
    solve()
    out.flush()
  }

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

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  def rep(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def rep_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i))
    res
  }

  implicit class ArrayOpts[A](val as: Array[A]) extends AnyVal {
    // todo Orderingだとboxing発生するので自作Orderを用意したい
    def maxByOpt[B: Ordering](f: A => B): Option[A] = {
      if (as.nonEmpty) Some(as.maxBy(f)) else None
    }

    def grpBy[K](f: A => K): mutable.Map[K, ArrayBuffer[A]] = {
      val map = mutable.Map.empty[K, ArrayBuffer[A]]
      rep(as.length)(i => map.getOrElseUpdate(f(as(i)), ArrayBuffer()) += as(i))
      map
    }

    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      var sum = num.zero
      rep(as.length)(i => sum = num.plus(sum, f(as(i))))
      sum
    }

    def minByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.lt)
    }

    def maxByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.gt)
    }

    private def limit[B](f: A => B, ixRange: Range)(cmp: (B, B) => Boolean): (A, B) = {
      var limA = as(ixRange.head)
      var limB = f(limA)

      for (i <- ixRange.tail) {
        val a = as(i)
        val b = f(a)
        if (cmp(b, limB)) {
          limA = a
          limB = b
        }
      }
      (limA, limB)
    }
  }

  implicit class IterableOpts[A](val as: Iterable[A]) extends AnyVal {
    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      as.foldLeft(num.zero)((acc, a) => num.plus(acc, f(a)))
    }
  }
}

object E extends App {

  @inline def tokenizeLine = new java.util.StringTokenizer(readLine)
  def readInts(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt) }
  def readLongs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toLong) }
  def readBigs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(BigInt(tl.nextToken)) }

  val Array(n, k) = readInts(2)
  val MOD = 998244353L
  val MODB = BigInt(MOD)
  val TWO = BigInt(2)

  val counts = Array.fill(n + 1)(0L)
  for (kh <- 1 to (k min n)) {
    val dp = Array.fill(n + 1, 2)(0L)
    for (i <- 1 to n) {
      if (i <= kh) {
        val pp = TWO.modPow((i min kh) - 1, MODB).toLong
        dp(i)(0) = pp
        dp(i)(1) = pp
      } else {
        var p = 1L
        for (j <- 1 to (i min kh)) {
          dp(i)(0) = (dp(i)(0) + dp(i - j)(1)) % MOD
          dp(i)(1) = (dp(i)(1) + dp(i - j)(0)) % MOD
          p = 2 * p % MOD
        }
      }
//      val p = TWO.modPow((i min kh) - 1, MODB).toLong
//      if (i <= kh) {
//        dp(i)(0) = p
//        dp(i)(1) = p
//      } else {
//        dp(i)(0) = p * dp(i - kh)(1) % MOD
//        dp(i)(1) = p * dp(i - kh)(0) % MOD
//      }
    }
    //println(kh, dp.map(_.sum).mkString(" "))
    counts(kh) = (dp(n)(0) + dp(n)(1) + MOD - counts(kh - 1)) % MOD
  }
//println(counts.mkString(" "))
  var res = 0L
  for (kh <- 1 to n) {
    for (kv <- 1 to n) {
      //println(res, counts(kh), counts(kv))
      if (kh * kv < k) res = (res + counts(kh) * counts(kv)) % MOD
    }
  }

  println(res * TWO.modInverse(MODB) % MOD)
}


object Solution extends App {
  val in = scala.io.Source.stdin.getLines()
  val Array(az, kz) = in.next().split(' ')
  val k = kz.toInt
  val a = az.toCharArray

  def solve(data: Array[Char], index: Int, k: Int, ch: Char): Array[Char] =
    if (k == 0 || index == data.length - 1)
      a
    else if (ch <= data(index))
      solve(data, index + 1, k, '9')
    else {
      ((index + 1) to Math.min(data.length - 1, index + k)).find(i => data(i) == ch) match {
        case None => solve(data, index, k, (ch - 1).toChar)
        case Some(i) =>
          val tmp = data(i)
          (i until index by - 1).foreach {
            j => data(j) = data(j - 1)
          }
          data(index) = tmp
          solve(data, index + 1, k + index - i, '9')
      }
    }

  def sol(data: Array[Char], k: Int) = {
    solve(data, 0, k, '9')
  }

  println(sol(a, k).mkString)

}

import scala.collection.JavaConversions._
import scala.collection.mutable.ArraySeq

object Codeforces435B {
    def main(args: Array[String]) {
        var Array(num, swaps) = scala.io.StdIn.readLine().split(" ").map(_.toLong)
        val numSeq = ArraySeq(num.toString.toList: _*)
        var i = 0
        while (i < numSeq.length-1 && swaps > 0) {
            var temp = 1
            var maxIndex = 0
            while (temp <= swaps && (i+temp) <= (numSeq.length-1)) {
                if (Integer.parseInt(numSeq(i+maxIndex).toString) < Integer.parseInt(numSeq(i+temp).toString))
                    maxIndex = temp
                temp += 1
            }
            swaps -= maxIndex
            while (maxIndex > 0) {
                val t = numSeq(i+maxIndex)
                numSeq(i+maxIndex) = numSeq(i+maxIndex-1)
                numSeq(i+maxIndex-1) = t
                maxIndex -= 1
            }
            i += 1
        }
        println(numSeq.mkString(""))
    }
}

/**
 * Created by ashione on 14-6-19.
 */
import java.util.Scanner
object swapNum {
  def main(Arg:Array[String]): Unit= {
    val s = new Scanner(System.in)
    val sl:String = s.next
    val dist = s.nextInt
    val (ans,_,_)=findNum(sl.toList,1,dist)
    ans foreach print
  }
  def findNum(sl:List[Char],start:Int,dist:Int):(List[Char],Int,Int) = {
    if(dist<=0 || start>=sl.length) return (sl,0,0)
    var localtion = start-1
    for(i <- start to start + dist-1 if i<sl.length)
      if(sl(i)>sl(localtion)) localtion = i
    if(localtion!=start-1) {
      val (sl1, sl2) = sl.splitAt(localtion)
      val (d, e) = sl2.splitAt(1)
      val (a, sl1t) = sl1.splitAt(start - 1)
      val (b, c) = sl1t.splitAt(1)
      findNum(a ::: d ::: b ::: c ::: e, start + 1, dist-(localtion - start+1))
    }
    else findNum(sl,start+1,dist)

  }

}

import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val in = new Scanner(System.in)
    val s = in.next
    var k = in.nextInt

    val arr = s.toCharArray()

    for (i <- 0 to arr.length - 2) {
      var maxPos = -1
      for (j <- i to Math.min(i + k, arr.length - 1))
        if (maxPos == -1 || arr(j) > arr(maxPos))
          maxPos = j
      if (maxPos != 0) {
        while (maxPos > i) {
          var t = arr(maxPos)
          arr(maxPos) = arr(maxPos - 1)
          arr(maxPos - 1) = t
          k = k - 1
          maxPos = maxPos - 1
        }
      }
    }

    println(arr.mkString)
  }
}

object Solution extends App {
  val in = scala.io.Source.stdin.getLines()
  val Array(as, ks) = in.next().split(' ')
  val k = ks.toInt
  val a = as.toCharArray
  val r = (1 to k).foreach { _ =>
    val i = (1 until a.length).find(i => a(i) > a(i - 1))
    if (i.nonEmpty) {
      val tmp = a(i.get)
      a(i.get) = a(i.get - 1)
      a(i.get - 1) = tmp
    }

  }
  println(a.mkString)
}

/**
 * Created by ashione on 14-6-19.
 */
import java.util.Scanner
object swapNum {
  def main(Arg:Array[String]): Unit= {
    val s = new Scanner(System.in)
    val sl:String = s.next
    val dist = s.nextInt
    val (ans,_,_)=findNum(sl.toList,1,dist)
    ans foreach print
  }
  def findNum(sl:List[Char],start:Int,dist:Int):(List[Char],Int,Int) = {
    if(dist<=0 || start>=sl.length) return (sl,0,0)
    var localtion = start-1
    for(i <- start to start + dist-1 if i<sl.length)
      if(sl(i)>sl(localtion)) localtion = i
    if(localtion!=start-1) {
      val (sl1, sl2) = sl.splitAt(localtion)
      val (d, e) = sl2.splitAt(1)
      val (a, sl1t) = sl1.splitAt(start - 1)
      val (b, c) = sl1t.splitAt(1)
      findNum(a ::: d ::: c ::: b ::: e, start + 1, localtion - start)
    }
    else findNum(sl,start+1,dist)

  }

}

import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val in = new Scanner(System.in)
    val s = in.next
    var k = in.nextInt

    val arr = s.toCharArray()

    while (k > 0) {
      k = k - 1
      def loop(i: Int): Unit =
        if (i < arr.length - 1) {
          if (arr(i) < arr(i + 1)) {
            val t = arr(i)
            arr(i) = arr(i + 1)
            arr(i + 1) = t
          } else loop(i + 1)
        }
      loop(0)
    }

    println(arr.mkString)
  }
}

import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val in = new Scanner(System.in)
    val s = in.next
    var k = in.nextInt

    val arr = s.toCharArray()

    for (i <- 0 to arr.length - 2) {
      var maxPos = 0
      for (j <- i to Math.min(i + k, arr.length - 1))
        if (arr(j) > arr(maxPos) || maxPos == 0)
          maxPos = j
      if (maxPos != 0) {
        while (maxPos > i) {
          var t = arr(maxPos)
          arr(maxPos) = arr(maxPos - 1)
          arr(maxPos - 1) = t
          k = k - 1
          maxPos = maxPos - 1
        }
      }
    }

    println(arr.mkString)
  }
}


object TwoButtons {
  case class Pair(e:Int,stp:Int)
  def main(args: Array[String]): Unit = {
    val in =scala.io.StdIn
    var line=in.readLine()
    var n=line.split(" ")(0).toInt
    var m=line.split(" ")(1).toInt
    //val n=4 ; val m=6
    //val n=10 ; val m=1
    //Applying BSF and in level order search the first occurrence of m is the minimum step
    var click=0
	while (m!=n){
	  click+=1
	  if(m>n) {
		if (m % 2 == 0) {
		  m /= 2
		} else {
		  m = (m + 1) / 2
		  click+=1
		}
	  }else{
		m+=1
	  }
	}
	println(click)
  }
}

import java.io._
import java.util.StringTokenizer

object TwoButtons {
  def main(args: Array[String]): Unit = {
    val in = new InputReader(System.in)
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val solver = new Task()
    solver.solve(in, out)
    out.close()
  }

  class Task {
    private val INF = 1e6.asInstanceOf[Int]

    def solve(in: InputReader, out: PrintWriter): Unit = {
      val n = in.nextInt()
      val m = in.nextInt()
      val ans = dfs(n, m, Array.ofDim[Int](math.max(n, m) + 1))
      out.println(ans)
    }

    private def dfs(n: Int, m: Int, memo: Array[Int]): Int = {
      if (n >= m) n - m
      else if (n <= 0) INF
      else if (memo(n) > 0) memo(n)
      else {
        memo(n) = INF
        memo(n) = math.min(dfs(n * 2, m, memo), dfs(n - 1, m, memo)) + 1
        memo(n)
      }
    }
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream))
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens) {
        try {
          tokenizer = new StringTokenizer(reader.readLine())
        } catch {
          case _: IOException => throw new RuntimeException
        }
      }
      tokenizer.nextToken()
    }

    def nextInt(): Int = {
      Integer.parseInt(next())
    }
  }

}

import java.io._
import java.util.StringTokenizer

object TwoButtons {
  def main(args: Array[String]): Unit = {
    val inputStream = System.in
    val outputStream = System.out
    val in = new InputReader(inputStream)
    val out = new PrintWriter(outputStream)
    val solver = new Task()
    solver.solve(in, out)
    out.close()
  }

  class Task {
    private val INF = 1e6.asInstanceOf[Int]

    def solve(in: InputReader, out: PrintWriter): Unit = {
      val n = in.nextInt()
      val m = in.nextInt()
      val ans = dfs(n, m, Array.ofDim[Int](math.max(n, m) + 1))
      out.println(ans)
    }

    private def dfs(n: Int, m: Int, memo: Array[Int]): Int = {
      if (n >= m) n - m
      else if (n <= 0) INF
      else if (memo(n) > 0) memo(n)
      else {
        memo(n) = INF
        memo(n) = math.min(dfs(n * 2, m, memo), dfs(n - 1, m, memo)) + 1
        memo(n)
      }
    }
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream))
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens) {
        try {
          tokenizer = new StringTokenizer(reader.readLine())
        } catch {
          case _: IOException => throw new RuntimeException
        }
      }
      tokenizer.nextToken()
    }

    def nextInt(): Int = {
      Integer.parseInt(next())
    }
  }

}

import scala.collection.mutable

object B520 {
  @inline def read = scala.io.StdIn.readLine

  @inline def tokenizeLine = new java.util.StringTokenizer(read)

  def readInts(n: Int) = {
    val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt)
  }

  def readLongs(n: Int) = {
    val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toLong)
  }

  def readBigs(n: Int) = {
    val tl = tokenizeLine; Array.fill(n)(BigInt(tl.nextToken))
  }

  val MAX = 2*10000
  val graph = Array.fill(MAX+1)(List.empty[Int])
  graph(1) = List(2)
  for(i <- 2 to MAX) {
    graph(i) = List(2*i, i-1)
  }
  def bfs(src: Int, des: Int): Int = {
    val vis = Array.fill(MAX+1)(false)
    val q = mutable.Queue.empty[(Int, Int)]
    q.enqueue((0, src))
    vis(src) = true
    while(q.nonEmpty) {
      val (dist, ele) = q.dequeue()
      if(des == ele) {
        return dist
      }
      if(ele <= MAX) {
        for (i <- graph(ele) if i <= MAX && !vis(i)) {
          q.enqueue((dist + 1, i))
          vis(i) = true
        }
      }
    }
    -1
  }
  def main(args: Array[String]): Unit = {
    var Array(n, m) = readInts(2)
    println(bfs(n, m))
  }

}

/**
 * Created by yangchaozhong on 3/16/15.
 */
object CF520B extends App {
  import scala.collection.mutable.HashSet
  import java.util.{Scanner}
  import java.io.{PrintWriter}

  val in = new Scanner(System.in)
  val out = new PrintWriter(System.out)

  def nextInt = in.nextInt
  def nextLong = in.nextLong
  def nextDouble = in.nextDouble
  def nextString = in.next
  def nextLine = in.nextLine

  def solve = {
    val n = nextInt
    val m = nextInt

    if (n >= m) {
      out.println(n - m)
    } else {

      def dfs(x: Int): Int = {
        if (x == n) 0
        else if (x < n) {
          n - x
        } else {
          if (x % 2 == 0) {
            dfs(x / 2) + 1
          } else {
            dfs(x + 1) + 1
          }
        }
      }

      out.println(dfs(m))
    }
  }

  try {
    solve
  } catch {
    case _: Exception => sys.exit(9999)
  } finally {
    out.flush
    out.close
  }
}

import java.io._
import java.util.StringTokenizer

import scala.collection.mutable

object B {

  var out: PrintWriter = null
  var br: BufferedReader = null
  var st: StringTokenizer = null

  def next: String = {
    while (st == null || !st.hasMoreTokens) {
      st = new StringTokenizer(br.readLine)
    }
    return st.nextToken
  }

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

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

  def f(n: Int, m: Int, dp: Array[Int]): Int = {
    if (n >= m) {
      return n - m
    }
    if (n <= 0) {
      return 1e6.toInt
    }
    if (dp(n) > 0) {
      return dp(n)
    }
    dp(n) = 1e6.toInt
    dp(n) = Math.min(f(2 * n, m, dp), f(n - 1, m, dp)) + 1
    return dp(n)
  }

  def solve: Int = {
    val n = nextInt
    val m = nextInt
    val sz = Math.max(n, m)
    val dp = new Array[Int](sz + 1)
    out.println(f(n, m, dp))
    return 1
  }

  def main(args: Array[String]): Unit = {
    br = new BufferedReader(new InputStreamReader(System.in))
    out = new PrintWriter(new BufferedOutputStream(System.out))
    solve
    out.close
  }
}

import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
import scala.io.StdIn._

object Main2 extends App {
  val Array(initialNumber, desiredNumber) = readLine().split(" ").map(_.toInt)
  val queue = mutable.Queue((initialNumber, 0))
  var answers = ArrayBuffer.fill(20001)(-1)
  while (queue.nonEmpty) {
    val (value, actionCount) = queue.dequeue()
    if (value - 1 > 0 && answers(value - 1) == -1) {
      answers(value - 1) = actionCount + 1
      queue.enqueue((value - 1, actionCount + 1))
    }
    if (value * 2 < 20001 && answers(value * 2) == -1) {
      answers(value * 2) = actionCount + 1
      queue.enqueue((value * 2, actionCount + 1))
    }
  }
  println(answers(desiredNumber))
}

object TwoButtons {
  case class Pair(e:Int,stp:Int)
  def main(args: Array[String]): Unit = {
    val in =scala.io.StdIn
    var line=in.readLine()
    var n=line.split(" ")(0).toInt
    var m=line.split(" ")(1).toInt
    //val n=4 ; val m=6
    //val n=10 ; val m=1
    //Applying BSF and in level order search the first occurrence of m is the minimum step
    var click=0
	while (m!=n){
	  click+=1
	  if(m>n) {
		if (m % 2 == 0) {
		  m /= 2
		} else {
		  m = (m + 1) / 2
		}
	  }else{
		m+=1
	  }
	}
	println(click)
  }
}

object B520 {
  @inline def read = scala.io.StdIn.readLine

  @inline def tokenizeLine = new java.util.StringTokenizer(read)

  def readInts(n: Int) = {
    val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt)
  }

  def readLongs(n: Int) = {
    val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toLong)
  }

  def readBigs(n: Int) = {
    val tl = tokenizeLine; Array.fill(n)(BigInt(tl.nextToken))
  }

  def main(args: Array[String]): Unit = {
    var Array(n, m) = readInts(2)
    if(n > m) {
      println(n-m)
    } else {
      if (m % 2 == 0) {
        var res = 0
        while(m % 2 == 0 && n < m) {
          m /= 2
          res += 1
        }
        println(res + (n-m))
      } else {
        var res = 0
        while(n < m) {
          n *= 2
          res += 1
        }
        println(res + n-m)
      }
    }
  }

}

/**
 * Created by yangchaozhong on 3/16/15.
 */
object CF520B extends App {
  import java.util.{Scanner}
  import java.io.{PrintWriter}

  val in = new Scanner(System.in)
  val out = new PrintWriter(System.out)

  def nextInt = in.nextInt
  def nextLong = in.nextLong
  def nextDouble = in.nextDouble
  def nextString = in.next
  def nextLine = in.nextLine

  def solve = {
    val n = nextInt
    val m = nextInt

    if (n >= m) {
      out.println(n - m)
    } else {
      def dfs(x: Int): Int = {
        if (x == m) 0
        else if (x > m) {
          x - m
        } else {
          if (x > m / 2 && x > 2)
            Math.min(dfs(x * 2) + 1, dfs(x - 1) + 1)
          else
            dfs(x * 2) + 1
        }
      }

      out.println(dfs(n))
    }
  }

  try {
    solve
  } catch {
    case _: Exception => sys.exit(9999)
  } finally {
    out.flush
    out.close
  }
}

import java.io._
import java.util
import java.util._

object B {

  var out: PrintWriter = null
  var br: BufferedReader = null
  var st: StringTokenizer = null

  def next: String = {
    while (st == null || !st.hasMoreTokens) {
      st = new StringTokenizer(br.readLine)
    }
    return st.nextToken
  }

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

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

  def solve: Int = {
    val n = nextInt
    val m = nextInt
    if (m < n) {
      out.println(n - m)
      return 1
    }
    if (m == n) {
      out.println(0)
      return 1
    }
    var y = m
    var ans = 0
    while (y % 2 == 0) {
      y /= 2
      ans += 1
    }
    val sz = Math.max(n, y)
    val dp = new Array[Array[Int]](sz + 1)
    for (i <- 0 until sz + 1) {
      dp(i) = new Array[Int](sz + 1)
    }

    for (i <- 0 to sz) {
      for (j <- i + 1 until sz) {
        dp(i)(j) = j - i
      }
    }
    for (i <- 1 to sz) {
      for (j <- 1 to sz) {
        if (i * 2 <= sz) {
          dp(i)(j) = Math.min(dp(i - 1)(j), dp(i * 2)(j)) + 1
        }
        else {
          dp(i)(j) = dp(i - 1)(j) + 1
        }
      }
    }
    out.println(dp(y - 1)(y - 1) + ans)
    return 1
  }

  def main(args: Array[String]): Unit = {
    br = new BufferedReader(new InputStreamReader(System.in))
    out = new PrintWriter(new BufferedOutputStream(System.out))
    solve
    out.close
  }
}

import java.io._
import java.util
import java.util._

object B {

  var out: PrintWriter = null
  var br: BufferedReader = null
  var st: StringTokenizer = null

  def next: String = {
    while (st == null || !st.hasMoreTokens) {
      st = new StringTokenizer(br.readLine)
    }
    return st.nextToken
  }

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

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

  def solve: Int = {
    val n = nextInt
    val m = nextInt
    if (m < n) {
      out.println(n - m)
      return 1
    }
    if (m == n) {
      out.println(0)
      return 1
    }
    var x = n
    var y = m
    var ans = 0
    while (y > n && y % 2 == 0) {
      y /= 2
      ans += 1
    }
    while (x < y) {
      x *= 2
      ans += 1
    }
    if (y < x) {
      out.println(ans + x - y)
      return 1
    }
    if (y == x) {
      out.println(ans)
      return 1
    }
    return 1
  }

  def main(args: Array[String]): Unit = {
    br = new BufferedReader(new InputStreamReader(System.in))
    out = new PrintWriter(new BufferedOutputStream(System.out))
    solve
    out.close
  }
}

import java.io._
import java.util
import java.util._

object B {

  var out: PrintWriter = null
  var br: BufferedReader = null
  var st: StringTokenizer = null

  def next: String = {
    while (st == null || !st.hasMoreTokens) {
      st = new StringTokenizer(br.readLine)
    }
    return st.nextToken
  }

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

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

  def solve: Int = {
    val n = nextInt
    val m = nextInt
    if (m < n) {
      out.println(n - m)
      return 1
    }
    if (m == n) {
      out.println(0)
      return 1
    }
    var x = n
    var ans = 0
    while (x < m) {
      x *= 2
      ans += 1
    }
    if (m % 2 == 0 && n > m / 2) {
      out.println(Math.min(n - m / 2 + 1, ans + x - m))
    } else {
      out.println(ans + x - m)
    }
    return 1
  }

  def main(args: Array[String]): Unit = {
    br = new BufferedReader(new InputStreamReader(System.in))
    out = new PrintWriter(new BufferedOutputStream(System.out))
    solve
    out.close
  }
}


object _964A extends CodeForcesApp {
  import annotation._, collection.{mutable, Searching}, util._, control._, math.Ordering.Implicits._, Searching._, Math._

  override def apply(io: IO): io.type = {
    val n = io.read[Long]
    io.write(n/2 + 1)
  }
}
/****************************[Ignore Template Below]****************************************/
trait CodeForcesApp {
  lazy val isOnlineJudge: Boolean = sys.props.get("ONLINE_JUDGE").exists(_.toBoolean)
  def debug(x: => Any): Unit = if (!isOnlineJudge) println(x)
  def apply(io: IO): io.type
  def main(args: Array[String]): Unit = this(new IO(System.in, System.out)).close()
}
/***********************************[Scala I/O]*********************************************/
import java.io._, java.util.StringTokenizer

class IO(in: BufferedReader, out: BufferedWriter) extends Iterator[String] with AutoCloseable with Flushable {
  import IO._
  def this(reader: Reader, writer: Writer) = this(new BufferedReader(reader), new BufferedWriter(writer))
  def this(in: InputStream, out: OutputStream) = this(new InputStreamReader(in), new OutputStreamWriter(out))

  private[this] val tokenizers = Iterator.continually(in.readLine()).takeWhile(_ != null).map(new StringTokenizer(_)).buffered
  val printer = new PrintWriter(out, true)

  @inline private[this] def tokenizer() = {
    while(tokenizers.nonEmpty && !tokenizers.head.hasMoreTokens) tokenizers.next()
    tokenizers.headOption
  }

  def read[A](implicit read: IO.Read[A]): A = read.apply(this)
  def read[C[_], A: IO.Read](n: Int)(implicit b: C of A): C[A] = Iterator.fill(n)(read).to[C]

  def readTill(delim: String): String = tokenizer().get.nextToken(delim)
  def readTillEndOfLine(): String = readTill("\n\r")

  def readAll[A: IO.Read]: (Int, Vector[A]) = {
    val data = read[Vector[A]]
    (data.length, data)
  }

  override def next() = tokenizer().get.nextToken()
  override def hasNext = tokenizer().nonEmpty

  def write(obj: Any): this.type = {
    printer.print(obj)
    this
  }
  def writeLine(): this.type = {
    printer.println()
    this
  }
  def writeLine(obj: Any): this.type = {
    printer.println(obj)
    this
  }
  def writeAll(obj: Traversable[Any], separator: String = " "): this.type = write(obj mkString separator)
  def query[A: IO.Read](question: Any): A = writeLine(question).read

  override def flush() = printer.flush()
  def close() = {
    flush()
    in.close()
    printer.close()
  }
}
object IO {
  private[IO] type of[C[_], A] = scala.collection.generic.CanBuild[A, C[A]]

  class Read[A](val apply: IO => A) {
    def map[B](f: A => B): Read[B] = new Read(apply andThen f)
  }
  object Read {
    implicit def collection[C[_], A: Read](implicit b: C of A): Read[C[A]]         = new Read(r => r.read[C, A](r.read[Int]))
    implicit val string                                       : Read[String]       = new Read(_.next())
    implicit val char                                         : Read[Char]         = string.map(_.toTraversable.head)
    implicit val int                                          : Read[Int]          = string.map(_.toInt)
    implicit val long                                         : Read[Long]         = string.map(_.toLong)
    implicit val bigInt                                       : Read[BigInt]       = string.map(BigInt(_))
    implicit val double                                       : Read[Double]       = string.map(_.toDouble)
    implicit val bigDecimal                                   : Read[BigDecimal]   = string.map(BigDecimal(_))
    implicit def tuple2[A: Read, B: Read]                     : Read[(A, B)]       = new Read(r => (r.read[A], r.read[B]))
    implicit def tuple3[A: Read, B: Read, C: Read]            : Read[(A, B, C)]    = new Read(r => (r.read[A], r.read[B], r.read[C]))
    implicit def tuple4[A: Read, B: Read, C: Read, D: Read]   : Read[(A, B, C, D)] = new Read(r => (r.read[A], r.read[B], r.read[C], r.read[D]))
    implicit val boolean                                      : Read[Boolean]      = string map {s =>
      s.toLowerCase match {
        case "yes" | "true" | "1" => true
        case "no" | "false" | "0" => false
        case _ => s.toBoolean
      }
    }
  }
}

object CF964A extends App {
  import scala.io.Source

  //val src = Source.fromFile("data.txt")
  val src = Source.stdin
  val lines = src.getLines

  def readInts(): Array[Int] =  {
    val line = if (lines.hasNext) lines.next else null
    if (line == null) throw new RuntimeException("Premature end of source encountered")
    line.split(" ").map(x => x.toInt)
  }
  val ints = readInts()
  println(ints(0)/2 + 1)

}


import scala.collection.mutable

object A extends App {
  def readLongs = scala.io.StdIn.readLine().split(" ").map(_.toLong)

  val Array(n) = readLongs

  case class E(prev: Long, cur: Long, games : Int) {
    def next = E(cur, prev+cur, games+1)
  }

  var e = E(1, 1, 0)
  while (e.cur <= n) {
    e = e.next
   // println(e)
  }

  println(e.games-1)
}

object A extends App {

  @inline def tokenizeLine = new java.util.StringTokenizer(readLine)
  def readInts(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toInt) }
  def readLongs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toLong) }
  def readBigs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(BigInt(tl.nextToken)) }

  val Array(n) = readLongs(1)

  var res = 1
  val memo = Array.fill(100000){ -1L }

  memo(1) = 2
  memo(2) = 3

  def minPlayers(moves: Int): Long = {
    if (memo(moves) < 0) memo(moves) = minPlayers(moves - 1) + minPlayers(moves - 2)
    memo(moves)
  }

  while (minPlayers(res) <= n) res += 1

  println(res - 1)
}

object Solution extends App {
  val in = io.Source.stdin.getLines()
  val n = in.next().toLong
  var i = 0
  var a = 1l
  var b = 1l
  while (b <= n) {
    val tmp = a + b
    a = b
    b = tmp
    i += 1
  }
  println(i - 1)
}

import java.io._
import scala.io.Source

import scala.annotation.tailrec

object ProblemCFib {
  def main(args: Array[String]): Unit = processStdInOut()

  def processStdInOut(): Unit = {
    val src = Source.fromInputStream(System.in)
    processFromSource(src)
  }

  def processFromSource(src: Source): Unit = {
    try {
      val bw = new BufferedWriter(new OutputStreamWriter(System.out));
      try {
        val lines = src.getLines()
        processLines(lines, bw)
      } finally {
        bw.flush()
      }
    } finally {
      src.close();
    }
  }

  // Standard code above, custom code below
  def processLines(lines: Iterator[String], bw: BufferedWriter): Unit = {
    val n = lines.next().toLong
    val soln = solve(n)
    bw.write(soln.toString)
    bw.newLine()
  }

  // Cache the Fibonacci lookup for good performance:
  var minPlayersByChampionsWinsLookup = Map[Long, Long](
    0L -> 1L,  // A single player is champion without playing a single match
    1L -> 2L   // With 2 players the champion wins after a single match
  )

  // The following function is equivalent to fib(wins + 2) where fib is the Fibonacci sequence
  def minPlayersForChampionWithWins(wins: Long): Long = {
    if (minPlayersByChampionsWinsLookup.contains(wins)) {
      minPlayersByChampionsWinsLookup(wins)
    } else {
      val result = minPlayersForChampionWithWins(wins - 1) + minPlayersForChampionWithWins(wins - 2)
      minPlayersByChampionsWinsLookup += wins -> result
      result
    }
  }

  def solve(n: Long): Long = {
    @tailrec
    def search(candidateWins: Long): Long = {
      val minTournamentSize = minPlayersForChampionWithWins(candidateWins)

      if (minTournamentSize == n) candidateWins
      else if (minTournamentSize > n) (candidateWins - 1)  // overshot the target, so use previous value
      else search(candidateWins + 1)
    }

    search(0)
  }
}

object Solution extends App {
  val in = io.Source.stdin.getLines()
  val n = in.next().toLong
  var i = 0
  var a = 1l
  var b = 1l
  while (b < n) {
    val tmp = a + b
    a = b
    b = tmp
    i += 1
  }
  println(i - 1)
}

import java.io._
import scala.io.Source

import scala.annotation.tailrec

object ProblemC {
  def main(args: Array[String]): Unit = processStdInOut()

  def processStdInOut(): Unit = {
    val src = Source.fromInputStream(System.in)
    processFromSource(src)
  }

  def processFromSource(src: Source): Unit = {
    try {
      val bw = new BufferedWriter(new OutputStreamWriter(System.out));
      try {
        val lines = src.getLines()
        processLines(lines, bw)
      } finally {
        bw.flush()
      }
    } finally {
      src.close();
    }
  }

  // Standard code above, custom code below
  def processLines(lines: Iterator[String], bw: BufferedWriter): Unit = {
    val n = lines.next().toLong
    val log2 = math.log(2)
    val rounds = math.ceil(math.log(n) / log2) + 0.1
      // note: bump it slightly in case of round errors like a ?.999999 "integer"
    bw.write(rounds.toLong.toString)
    bw.newLine()
  }
}

import java.io._
import scala.io.Source

import scala.annotation.tailrec

object ProblemC {
  def main(args: Array[String]): Unit = processStdInOut()

  def processStdInOut(): Unit = {
    val src = Source.fromInputStream(System.in)
    processFromSource(src)
  }

  def processFromSource(src: Source): Unit = {
    try {
      val bw = new BufferedWriter(new OutputStreamWriter(System.out));
      try {
        val lines = src.getLines()
        processLines(lines, bw)
      } finally {
        bw.flush()
      }
    } finally {
      src.close();
    }
  }

  // Standard code above, custom code below
  def processLines(lines: Iterator[String], bw: BufferedWriter): Unit = {
    val n = lines.next().toLong
    val soln = solve(n)
    bw.write(soln.toString)
    bw.newLine()
  }

  def solve(n: Long): Long = {
    @tailrec
    def loop(minGames: Long, counts: List[Long]): Long = counts match {
      case 0 :: tl           => loop(minGames + 1, tl)
      case 1 :: Nil          => minGames
      case a :: Nil          => loop(minGames, List(a - 2, 1))
      case 1 :: 1 :: Nil     => minGames + 2
      case 1 :: 1 :: c :: tl => loop(minGames + 2, (c + 1) :: tl)
      case 2 :: 1 :: tl      => loop(minGames + 1, 2 :: tl)  // Don't leave an "orphaned" player
      case a :: 0 :: tl      => loop(minGames, (a - 2) :: 1l :: tl)
      case a :: b :: Nil     => loop(minGames, List(a - 1, b - 1, 1))
      case a :: b :: c :: tl => loop(minGames, (a - 1) :: (b - 1) :: (c + 1) :: tl)
      case Nil => 0
    }

    val maxGamesPlayed = loop(0, List(n))
    maxGamesPlayed
  }
}

import java.io._
import scala.io.Source

import scala.annotation.tailrec

object ProblemC {
  def main(args: Array[String]): Unit = processStdInOut()

  def processStdInOut(): Unit = {
    val src = Source.fromInputStream(System.in)
    processFromSource(src)
  }

  def processFromSource(src: Source): Unit = {
    try {
      val bw = new BufferedWriter(new OutputStreamWriter(System.out));
      try {
        val lines = src.getLines()
        processLines(lines, bw)
      } finally {
        bw.flush()
      }
    } finally {
      src.close();
    }
  }

  // Standard code above, custom code below
  def processLines(lines: Iterator[String], bw: BufferedWriter): Unit = {
    val n = lines.next().toDouble
    val log2 = math.log(2)
    val rounds = math.ceil(math.log(n) / log2).toLong
    val adjRounds = if (math.pow(2, rounds) < n) rounds + 1
      else if (math.pow(2, rounds - 1) >= n) rounds - 1
      else rounds
    bw.write(adjRounds.toString)
    bw.newLine()
  }
}