import scala.io.Source

object Solution extends App {
  val in = Source.stdin.getLines()
  val Array(n, k) = in.next().split(' ').map(_.toInt)
  val mod = (1e9 + 7).toInt
  val dp = Array.ofDim[Int](k + 1, n + 1)

  (0 to n).foreach { i => dp(0)(i) = 1}

  (1 to k).foreach { i =>
    var j = 1
    while (j <= n) {
      (j to n by j).foreach { el =>
        dp(i)(j) += dp(i - 1)(el)
        dp(i)(j) %= mod
      }
      j += 1
    }
  }

  println(dp(k)(1))
}


import scala.collection.mutable

object B 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) = readInts(1)

  val rByL = Array.fill(n){ mutable.Queue.empty[Int] }

  for {
    r <- 0 to n - 1
    l <- r + 1 to n
  } rByL(r) += l

  var res = 0
  var done = false

  while (!done) {
    var r = 0
    while (r < n && rByL(r).isEmpty) r += 1
    if (r == n) done = true
    else {
      res += 1
      while (r < n) {
        val l = rByL(r).dequeue()
        r = l
        while (r < n && rByL(r).isEmpty) r += 1
      }
    }
  }

  println(res)
}


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

object C {

  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 baseHouse(n: Long): Long = {
    return (3L * n * n + n) / 2L
  }

  def solve: Int = {
    val n = nextLong
    var ans = 0
    for (i <- 1 to 1e6.toInt) {
      if (n - baseHouse(i) >= 0 && (n - baseHouse(i)) % 3 == 0) {
        ans += 1
      }
    }
    out.println(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 scala.io.Source

import scala.annotation.tailrec

object ProblemA {
  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().toInt
    val soln = solve(n)
    bw.write(soln.toString)
    bw.newLine()
  }

  def solve(n: Int): Int = {
    def isComposite(i: Int): Boolean = {
      val maxDiv = (math.sqrt(i) + 0.5).toInt
      2.to(maxDiv).exists(i % _ == 0)
    }

    val mOpt = (1 to 1000).find(m => isComposite(m * n + 1))
    mOpt.get
  }
}


import java.util.Scanner

import scala.language.postfixOps

object TaskA extends App {
  val sc = new Scanner(System.in)
  val s = sc.next
  val lampsCnt = new Array[Int](100)
  0 until 4 map { d =>
    val lamps = d until s.length by 4 map s
    lampsCnt(lamps.filterNot(_ == '!').head) = lamps.count(_ == '!')
  }
  println("RBYG" map (_.toInt) map lampsCnt mkString " ")
}


//rextester.com:2.11.7--codeforces.com:2.11.8
object myClass extends App{
    val a=scala.io.StdIn.readInt()*2;var b=false
    for(i<-1 to math.sqrt(a).toInt-1){
        val c=a-i*i-i;val d=math.sqrt(c).toInt
        if(d*(d+1)==c)b=true
    }
    print({if(b)"YES"else"NO"})
 }


object B extends App
{
    val Array(n, k) = readLine.split(" ").map(_.toInt)
    val m = 1000000007
    var ans:Long = 1
    for (i <- 0 until n-k)
        ans = (ans*(n-k)) % m
    for (i <- 0 until k-1)
        ans = (ans*k) % m
    println(ans)
}


import java.util.Scanner

import scala.collection.mutable.SortedSet
object main extends App with fastIO {
//  def main(args: Array[String]) : Unit = {
//    val n = readLine().toInt
//    val input = new Scanner(System.in);
    val n = next
    val s = next
    var st = SortedSet[Char]();
    for (ch <- s) {
      if (!st.contains(ch.toLower)) {
        st += ch.toLower
      }

    }
    println( if (st.size >= 26) "YES" else "NO")
    flush

//  }
}

trait fastIO {
  import java.io._

  val isFile = false
  val input = "io.in"
  val output = "io.out"

  val bf = new BufferedReader(if(isFile) new FileReader(input) else new InputStreamReader(System.in))
  val in = new StreamTokenizer(bf)
  val out = new PrintWriter(if(isFile) new FileWriter(output) else new OutputStreamWriter(System.out))

  def next: String = {
    in.ordinaryChars('0', '9')
    in.wordChars('0', '9')
    in.nextToken
    in.sval
  }

  def nextInt: Int = {
    in.nextToken
    in.nval.toInt
  }

  def nextLong:Long ={
    in.nextToken
    in.nval.toLong
  }

  def nextDouble: Double = {
    in.nextToken
    in.nval.toDouble
  }

  def readLine: String = bf.readLine()
  def println(o:Any) = out.println(o)
  def print(o:Any) = out.print(o)
  def printf(s:String,o:Any*) = out.printf(s,o)
  def flush = out.flush
}


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 Array(a, b, c, d) = readLine().split(" ").map(_.toInt)
    if (a * d > b * c) {
      val num = a * d - b * c
      val den = a * d
      val div = gcd(num, den)
      println((num /  div) + "/" + (den / div))
    } else {
      val num = b * c - a * d
      val den = b * c
      val div = gcd(num, den)
      println((num /  div) + "/" + (den / div))
    }
  }
}


import java.io.FileReader
import java.util.Comparator

import collection.Searching._
import scala.collection.mutable

object Solution {
  //Console.setIn(new FileReader(new java.io.File("input")))
  //Console.setOut(new PrintStream(new java.io.File("output")))
  var caseNo = 1

  def doCase() : Unit = {
    val str = readLine()
    println(subsr(str, 0, "QAQ", 0, Array.fill(str.length, 3){-1}))
  }

  def subsr(str : String, strIdx : Int, pat : String, patIdx : Int, cache : Array[Array[Long]]) : Long = {
    if (patIdx == pat.length) {
       return 1
    } else if (strIdx == str.length) {
      return 0
    }

    if (cache(strIdx)(patIdx) == -1) {
      var result = 0L
      result += subsr(str, strIdx + 1, pat, patIdx, cache)
      if (str.charAt(strIdx).equals(pat.charAt(patIdx))) {
        result += subsr(str, strIdx + 1, pat, patIdx + 1, cache)
      }
      cache(strIdx)(patIdx) = result
    }
    cache(strIdx)(patIdx)
  }

  def main(args: Array[String]) {
    var tests = 1
    for (test <- 0 until tests) {
      doCase()
      caseNo += 1
    }
  }

  def readIntLine(): Array[Int] = {
    readLine().split(" ").map(_.toInt)
  }

  def readLongLine(): Array[Long] = {
    readLine().split(" ").map(_.toLong)
  }

  def readBigIntLine(): Array[BigInt] = {
    readLine().split(" ").map(BigInt.apply)
  }
}


import scala.io.StdIn

object Main extends App {
  def main() = {
    val n = StdIn.readLine().toInt
    val X = 998244353
    val result = Range(2, n+1).foldLeft((1, 1)) { (state, x) =>
      val (totalSum, prev) = state
      val m = multiples(x) - 1
      val cur = (prev + totalSum + m) % X
      ((totalSum + prev) % X, cur)
    }
    println(result._2)
  }

  def multiples(n: Int): Int = {
    if (n == 1)
      1
    else {
      val p = primeMultiple(n)
      var result = 1;
      var x = n
      while (x % p == 0) {
        result += 1
        x /= p
      }
      result * multiples(x)
    }
  }

  val primes = {
    def sieve(stream: Stream[Int]): Stream[Int] = {
      stream.head #:: stream.tail.filter(_ % stream.head != 0)
    }
    sieve(Stream.from(2))
  }

  var primeMultipleArr = Array.fill(1000001)(-1)
  primes.takeWhile(_ < 1000).foreach { x =>
    var y = x * x
    while (y < primeMultipleArr.size) {
      if (primeMultipleArr(y) == -1)
        primeMultipleArr(y) = x
      y += x
    }
  }

  def primeMultiple(i: Int) = {
    primeMultipleArr(i) match {
      case -1 => i
      case x => x
    }
  }

  main()
}


object Try1 {
  def main(args: Array[String]) {
    var ans,m,x,c,k, n, i: Int = 0
    var z = new Array[Int](26)
    n = readInt()
    var line = readLine()
    i=0
    ans=0
    while (i<n)
      {
        while(i<n && line(i)>='A' && line(i)<='Z') i+=1
        m=0
        for (k <- 0 to 25) z(k)=0
        while(i<n && line(i)>='a' && line(i)<='z')
          {
            z(line(i)-'a')+=1
            i+=1
          }
        for (k <- 0 to 25) if (z(k)>0) m+=1
        if (m>ans) ans=m
      }
    println(ans)
  }
}


import scala.collection.mutable.Stack
import scala.collection.mutable.Queue
import java.io.FileInputStream

object Main {
    def mktuple(c : Char, t :Tuple2[Int, Int]) : Tuple2[Int, Int] = {
            val (x, y) = t
                    c match {
                    case 'U' => (x, y +1)
                    case 'D' => (x, y-1)
                    case 'R' => (x +1, y)
                    case 'L' => (x-1, y)
            }
    }

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

            val s = new java.util.Scanner(System.in)
            val (a, b, move) = (s.nextInt, s.nextInt, s.next)
            var locs = new Array[Tuple2[Int, Int]](move.length + 1)
            locs(0) = (0, 0)
            for (i <- 1 to move.length)
                locs(i) = mktuple(move.charAt(i-1), locs(i-1))
                val (fullx, fully) = (locs(move.length)._1, locs(move.length)._2)
                for (i <- 0 to move.length){
                    if (fullx == 0 && fully == 0) {
                        if ( locs(i) == (a,b)){
                            println("Yes")
                            return
                        }
                    }
                    else if (fullx == 0){
                        if (a == locs(i)._1 &&
                                (b - (locs(i)._2)) % fully == 0 &&
                                (b - (locs(i)._2)) / fully >= 0){
                            println("Yes")
                            return
                        }
                    }
                    else if (fully == 0) {
                        if (b == locs(i)._2 &&
                                (a - (locs(i)._1)) % fullx == 0 &&
                                (a - (locs(i)._1)) / fullx >= 0) {
                            println("Yes")
                            return
                        }}
                    else {

                        val (t1, t2) = ( (a - locs(i)._1) /fullx, (b - locs(i)._2) / fully)
                                if (t1 == t2 && t1 >= 0 &&
                                (a - (locs(i)._1)) % fullx == 0 &&
                                (b - (locs(i)._2)) % fully == 0) {
                                    println("Yes")
                                    return
                                }
                    }
                }
            println("No")
    }
}


import java.util.Scanner

object P388A {
    def main(args: Array[String]) {
        val scanner = new Scanner(System.in)
        val n = scanner.nextInt()
        val boxes = for (i <- 1 to n) yield scanner.nextInt()
        val piles = construct(boxes.toList.sorted)
        println(piles.length)
    }

    def construct(boxes: List[Int]): List[Int] = {
        val piles = new scala.collection.mutable.ListBuffer[Int]()
        for (box <- boxes) {
            val index = piles.indexWhere(_ <= box)
            if (index == -1) piles += 1
            else piles(index) += 1
        }
        piles.toList
    }
}


object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class 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 = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N = ni()
    val S = ns(N)
    val eight = S count (_ == '8')
    val ans = min(S.length / 11, eight)
    out.println(ans)
  }

  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)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int): Array[Int] = map(n)(_ => ni())
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  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
  }

  def sumL(as: Array[Int]): Long = {
    var s = 0L
    rep(as.length)(i => s += as(i))
    s
  }
}


/**
  * Created by Permagate on 29-Jan-17.
  */
import java.io.PrintWriter
import java.util.Scanner

object A extends App {
  object Solver {
    def run(algoToRun: (Scanner, PrintWriter) => Unit): Unit = {
      val in = new Scanner(System.in)
      val out = new PrintWriter(System.out)

      try {
        algoToRun(in, out)
      } catch {
        case ex: Exception => ex.printStackTrace(out)
      } finally {
        out.flush()
        out.close()
      }
    }
  }

  Solver.run(algoToRun = (in, out) => {
    val n: Long = in.nextLong()
    val k: Int = in.nextInt()

    val divisors: List[Long] =
      (for (i <- 1L to math.sqrt(n).toLong if n % i == 0) yield i).toList
        .filter(num => n % num == 0)
        .flatMap(divisor => divisor match {
          case divi if divi == n / divi => List(divi)
          case divi => List(divi, n / divi)
        })
        .sorted

    val answer: Long = if (k > divisors.length) -1 else divisors(k - 1)
    out.println(answer)
  })
}


object Codeforces460A extends App{

  def DayCount(firsthave:Int,every:Int):Int={
    var have:Int=firsthave
    var plus:Int=firsthave/every
    have+=plus
    var remainder:Int= firsthave%every
    remainder+=plus
    while (remainder >= every){
      plus=remainder/every
      have+=plus
      remainder=remainder%every+plus
    }
    return have
  }

  val initval=scala.io.StdIn.readLine.split(" ").map(_.toInt)
  println(DayCount(initval(0),initval(1)))

}


object B extends App {

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

  val Array(n) = readInts(1)
  val as = Array.fill(n){ readLine.toInt }
  val ds = (0 until n).toSet

  var res = "NO"
  for {
    d <- ds.subsets
  } {
    val (l, r) = as.indices.partition(d)
    val pos = l.map(as).sum - r.map(as).sum
    if (pos % 360 == 0) res = "YES"
  }

  println(res)

  Console.flush
}


import scala.collection.mutable

object C 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, l) = readLongs(2)
  val cs = readLongs(n.toInt)
  val mem = mutable.Map.empty[(Long, Int), Long]

  def calc(ll: Long, from: Int): Long = {
    if (ll == 0L) 0L
    else if (from == 0L) ll * cs(0)
    else if (mem.contains((ll, from))) mem((ll, from))
    else {
      val v = 1L << from
      val full = cs(from) * ((ll + v - 1) / v)
      //println(ll, from , v, full)
      val c = if (ll >= v) {
        Math.min(
          Math.min(
            calc(ll % v, from - 1) + cs(from) * (ll / v),
            calc(ll, from - 1)),
          full)
      } else {
        Math.min(calc(ll, from - 1), full)
      }
      mem.put((ll, from), c)
      c
    }
  }

  val res = calc(l, n.toInt - 1)

  println(res)
}


object Sishik_49A extends App {
  val str = readLine()
  val splitted = str.split(" ").toList
  var splt = ""
  for (i <- splitted) {
    splt = splt + i
  }
  val lastSymbol = splt.substring(splt.length - 2, splt.length - 1).toUpperCase
  val listGLAS = List("A", "E", "I", "O", "U", "Y")
  val listSOGLAS = List("B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X", "Z")
  def identify(char: String): Unit = char match {
    case charac if listGLAS.contains(charac) => println("YES")
    case charac if listSOGLAS.contains(charac) => println("NO")
  }
  identify(lastSymbol)
}


/**
  *
  */
object P868B {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val h = sc.nextInt // 1 ≤ h ≤ 12
    val m = sc.nextInt // 0 ≤ m
    val s = sc.nextInt // s ≤ 59
    val t1 = sc.nextInt // 1 ≤ t1, t2 ≤ 12, t1 ≠ t2
    val t2 = sc.nextInt
    // Misha's position and the target time do not coincide with the position of any hand.

    //    Output
    //    Print "YES" (quotes for clarity), if Misha can prepare the contest on time, and "NO" otherwise.
    //    You can print each character either upper- or lowercase ("YeS" and "yes" are valid when the answer is "YES").

    //    Last time Misha talked with the coordinator at t1 o'clock, so now he stands on the number t1 on the clock face.
    //    The contest should be ready by t2 o'clock. In the terms of paradox it means that Misha has to go to number t2 somehow.
    //    Note that he doesn't have to move forward only: in these circumstances time has no direction.

    //    if hour clock points 12 and Misha stands at 11 then he cannot move to 1 along the top arc.
    //    He has to follow all the way round the clock center (of course, if there are no other hands on his way).

    val clock = 0 to 600
    val ns = s % 60 * 10
    val nm = m % 60 * 10 + { if (ns > 0) 1 else 0 }
    val nh = (h % 12) * 50 + { if (nm > 0) 1 else 0 }
    val wall = Seq(ns, nm, nh).toSet

    val a = (t1 % 12) * 50
    val b = (t2 % 12) * 50

    val cw = Iterator.continually(clock).flatten.dropWhile(_ != a).takeWhile(_ != b)
    val acw = Iterator.continually(clock.reverse).flatten.dropWhile(_ != a).takeWhile(_ != b)

    val canMoveClockwize = cw.forall(n => !wall.contains(n))
    val canMoveAntiClockwize = acw.forall(n => !wall.contains(n))

    if (canMoveAntiClockwize || canMoveClockwize) println("YES")
    else println("NO")
  }
}


object aTask {
  import scala.io.StdIn.{readInt, readLine}

  def func(str: List[Char], acc: List[Char]): List[Char] = {
    str match {
      case Nil => acc
      case x::Nil => x::acc
      case x::y::xs if x == 'U' && y == 'R' => func(xs, 'D'::acc)
      case x::y::xs if x == 'R' && y == 'U' => func(xs, 'D'::acc)
      case x::xs => func(xs, x::acc)

    }

  }

  def main(args: Array[String]): Unit ={
    val n = readInt
    val s = readLine.toCharArray.toList
    println(func(s, List()).length)
  }
}


object Main {

  def parseInput: (String, String, String) = {
    val lr = (readLine + "|_").split('|')
    val remain = readLine
    (lr(0), lr(1), remain)
  }

  def solve(left: String, right: String, remain: String): String = {
    val diff = math.abs(left.length - right.length)
    if (remain.length >= diff && (remain.length - diff) % 2 == 0) {
      val k = (remain.length - diff) / 2 + (if (left.length < right.length) diff else 0)
      (left + remain.substring(0, k)) + '|' + (right + remain.substring(k))
    } else {
      null
    }
  }

  def main(args: Array[String]) {
    val (left, right, remain) = parseInput
    val result = solve(left, right, remain)
    println(if (result == null) "Impossible" else result)
  }
}


object SantaClausAndAPlaceInAClass extends App{
  val Array(n, m, k) = io.StdIn.readLine.split("\\s+").map(_.toInt)
  val lane = Math.ceil(k / (2.0 * m)).toInt
  val desk = Math.ceil((k - (lane - 1) * 2 * m) / 2.0).toInt
  println(s"""$lane $desk ${if(k % 2 == 0) "R" else "L"}""")
}


object A extends App {
  val sc = new java.util.Scanner(System.in)
  val n, s = sc.nextInt()
  val t = Array.fill(n)(sc.nextInt()).sortWith(_ > _)
  println(if (t.tail.sum <= s) "YES" else "NO")
}


import scala.math._

object Main extends App {
  val Array(l1, r1, l2, r2, k) = readLine.split(" ").map(_.toLong)
  val l = max(l1, l2)
  val r = min(r1, r2)
  val res = if (l <= r) {r - l + 1 - (if (k >= l && k <= r) 1 else 0)} else 0
  println(res)
}


object Main
{
	def min (a : Int, b : Int) : Int =
		if (a < b) return a
		else return b
	def main (args : Array[String]) =
	{
		val n_v = readLine.split(' ').map(_.toInt)
		val n = n_v(0)
		val v = n_v(1)

		var grad = 2
		var kolku_imam = min(n-1, v) - 1
		var rez = kolku_imam + 1

		while (grad != n)
		{
			//println("vleguva za grad = " + grad + " kolku_imam = " + kolku_imam + " rez = " + rez)
			var kolku = n - grad
			if (kolku_imam >= kolku)
			{
				grad += 1
				kolku_imam -= 1
			}
			else
			{
				//staj si od ovaa stanica
				kolku_imam -= 1
				kolku_imam += 1
				rez += grad
				grad += 1
			}
		}

		println(rez)
	}
}


/**
  * Created by reynaldo on 2/17/16.
  */
object B {

  def main(args: Array[String]) {
    val in = scala.io.StdIn

    val line = in.readLine()
    val h = line.substring(0, 2).toInt
    val m = line.substring(3, 5).toInt
    val a = in.readInt()

    solve(h, m + a)

    @annotation.tailrec
    def solve(h: Int, m: Int): Unit = {
      if (m < 60 && h < 24)
        println(f"$h%02d:$m%02d")
      else if (m >= 60)
        solve(h + m / 60, m %  60)
      else
        solve(h % 24, m)
    }
  }
}


/**
  * Created by octavian on 06/02/2016.
  */
object Luke {

  def main(args: Array[String]) {

    //System.setIn(new FileInputStream("./src/luke.in"))
    //System.setOut(new PrintStream(new FileOutputStream("./src/luke.out")))

    val Array(d, l, v1, v2):Array[Double] = readLine().split(" ").map(_.toDouble)
    println((l - d)/(v1 + v2))
  }

}


import scala.collection._

object A extends App {

  val as = readLine
  val bs = readLine

  val res = (for (i <- 0 until as.length by 2) yield (as(i), bs(i)) match {
    case ('[', '8') => 1
    case ('(', '[') => 1
    case ('8', '(') => 1
    case (a, b) if a == b => 0
    case _ => -1
  }) sum

  if (res > 0) println("TEAM 2 WINS")
  else if (res < 0) println("TEAM 1 WINS")
  else println("TIE")
}


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

    import scala.io.StdIn
    var str1 : String = StdIn.readLine()
    var str2 : String = StdIn.readLine()

    if (str1.equalsIgnoreCase(str2)){
      println("0")
      return
    }

    str1 = str1.toUpperCase()
    str2 = str2.toUpperCase()

    if (str1.compareTo(str2) > 0){
      println("1")
    } else {
      println("-1")
    }

    /*for (i <- 0 until str1.length) {
      if (str1.charAt(i).toInt != str2.charAt(i).toInt) {
        if (str1.charAt(i).toInt > str2.charAt(i).toInt) {
          println("1")
        } else {
          println("-1")
        }
        return
      }
    }*/
  }
}


object Main {
  class Card(val value: Int, val suit: Char) {
  }

  object Card {
    def apply(s: String) = {
      val v = s(0) match {
        case '6' => 6
        case '7' => 7
        case '8' => 8
        case '9' => 9
        case 'T' => 10
        case 'J' => 11
        case 'Q' => 12
        case 'K' => 13
        case 'A' => 14
      }
      new Card(v, s(1))
    }

    def compare(c1: Card, c2: Card, s: Char) = {
      if (c1.suit == s && c2.suit == s) c1.value > c2.value
      else if (c1.suit == s) true
      else (c1.suit == c2.suit && c1.value > c2.value)
    }
  }

  def main(args: Array[String]) {
    val s = readChar()
    val cs = readLine().split(" ")
    val c1 = Card(cs(0))
    val c2 = Card(cs(1))
    if (Card.compare(c1, c2, s)) println("YES")
    else println("NO")
  }
}


import scala.math._, scala.io.StdIn._

object D extends App {
  val Array(n, k) = readLongs
  val Array(a, b) = readLongs

  val d1 = k + a - b
  val d2 = a + b
  println(s"${min(minStops(d1), minStops(d2))} ${max(maxStops(d1), maxStops(d2))}")

  def minStops(d: Long) = {
    val d1 = d / gcd(d, k)
    val k1 = k / gcd(d, k)
    val k2 = gcd(k1, n)
    k1 * (0L until n / k2).map(i => n / gcd(n, d1 + k2 * i)).min
  }

  def maxStops(d: Long) = n * k / gcd(d, k)

  def gcd(x: Long, y: Long): Long = if (y == 0) x else gcd(y, x % y)
  def lcm(x: Long, y: Long): Long = x * y / gcd(x, y)

  def readLongs() = readLine.split(" ").map(_.toLong)
}


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) = readInts(1)

  if (n == 1) {
    println("1 1")
    println(1)
  } else {
    val x = (n - 1) * 2
    println(s"$x 2")
    println("1 2")
  }
}


object A extends App {
  val Array(n, m, a, b) = scala.io.StdIn.readLine().split(" ").map(_.toLong)

  val t = n / m

  val r =
    if (t == 0) ((m - n) * a) min (n * b)
    else ((n - t * m) * b) min (((t + 1) * m - n) * a)

  println(r)
}


import scala.io.Source

object Solution extends App {
  val in = Source.stdin.getLines()
  val n = in.next().toLong
  if (n == 1)
    println(1)
  else if (n == 2)
    println(2)
  else if (n == 3)
    println(6)
  else if (n % 2 == 0 && n % 3 == 0)
    println((n - 1) * (n - 2) * (n - 3))
  else if (n % 2 == 0)
    println(n * (n - 1) * (n - 3))
  else
    println(n * (n - 1) * (n - 2))
}


import java.util.Scanner

object Rounding {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val X = sc.nextInt()
    println(if (X % 10 <= 5) X - (X % 10) else X + 10 - (X % 10))
  }
}


import collection.mutable.Map

object test6 extends App {
    val y=readInt
    for(i<- y+1 to 9999 if i.toString.distinct.size>=4) {println(i); exit(0)}
}


import java.util.Scanner

object ZeroProblem extends App {

  val s = new Scanner(System.in)
  val n = s.nextInt()
  val k = s.nextInt()
  var primes = Array.fill[Boolean](n + 1)(true)
  findPrimes()
  val sl = (2 to n).filter(primes).sliding(2).filter(_.size > 1).count(x => (x(0) + x(1) + 1) <= n && primes(x(0) + x(1) + 1))
  if (sl >= k) println("YES") else println("NO")

  def findPrimes(): Unit = {
    var i = 2
    while (i < n + 1) {
      if (primes(i)) {
        var j = i + i
        while (j < n) {
          primes(j) = false
          j += i
        }
      }
      i += 1
    }
  }

}


object Main extends App {
  def luckyDigit(c : Char) = c == '4' || c == '7'
  def luckyNum(s : String) = s.foldLeft(true)(_ & luckyDigit(_))
  def sumChar(s : String) = s.foldLeft(0)(_ + _ -'0')
  def sumEqual(s : String, l : Int) = sumChar(s.take(l)) == sumChar(s.drop(l))
  def lucky(n : Int, s : String) = luckyNum(s) && sumEqual(s, n/2)

  println(if (lucky(readLine.toInt, readLine)) "YES" else "NO")
}


object Solution extends App {
  val in = scala.io.Source.stdin.getLines()
  def sim(x: Long, y: Long, m: Long, sum: Long = 0l): Long = {
    val min = Math.min(x, y)
    val max = Math.max(x, y)
    if (max >= m)
      sum
    else
      sim(max, min + max, m, sum + 1)
  }

  val Array(x, y, m) = in.next().split(' ').map(_.toLong)
  if (x >= m || y >= m)
    println(0)
  else if (x <= 0 && y <= 0)
    println(-1)
  else if (x >= 0 && y >= 0) {
    println (sim(x, y, m))
  }
  else
  {
    val max = Math.max(x, y)
    val min = Math.min(x, y)
    val toPlus = -(min + max - 1) / max
    val nMin = toPlus * max + min
    println (sim(max, nMin, m) + toPlus)
  }
}


object CF1076b extends App {
  val in = new java.util.Scanner(System.in)
  val out = new java.io.PrintWriter(System.out)

  import scala.math._

  def findPrime(n: Long) : Long = {
    if (n % 2 == 0) { 2 }
    else {
      (3 to Int.MaxValue by 2).view.map(_.toLong).takeWhile((x: Long) => x*x <= n).filter(n % _ == 0).headOption getOrElse n
    }
  }

  def solve(n: Long) : Long = {
    if (n % 2 == 0) { n/2 }
    else {
      solve(n-findPrime(n)) + 1
    }
  }

  val n = in.nextLong
  out.println(solve(n))
  out.flush;out.close;
}


object Two63A extends App {
	import java.io.PrintWriter
	import java.util.Scanner

	val in = new Scanner(System.in)
	val out = new PrintWriter(System.out)
	val m = for {
		i <- 0 until 5
		j <- 0 until 5
		k = in.nextInt()
		if k == 1
	} yield (i, j)
	val abs = math.abs(m(0)._1 - 2) + math.abs(m(0)._2 - 2)
	out.println(abs)
	in.close()
	out.close()
}


import scala.io.StdIn._

object CF577A extends App {
  val Array(n, x) = readLine().split(" ").map(_.toInt)
  var c = 0
  (1 to n).foreach(i => if (x % i == 0 && x / i <= n) c = c + 1)
  println(c)
}


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

    val Array(n, a, b, c) = scala.io.StdIn.readLine.split(" ").map(_.toLong)
    val ans = n % 4 match {
      case 0 => 0
      case 1 => Array(c, 3 * a, a + b).min
      case 2 => Array(b, 2 * a, 2 * c).min
      case 3 => Array(a, b + c, 3 * c).min
    }
    println(ans)
  }
}


import scala.io.StdIn

object Codeforces114A {
  def isHappy(x: Int, y: Int, z: Int, a: Int, b: Int, c: Int): Boolean =
    x <= a && x + y <= a + b && x + y + z <= a + b + c

  def main(args: Array[String]): Unit = {
    val Array(x, y, z) = StdIn.readLine().trim.split(" ").map(_.toInt)
    val Array(a, b, c) = StdIn.readLine().trim.split(" ").map(_.toInt)

    val happy = isHappy(x, y, z, a, b, c)

    val output = if (happy) "YES" else "NO"
    println(output)
  }
}


import scala.annotation.tailrec
object X extends App {
  case class Point(x: Double, y: Double)
  case class Line(u: Point, v: Point) {
    lazy val slope = (v.y - u.y) / (v.x - u.x)
    lazy val midPoint = Point((u.x + v.x) / 2, (u.y + v.y) / 2)
  }

  val perpBisector = (l: Line) => {
    val mid = l.midPoint
    val otherPoint = Point(mid.x + l.u.y - l.v.y, mid.y + l.v.x - l.u.x)
    Line(mid, otherPoint)
  }

  val intersectLine = (l1: Line, l2: Line) => {
    val numer =
      (l1.u.x - l2.u.x) * (l2.u.y - l2.v.y) - (l1.u.y - l2.u.y) * (l2.u.x - l2.v.x)

    val denom =
      (l1.u.x - l1.v.x) * (l2.u.y - l2.v.y) - (l1.u.y - l1.v.y) * (l2.u.x - l2.v.x)

    val t = numer / denom

    val x = l1.u.x + t * (l1.v.x - l1.u.x)
    val y = l1.u.y + t * (l1.v.y - l1.u.y)

    Point(x, y)
  }

  val calculateCircleCentre = (A: Point, B: Point, C: Point) => {
    val l1 = Line(B, C)
    val l2 = Line(A, B)

    intersectLine(perpBisector(l1), perpBisector(l2))
  }

  val getAngle = (p1: Point, p2: Point, p3: Point) => {
    val r1Square =
      (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y)
    val r2Square =
      (p2.x - p3.x) * (p2.x - p3.x) + (p2.y - p3.y) * (p2.y - p3.y)
    val r3Square =
      (p3.x - p1.x) * (p3.x - p1.x) + (p3.y - p1.y) * (p3.y - p1.y)

    val denom = 2 * Math.sqrt(r1Square * r2Square)
    val numer = r1Square + r2Square - r3Square

    val cosTheta = numer / denom

    Math.acos(cosTheta)
  }

  @tailrec
  def findDenom(
      dec: Double,
      closeEnough: (Double, Int) => Boolean,
      i: Int = 1,
      bestCase: Int = 1,
      closestDiff: Double = 1
  ): Int = {
    val mult = i * dec
    val diff = mult - Math.floor(mult)
    val actualDiff = if (diff < 0.5) diff else 1 - diff
    val nextClosestDiff =
      if (actualDiff < closestDiff) actualDiff else closestDiff
    val nextBestCase = if (actualDiff == nextClosestDiff) i else bestCase

    if (closeEnough(closestDiff, i)) bestCase
    else findDenom(dec, closeEnough, i + 1, nextBestCase, nextClosestDiff)
  }
  @tailrec
  def gcd(a: Int, b: Int): Int = {
    if (b == 0) a else gcd(b, a % b)
  }

  val lcm = (a: Int, b: Int) => a * b / gcd(a, b)

  val computeArea = (p1: Point, p2: Point, p3: Point) => {
    val closeEnough = (closestDiff: Double, i: Int) => {
      closestDiff < 0.000001 || i > 100
    }
    val centre = calculateCircleCentre(p1, p2, p3)

    val angle1 = getAngle(p1, centre, p2) / (2 * Math.PI)
    val angle2 = getAngle(p2, centre, p3) / (2 * Math.PI)
    val angle3 = getAngle(p3, centre, p1) / (2 * Math.PI)

    val denom1 = findDenom(angle1, closeEnough)
    val denom2 = findDenom(angle2, closeEnough)
    val denom3 = findDenom(angle3, closeEnough)

    val lcmAngle = lcm(lcm(denom1, denom2), denom3)

    val area =
      0.5 * ((centre.x - p1.x) * (centre.x - p1.x) + (centre.y - p1.y) * (centre.y - p1.y)) * Math
        .sin((2 * Math.PI) / lcmAngle) * lcmAngle

    area
  }

  val lineToPoint = (line: String) => {
    val coords = line.split(" ").map(s => s.toDouble)
    Point(coords(0), coords(1))
  }

  val t1 = scala.io.StdIn.readLine()
  val t2 = scala.io.StdIn.readLine()
  val t3 = scala.io.StdIn.readLine()

  val p1 = lineToPoint(t1)
  val p2 = lineToPoint(t2)
  val p3 = lineToPoint(t3)

  val area = computeArea(p1, p2, p3)

  println(area)
}


object Main  extends App {
    val n = readLine.split(' ').map(_.toInt)
    val arr = readLine.split(' ').map(_.toInt).toList
    arr.sorted.map{x=>print(x+" ")}
}


import scala.io.StdIn
import scala.util.control.Breaks._

object Vitya_in_the_Countryside_719A {
  def main(args: Array[String]): Unit = {
    val c = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
    val cal = c ++ c ++ c ++ c ++ c
    val n = StdIn.readInt()
    val observ = StdIn.readLine().split(" ").map( _.toInt )
    var up = 0
    var down = 0
    for (i <- cal.indices.dropRight(observ.length)) {
      breakable {
        for (j <- observ.indices) {
          if (cal(i + j) != observ(j)) break
          if (j == observ.length - 1 && i + j != cal.length - 1) {
            if (cal(i + j + 1) > cal(i + j)) up += 1
            else down += 1
          }
        }
      }
    }
    if (up == 0 && down > 0) println("DOWN")
    else if (down == 0 && up > 0) println("UP")
    else println(-1)
  }
}


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

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

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

  // Standard code above, custom code below

  case class Solution(runCount: Int, runs: List[Int])

  def processLines(lines: Iterator[String], bw: BufferedWriter): Unit = {

    val size = lines.next().toInt
    val chars = lines.next() + 'W' // Ensure last run isn't missed by appending dummy character
    val soln = solve(size, chars.toList)
    bw.write(s"${soln.runCount}")
    bw.newLine()
    if (soln.runCount > 0) {
      bw.write(soln.runs.mkString(" "))
      bw.newLine()
    }
  }

  case class Accumulator(wasLastCharB: Boolean, blackCount: Int, runsInReverse: List[Int], runCount: Int)

  def solve(size: Int, chars: List[Char]): Solution = {
    val accumulator = chars.foldLeft(Accumulator(false, 0, List.empty, 0)) { (acc: Accumulator, ch: Char) =>
        if (ch == 'B') {
          acc.copy(wasLastCharB = true, blackCount = acc.blackCount + 1)
        } else {
          if (acc.wasLastCharB) {
            acc.copy(wasLastCharB = false, blackCount = 0,
              runsInReverse = acc.blackCount :: acc.runsInReverse,
              runCount = acc.runCount + 1)
          } else {
            acc
          }
        }
    }
    Solution(accumulator.runCount, accumulator.runsInReverse.reverse)
  }
}


object A313 {
  @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 main(args: Array[String]): Unit = {
    val Array(n) = readInts(1)
    if(n > 0) {
      println(n)
    } else {
      val s = n.toString.drop(1)
      if(s.length == 1) {
        println("0")
      } else {
        if (-s.dropRight(1).toInt > -(s.dropRight(2) + s.last).toInt) {
          println(- s.dropRight(1).toInt)
        } else {
          println(- (s.dropRight(2) + s.last).toInt)
        }
      }
    }
  }
}


import scala.io._
import scala.collection.mutable._
import java.util.StringTokenizer

object HelloWorld {

  def main(args: Array[String]): Unit = {
    var s = readLine + readLine + readLine;
    if (s.substring(0, 4) == s.substring(5, 9).reverse) {
      println("YES");
    } else {
      println("NO");
    }
  }

}


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

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

  val N = sc.nextInt
  val stack = 0 :: 4 :: List.fill(8)(4) ::: (15 :: 4 :: Nil)

  def solve(): Int = {
    val rest = N - 10
    if (rest < 1 || 11 < rest) 0
    else stack(rest)
  }

  out.println(solve)
  out.close
}


object B 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(k, p) = readInts(2)

  var sum = 0L

  var x = 1L
  var mul = 10L
  while (x <= k) {
    if (x >= mul) mul *= 10
    val y = x.toString.reverse.toLong
    val xy = x * mul + y
    sum = (sum + xy) % p
    x += 1
  }

  println(sum)
}


object objecta {
    import java.io.{BufferedReader, FileInputStream, InputStreamReader}
    import scala.collection.mutable
    import scala.util.control.Breaks._
    import scala.util.Random

    val source = System.in
    //new FileInputStream("D://in.txt")
    implicit val reader = new BufferedReader(new InputStreamReader(source))

    def read()(implicit reader: BufferedReader): String = reader.readLine().split(" ")(0)
    def readArray()(implicit reader: BufferedReader): Array[String] = reader.readLine().split(" ")
    def readString()(implicit reader: BufferedReader): String = reader.readLine()

    def main(args: Array[String]): Unit = {
        val n = read().toInt
        print(n % 2)
    }
}


object Contest extends App {

  val Array(a, b) = readLine().split(" ").map(_.toInt)
  val p2 = math.min(a, b)
  println((a + b - 1 - p2) + " " + p2)
}


/**
  * @author tdx
  */
object Solution {
  import scala.io.StdIn._

  def main(args: Array[String]): Unit = {
    val parts = readLine().split(" ").map(_.toInt)
    val n = parts(0)
    val k = parts(1)
    val grades = readLine().split(" ").map(_.toInt)
    var cur = grades.sum
    var total = n
    while (math.round(cur*1.0/total) < k) {
      total += 1
      cur += k
    }
    println(total - n)
  }
}


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

  override def apply(io: IO): io.type = {
    val v = io.read[Vector[Int]]
    def isOdd(x: Int) = x%2 == 1
    val ans = Iterator(v.head, v.last, v.length).forall(isOdd)
    io.write(ans.toEnglish)
    io
  }
}
/****************************[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()
}
object Utils {
  import scala.collection.mutable, mutable.{Map => Dict}
  implicit class GenericExtensions[A](val a: A) extends AnyVal {
    def in(set: collection.Set[A]): Boolean = set(a)
    def some: Option[A] = Some(a)
    def partialMatch[B](f: PartialFunction[A, B]): Option[B] = f lift a
  }
  implicit class TraversableExtensions[A, C[X] <: Traversable[X]](val t: C[A]) extends AnyVal {
    def onlyElement: A = assuming(t.size == 1)(t.head)
    def groupByIdentifier[K](f: A => K): Map[K, A] = t.groupBy(f).mapValues(_.onlyElement)
    def duplicates(implicit b: C of A): C[A] = {
      val elems = mutable.Set.empty[A]
      (t collect {case i if !elems.add(i) => i}).to[C]
    }
    def sumWith[B](f: A => B)(implicit n: Numeric[B]): B = t.foldLeft(n.zero) {case (p, i) => n.plus(p, f(i))}
    def maxWith[B](f: A => B)(implicit ord: Ordering[B]): Option[B] = t.view.map(f).reduceOption(ord.max)
    def minWith[B](f: A => B)(implicit ord: Ordering[B]): Option[B] = t.view.map(f).reduceOption(ord.min)
    def zipWith[B](f: A => B)(implicit b: C of (A, B)): C[(A, B)] = (t map {i => i -> f(i)}).to[C]
    def mapTo[B](f: A => B)(implicit b: C of (A, B)): Map[A, B] = zipWith(f).toUniqueMap
    def whenNonEmpty[B](f: t.type => B): Option[B] = when(t.nonEmpty)(f(t))  // e.g. grades.whenNonEmpty(_.max)
    def collectFirst[B](f: PartialFunction[A, Option[B]]): Option[B] = t.view collect f collectFirst {case Some(x) => x}
    def toMutableMultiSet: Dict[A, Int] = {
      val c = map[A] to 0
      t.foreach(i => c(i) += 1)
      c
    }
    def toMultiSet: Map[A, Int] = toMutableMultiSet.toMap withDefaultValue 0
    def X[B](s: Traversable[B]): Iterator[(A, B)] = for {a <- t.toIterator; b <- s} yield (a, b)
  }
  implicit class ArrayExtensions[A <: AnyRef](val a: Array[A]) extends AnyVal {
    def sort(from: Int, until: Int)(implicit cmp: Ordering[A]): Unit = java.util.Arrays.sort(a, from, until, cmp) //sort [from, until)
  }
  implicit class ArrayExtensions2[A](val a: Array[A]) extends AnyVal {
    def sort(from: Int, until: Int)(implicit cmp: Ordering[A]): Unit = a.view(from, until).sorted.copyToArray(a, from)
  }
  implicit class SeqExtensions[A, C[X] <: Seq[X]](val s: C[A]) extends AnyVal {
    def isRotationOf(t: Seq[A]): Boolean = s ++ s containsSlice t
  }
  implicit class PairExtensions[A, B](val p: (A, B)) extends AnyVal {
    def key = p._1
    def value = p._2
    def toSeq(implicit ev: A =:= B): Seq[A] = Seq(p._1, p._2.asInstanceOf[A])
  }
  implicit class PairsExtensions[A, B, C[X] <: Traversable[X]](t: C[(A, B)]) {
    def toUniqueMap: Map[A, B] = t.groupByIdentifier(_.key).mapValues(_.value)
    def toMultiMap(implicit b: C of B): Map[A, C[B]] = t.groupBy(_.key).mapValues(_.map(_.value).to[C])
    def swap(implicit b: C of (B, A)): C[(B, A)] = t.map(_.swap).to[C]
  }
  implicit class MapExtensions[K, V, C[X, Y] <: Map[X, Y]](val m: C[K, V]) extends AnyVal {
    def lastKeyOption: Option[K] = m.lastOption.map(_.key)
    def firstKeyOption: Option[K] = m.headOption.map(_.key)
    def invert: Map[V, Set[K]] = m.toSet[(K, V)].swap.toMultiMap
    def mapKeys[K2](f: K => K2): Map[K2, V] = m map {case (k, v) => f(k) -> v}
    def toMutable: Dict[K, V] = Dict.empty[K, V] ++ m
    def mapValuesSafely[V2](f: V => V2): Map[K, V2] = m.mapValues(f).view.force //Hack to get around https://issues.scala-lang.org/browse/SI-4776
  }
  implicit class MutableMapExtensions[K, V](val m: mutable.Map[K, V]) extends AnyVal {
    def removeLast(): Option[(K, V)] = m.lastOption.map(removeNode)
    def removeFirst(): Option[(K, V)] = m.headOption.map(removeNode)
    private def removeNode(kv: (K, V)): (K, V) = {
      m -= kv.key
      kv
    }
  }
  implicit class SetExtensions[A, C[A] <: Set[A]](val s: C[A]) extends AnyVal {
    def notContains(x: A): Boolean = !(s contains x)
    def toMutable = mutable.Set.empty[A] ++ s
  }
  implicit class IterableExtensions[A, C[A] <: Seq[A]](val s: C[A]) extends AnyVal {
    def indicesWhere(f: A => Boolean): Seq[Int] = s.zipWithIndex.collect {case (a, i) if f(a) => i}
    def deleteAtIndex(i: Int, howMany: Int = 1) = s.patch(i, Nil, howMany)
    def insertAtIndex(i: Int, items: Seq[A]) = s.patch(i, items, 0)
    def findWithIndex(f: A => Boolean): Option[(A, Int)] = s.zipWithIndex find {case (a, _) => f(a)}
    def foldUntil[B](z: B)(f: (B, A) => B)(c: B => Boolean): Option[(B, Int)] = s.view.scanLeft(z)(f).findWithIndex(c)
  }
  implicit class BooleanExtensions(val x: Boolean) extends AnyVal {
    def to[A](implicit n: Numeric[A]) = if(x) n.one else n.zero
    def toEnglish = if(x) "Yes" else "No"
  }
  implicit class IntExtensions(val x: Int) extends AnyVal {
    import java.lang.{Integer => JInt}
    def withHighestOneBit: Int = JInt.highestOneBit(x)
    def withLowestOneBit: Int = JInt.lowestOneBit(x)
    def numberOfLeadingZeroes: Int = JInt.numberOfLeadingZeros(x)
    def numberOfTrailingZeroes: Int = JInt.numberOfTrailingZeros(x)
    def bitCount: Int = JInt.bitCount(x)
    def setLowestBits(n: Int): Int = x | (left(n) - 1)
    def clearLowestBits(n: Int): Int = x & left(n, ~0)
    def setBit(i: Int, set: Boolean): Int = if (set) setBit(i) else clearBit(i)
    def setBit(i: Int): Int = x | left(i)
    def clearBit(i: Int): Int = x & ~left(i)
    def toggleBit(i: Int): Int = x ^ left(i)
    def testBit(i: Int): Boolean = ((x >> i) & 1) == 1
    private def left(bits: Int, num: Int = 1) = assuming(bits >= 0 && bits < JInt.SIZE)(num << bits)
    def X(y: Int): Iterator[(Int, Int)] = until(x) X until(y)
  }
  implicit class LongExtensions(val x: Long) extends AnyVal {
    import java.lang.{Long => JLong}
    def withHighestOneBitSet: Long = JLong.highestOneBit(x)
    def withLowestOneBitSet: Long = JLong.lowestOneBit(x)
    def numberOfLeadingZeroes: Int = JLong.numberOfLeadingZeros(x)
    def numberOfTrailingZeroes: Int = JLong.numberOfTrailingZeros(x)
    def bitCount: Int = JLong.bitCount(x)
    def setLowestBits(n: Int): Long = x | (left(n) - 1)
    def clearLowestBits(n: Int): Long = x & left(n, ~0L)
    def setBit(i: Int, set: Boolean): Long = if (set) setBit(i) else clearBit(i)
    def setBit(i: Int): Long = x | left(i)
    def clearBit(i: Int): Long = x & ~left(i)
    def toggleBit(i: Int): Long = x ^ left(i)
    def testBit(i: Int): Boolean = ((x >> i) & 1) == 1
    private def left(bits: Int, num: Long = 1L) = assuming(bits >= 0 && bits < JLong.SIZE)(num << bits)
  }
  implicit class NumericExtensions[A](val x: A)(implicit n: Numeric[A]) {
    import Numeric.Implicits._
    def **(i: Int): A = if (i == 0) n.one else {
      val h = x ** (i/2)
      if (i%2 == 0) h * h else h * h * x
    }
    def distance(y: A) = (x - y).abs()
    def nonNegative: Option[A] = when(n.gteq(x, n.zero))(x)
    def whenNegative(f: => A): A = nonNegative getOrElse f   //e.g. students indexOf "Greg" whenNegative Int.MaxValue
  }
  implicit class IntegralExtensions[A](val x: A)(implicit n: Integral[A]) {
    import scala.collection.immutable.NumericRange, Integral.Implicits._
    def mod(y: A): A = x - ((x / y) * y) //(x/y)*y + (x mod y) == x
    def -->(y: A): NumericRange.Inclusive[A] = NumericRange.inclusive(x, y, if (n.lteq(x, y)) n.one else -n.one)
    def ceilDiv(y: A): A = if (mod(y) == n.zero) x/y else n.one + (x/y)
  }
  implicit def toPoint[A](p: (A, A))(implicit n: Numeric[A]) = new java.awt.geom.Point2D.Double(n.toDouble(p._1), n.toDouble(p._2))
  def desc[A: Ordering]: Ordering[A] = asc[A].reverse  //e.g. students.sortBy(_.height)(desc)
  def asc[A](implicit order: Ordering[A]): Ordering[A] = order
  def map[K] = new {
    def to[V](default: => V): Dict[K, V] = using(_ => default)
    def using[V](f: K => V): Dict[K, V] = new mutable.HashMap[K, V]() {
      override def apply(key: K) = getOrElseUpdate(key, f(key))
    }
  }
  def newMultiMap[K, V] = map[K] to mutable.Set.empty[V]
  def memoize[A, B](f: A => B): A ==> B = map[A] using f
  implicit class FuzzyDouble(val x: Double) extends AnyVal {
    def  >~(y: Double) = x > y + eps
    def >=~(y: Double) = x >= y + eps
    def  ~<(y: Double) = y >=~ x
    def ~=<(y: Double) = y >~ x
    def  ~=(y: Double) = (x distance y) <= eps
  }
  def toPolygon(points: Traversable[(Int, Int)]): java.awt.Polygon = {
    val (xs, ys) = points.unzip
    new java.awt.Polygon(xs.toArray, ys.toArray, points.size)
  }
  def toShape(points: Traversable[(Double, Double)]): java.awt.geom.GeneralPath = {
    val shape = new java.awt.geom.GeneralPath()
    points.headOption foreach {case (x, y) => shape.moveTo(x, y)}
    points.tail foreach {case (x, y) => shape.lineTo(x, y)}
    shape.closePath()
    shape
  }
  def until(until: Int): Range = 0 until until
  def not[A](f: A => Boolean): A => Boolean = {x: A => !f(x)}
  def assuming[A](cond: => Boolean)(f: => A): A = {require(cond); f}
  @inline def when[A](check: Boolean)(f: => A): Option[A] = if (check) f.some else None
  def repeat[U](n: Int)(f: => U): Unit = (1 to n).foreach(_ => f)
  type of[C[_], A] = scala.collection.generic.CanBuild[A, C[A]]
  type ==>[A, B] = collection.Map[A, B]
  val mod: Int = (1e9 + 7).toInt
  val eps: Double = 1e-9
}
/***********************************[Scala I/O]*********************************************/
import Utils._, java.io._, java.util.StringTokenizer

class IO(in: BufferedReader, out: BufferedWriter) extends Iterator[String] with AutoCloseable with Flushable {
  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()
    when(tokenizers.nonEmpty)(tokenizers.head)
  }

  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 {
  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.onlyElement)
    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
      }
    }
  }
}


import scala.io.StdIn

object Solution {

  def solve(s: String): Int = {
    var cnt = 0
    var ans = 0
    for (i <- s.length - 1 to 0 by -2) {
      if (i != 0) {
        ans += 1
      } else {
        ans += cnt
      }
      if (s.charAt(i) == '1' || i > 0 && s.charAt(i - 1) == '1') {
        cnt = 1
      }
    }
    ans
  }

  def main(args: Array[String]): Unit = {
    val s = StdIn.readLine
    print(solve(s))
  }
}


object C {

  def main(args: Array[String]): Unit = {}

  @inline def tokenizeLine = new java.util.StringTokenizer(scala.io.StdIn.readLine)
  def readLongs(n: Int) = { val tl = tokenizeLine; Array.fill(n)(tl.nextToken.toLong) }

  val Array(la, ra, ta) = readLongs(3)
  val Array(lb, rb, tb) = readLongs(3)

  val lenA = ra - la + 1
  val lenB = rb - lb + 1

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

  val g = gcd(ta, tb)

  if (g == 1) {
    println(lenA min lenB)
  } else if (ta == tb) {
    println(((ra min rb) - (la max lb) + 1) max 0)
  } else {

    val x1 = if (la <= lb) {
      val d = (lb - la) % g
      Math.max(
        Math.min(lenA - d, lenB),
        Math.min(lenA, lenB - (g - d)))
    } else {
      val d = (la - lb) % g
      Math.max(
        Math.min(lenA, lenB - d),
        Math.min(lenA - (g - d), lenB))
    }

    val x2 = if (ra <= rb) {
      val d = (rb - ra) % g
      Math.max(
        Math.min(lenA - d, lenB),
        Math.min(lenA, lenB - (g - d)))
    } else {
      val d = (ra - rb) % g
      Math.max(
        Math.min(lenA, lenB - d),
        Math.min(lenA - (g - d), lenB))
    }
    //println(g, x1, x2)
    val res = 0L max x1 //max x2

    println(res)
  }
}


import Utils._, annotation.tailrec, collection.mutable, util._, control._, math.Ordering.Implicits._

object _645A extends CodeForcesApp {
  override def apply(io: IO) = {
    val p1, p2 = (io[String] + io[String].reverse).replace("X", "").toIndexedSeq
    io += p1 isRotationOf p2
  }
}
/****************************[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()
}
object Utils {
  import scala.collection.mutable, mutable.{Map => Dict}
  implicit class GenericExtensions[A](val a: A) extends AnyVal {
    def partialMatch[B](f: PartialFunction[A, B]): Option[B] = f lift a
  }
  implicit class TraversableExtensions[A](val t: Traversable[A]) extends AnyVal {
    def onlyElement: A = t.head.ensuring(t.size == 1)
    def groupByIdentifier[K](f: A => K): Map[K, A] = t.groupBy(f).mapValues(_.onlyElement)
    def duplicates: Traversable[A] = {
      val elems = mutable.Set.empty[A]
      t collect {case i if !elems.add(i) => i}
    }
    def zipWith[B](f: A => B): Traversable[(A, B)] = t map {i => i -> f(i)}
    def mapTo[B](f: A => B): Map[A, B] = zipWith(f).toUniqueMap
    def whenNonEmpty[B](f: t.type => B): Option[B] = when(t.nonEmpty)(f(t))  // e.g. grades.whenNonEmpty(_.max)
    def collectFirst[B](f: PartialFunction[A, Option[B]]): Option[B] = t.view collect f collectFirst {case Some(x) => x}
    def toMutableMultiSet: Dict[A, Int] = {
      val c = map[A] to 0
      t.foreach(i => c(i) += 1)
      c
    }
    def toMultiSet: Map[A, Int] = toMutableMultiSet.toMap
  }
  implicit class ArrayExtensions[A <: AnyRef](val a: Array[A]) extends AnyVal {
    def sort(from: Int, until: Int)(implicit cmp: Ordering[A]): Unit = java.util.Arrays.sort(a, from, until, cmp) //sort [from, until)
  }
  implicit class ArrayExtensions2[A](val a: Array[A]) extends AnyVal {
    def sort(from: Int, until: Int)(implicit cmp: Ordering[A]): Unit = a.view(from, until).sorted.copyToArray(a, from)
  }
  implicit class IndexedSeqExtensions[A](val s: IndexedSeq[A]) extends AnyVal {
    def isRotationOf(t: Seq[A]): Boolean = s ++ s containsSlice t
    def withOffset(offset: Int): IndexedSeq[A] = Iterator.fill(offset)(null.asInstanceOf[A]) ++: s
  }
  implicit class PairsExtensions[A, B](val t: Traversable[(A, B)]) extends AnyVal {
    def toUniqueMap: Map[A, B] = t.groupByIdentifier(_._1).mapValues(_._2)
    def toMultiMap: Map[A, Traversable[B]] = t.groupBy(_._1).mapValues(_.map(_._2))
    def swap: Traversable[(B, A)] = t.map(_.swap)
  }
  implicit class MapExtensions[K, V](val m: Map[K, V]) extends AnyVal {
    def invert: Map[V, Set[K]] = m.swap.toMultiMap.mapValues(_.toSet)
    def mapKeys[K2](f: K => K2): Map[K2, V] = m map {case (k, v) => f(k) -> v}
  }
  implicit class LongExtensions(val x: Long) extends AnyVal {
    def bitCount: Int = java.lang.Long.bitCount(x)
  }
  implicit class NumericExtensions[A](val x: A)(implicit n: Numeric[A]) {
    import Numeric.Implicits._
    def ^^(i: Int): A = if (i == 0) n.one else {
      val h = x ^^ (i/2)
      if (i%2 == 0) h * h else h * h * x
    }
    def nonNegative: Option[A] = when(n.gteq(x, n.zero))(x)
    def whenNegative(f: => A): A = nonNegative getOrElse f   //e.g. students.indexOf("Greg").whenNegative Int.MaxValue
  }
  implicit class IntegralExtensions[A](val x: A)(implicit n: Integral[A]) {
    import scala.collection.immutable.NumericRange, Integral.Implicits._
    def mod(y: A): A = x - ((x / y) * y) //(x/y)*y + (x mod y) == x
    def -->(y: A): NumericRange.Inclusive[A] = NumericRange.inclusive(n.min(x, y), n.max(x, y), n.one)
  }
  def desc[A: Ordering]: Ordering[A] = asc[A].reverse  //e.g. students.sortBy(_.height)(desc)
  def  asc[A](implicit order: Ordering[A]): Ordering[A] = order
  def map[K] = new {
    def to[V](default: V): Dict[K, V] = Dict.empty[K, V] withDefaultValue default
  }
  def memoize[I] = new {
    def apply[O](f: I => O): I => O = new mutable.HashMap[I, O]() {
      override def apply(key: I) = getOrElseUpdate(key, f(key))
    }
  }
  @inline def when[A](check: Boolean)(f: => A): Option[A] = if (check) Some(f) else None
  def repeat(n: Int)(f: => Unit): Unit = (1 to n).foreach(_ => f)
  val mod: Int = (1e9 + 7).toInt
}
/***********************************[Scala I/O]*********************************************/
import Utils._, java.io._, java.util.StringTokenizer, scala.collection.generic.CanBuild

class IO(in: BufferedReader, out: BufferedWriter) extends PrintWriter(out, true) with Iterator[String] {
  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

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

  def apply[A](implicit read: IO.Read[A]): A = read.apply(this)
  def apply[C[_], A: IO.Read](n: Int)(implicit builder: CanBuild[A, C[A]]): C[A] = (builder() ++= Iterator.fill(n)(apply)).result()

  def till(delim: String): String = tokenizer().get.nextToken(delim)
  def tillEndOfLine(): String = till("\n\r")

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

  var separator = " "
  private[this] var isNewLine = true

  def +=[A](x: A)(implicit write: IO.Write[A]): this.type = {
    write(this)(x)
    this
  }
  def appendNewLine(): this.type = {
    println()
    this
  }

  override def print(obj: Any) = {
    if (isNewLine) isNewLine = false else super.print(separator)
    super.print(obj)
  }
  override def println() = if (!isNewLine) {
    super.println()
    isNewLine = true
  }
  override def close() = {
    flush()
    in.close()
    super.close()
  }
}
object IO {
  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: CanBuild[A, C[A]]): Read[C[A]]            = new Read(r => r[C, A](r[Int]))
    implicit val string                                                  : Read[String]          = new Read(_.next())
    implicit val char                                                    : Read[Char]            = string.map(_.toTraversable.onlyElement)
    implicit val boolean                                                 : Read[Boolean]         = string.map(_.toBoolean)
    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[A], r[B]))
    implicit def tuple3[A: Read, B: Read, C: Read]                       : Read[(A, B, C)]       = new Read(r => (r[A], r[B], r[C]))
    implicit def tuple4[A: Read, B: Read, C: Read, D: Read]              : Read[(A, B, C, D)]    = new Read(r => (r[A], r[B], r[C], r[D]))
    implicit def tuple5[A: Read, B: Read, C: Read, D: Read, E: Read]     : Read[(A, B, C, D, E)] = new Read(r => (r[A], r[B], r[C], r[D], r[E]))
  }
  class Write[-A] {
    def apply(out: PrintWriter)(x: A): Unit = out.print(x)
  }
  trait DefaultWrite {
    implicit def any[A]: Write[A] = new Write[A]
  }
  object Write extends DefaultWrite {
    def apply[A](f: A => String) = new Write[A] {
      override def apply(out: PrintWriter)(x: A) = out.print(f(x))
    }
    implicit val boolean: Write[Boolean] = Write(b => if (b) "YES" else "NO")
    implicit def iterable[A](implicit write: Write[A]): Write[Traversable[A]] = new Write[Traversable[A]] {
      override def apply(out: PrintWriter)(xs: Traversable[A]) = {
        xs foreach write(out)
        out.println()
      }
    }
  }
}


object Main
{
	def cmp (s1 : Array[Char], s2 : Array[Char]) : Boolean =
	{
		for (i <- 0 until s1.size)
			if (s1(i) != s2(i)) return false
		return true
	}

	def add (s : String, a : Char) : String =
	{
		var s2 = new Array[Char](s.size+2)
		for (i <- 0 until s.size)
			s2(i) = s(i)
		s2(s.size) = a

		println("")
		print ("Ja izgradi nizata: ")
		for (i <- 0 until s2.size)
			print(s2(i))
		println("")

		s2.toString
	}

	def main (args : Array[String]) =
	{
		var str = scala.io.StdIn.readLine.toArray

		var arr = new Array[Array[Char]](12)
		for (i <- 0 to 9)
		{
			var s = scala.io.StdIn.readLine.toArray
			arr(i) = s
		}

		var i = 0
		while (i <= 70)
		{
			//println("vleguva tuka za i = " + i)
			var str2 = new Array[Char](12)
			for (j <- i until i+10)
				str2(j-i) = str(j)

			//for (j <- 0 until str2.size)
				//print(str2(j))
			//println("")

			var which = -1
			for (j <- 0 to 9)
				if (cmp(arr(j), str2))
				{
					which = j
				}
			print(which)
			i += 10
		}
	}
}


object Solution extends App {
  val in = scala.io.Source.stdin.getLines()
  var Array(m, s) = in.next().split(" ").map(_.toInt)
  if (s == 0 && m == 1)
    println("0 0")
  else if (9 * m < s || s == 0)
    println("-1 -1")
  else {
    val i = s / 9
    val left = s % 9
    val answer = Array.ofDim[Int](m)
    Range(0, i).foreach { j => answer(j) = 9}
    if (left > 0)
      answer(i) = left
    val answer2 = answer.reverse
    if (answer2(0) == 0) {
      answer2(0) = 1
      var j = 1
      while (j < answer2.length && answer2(j) == 0) j += 1
      answer2(j) = answer2(j) - 1
    }
    println(answer2.mkString + " " + answer.mkString)

  }

}


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

	override def apply(io: IO): io.type = {
		var n = io.read[Int]
		var t = io.read[Int]
		var k = io.read[Int]
		var d = io.read[Int]
		n = (n + k - 1) / k
		io.writeLine(if(d + t < t * n) {"YES"} else {"NO"})
	}
}
/****************************[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 = apply(new IO(System.in, System.out)).close()
}
/****************************[Scala Collection Utils]****************************************/
object Utils {
	import scala.collection.mutable

	type of[C[_], A] = scala.collection.generic.CanBuild[A, C[A]]

	def when[A](check: Boolean)(f: => A): Option[A] = if (check) Some(f) else None

	def repeat[U](n: Int)(f: => U): Unit = (1 to n).foreach(_ => f)

	implicit class GenericExtensions[A](a: A) {
		def partialMatch[B](f: PartialFunction[A, B]): Option[B] = f lift a
	}

	implicit class TraversableExtensions[A, C[X] <: Traversable[X]](t: C[A]) {
		def zipWith[B](f: A => B)(implicit b: C of (A, B)): C[(A, B)] = (t map {i => i -> f(i)}).to[C]

		def whenNonEmpty[B](f: t.type => B): Option[B] = when(t.nonEmpty)(f(t))  // e.g. grades.whenNonEmpty(_.max)

		def toMultiSet: Map[A, Int] = t.groupBy(identity).mapValues(_.size)
	}

	implicit class PairExtensions[A, B](p: (A, B)) {
		def key = p._1
		def value = p._2
		def toSeq(implicit ev: B =:= A): Seq[A] = Seq(p.key, ev(p.value))
	}

	implicit class PairsExtensions[A, B, C[X] <: Traversable[X]](t: C[(A, B)]) {
		def toMultiMap(implicit b: C of B): Map[A, C[B]] = t.groupBy(_.key).mapValues(_.map(_.value).to[C]).withDefaultValue(b().result())
	}

	implicit class MapExtensions[K, V, C[X, Y] <: Map[X, Y]](m: C[K, V]) {
		def toMutable: mutable.Map[K, V] = mutable.Map.empty[K, V] ++ m
	}

	implicit class SetExtensions[A, C[A] <: Set[A]](s: C[A]) {
		def notContains(x: A): Boolean = !(s contains x)
		def toMutable = mutable.Set.empty[A] ++ s
	}

	implicit class IterableExtensions[A, C[A] <: Seq[A]](s: C[A]) {
		def indicesWhere(f: A => Boolean): Seq[Int] = s.zipWithIndex.collect {case (a, i) if f(a) => i}
		def deleteAtIndex(i: Int, howMany: Int = 1) = s.patch(i, Nil, howMany)
		def insertAtIndex(i: Int, items: Seq[A]) = s.patch(i, items, 0)
		def findWithIndex(f: A => Boolean): Option[(A, Int)] = s.zipWithIndex find {case (a, _) => f(a)}
	}

	implicit class BooleanExtensions(x: Boolean) {
		def to[A](implicit n: Numeric[A]) = if(x) n.one else n.zero
		def toEnglish = if(x) "Yes" else "No"
	}

	def desc[A](implicit order: Ordering[A]): Ordering[A] = order.reverse  //e.g. students.sortBy(_.height)(desc)

	def map[K] = new {
		def to[V](default: => V): mutable.Map[K, V] = using(_ => default)
		def using[V](f: K => V): mutable.Map[K, V] = new mutable.HashMap[K, V]() {
			override def apply(key: K) = getOrElseUpdate(key, f(key))
		}
	}

	def newMultiMap[K, V] = map[K] to mutable.Set.empty[V]

	def memoize[A, B](f: A => B): A => B = map[A] using f
}
/***********************************[Scala I/O]*********************************************/
import java.io._, java.util.StringTokenizer
import scala.collection.generic.CanBuild

class IO(in: BufferedReader, out: BufferedWriter) extends Iterator[String] with AutoCloseable with Flushable {
	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: CanBuild[A, C[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 writeLines(obj: Traversable[Any]): this.type = writeAll(obj, separator = "\n")
	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 {
	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: CanBuild[A, C[A]]) : Read[C[A]]         = new Read(r => r.read[C, A](r.read[Int]))
		implicit val string                                                   : Read[String]       = new Read(_.next())
		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
			}
		}
	}
}


//package codeforces.contests._1433

object BoringApartments {
  def main(args: Array[String]): Unit = {
    for (_ <- 1 to io.StdIn.readInt()) {
      val n = io.StdIn.readInt()

      val digit = n % 10
      val size = n.toString.length

      println {
        ((digit - 1) max 0) * 10 + (1 to size).sum
      }
    }
  }
}


object Main extends App {
  var Array(n, m) = readLine.split(" ").map(_.toInt)

  def getResult(n: Int, m: Int) = {
    if (m == 0)
      1
    else if (m <= (n / 2)) {
      m
    } else {
      n - m
    }
  }

  println(getResult(n, m))
}


object Main {
  def main(args: Array[String]) {
    val Array(a, b) = readLine().split(" ").map(_.toInt)
    val r = Array(0, 0, 0)
    for(i <- 1 to 6) {
      if ((a - i).abs < (b - i).abs) r(0) += 1
      else if ((a - i).abs == (b - i).abs) r(1) += 1
      else r(2) += 1
    }
    println(r.mkString(" "))
  }
}


import scala.io.StdIn;

object TaskB extends App {

  def sumNumb(numb: Long) :Long = { // сумма цифр в числе
    if(numb == 0) 0
    else numb % 10 + sumNumb(numb / 10)
  }

  def digitInNumber(numb: Long): Long = { // кол-во цифр в числе
    if(numb == 0) 0
    else digitInNumber(numb / 10) + 1
  }

  def generateNumberFromDigit(digit: Long, amt_digit: Long):Long = { // сгенерировать число из цифр digit, длинной amt_digit
    if(amt_digit == 0) 0
    else generateNumberFromDigit(digit, amt_digit - 1) * 10 + digit
  }

  def generateNumberFrom9 = generateNumberFromDigit(9, _:Long)

  val numb = StdIn.readLong()
  val delta = generateNumberFrom9(digitInNumber(numb) - 1)

  println(sumNumb(delta) + sumNumb(numb - delta))
}


object A extends App {
  val n = scala.io.StdIn.readLine().toInt
  val a = scala.io.StdIn.readLine().toInt
  val b = scala.io.StdIn.readLine().toInt
  val c = scala.io.StdIn.readLine().toInt

  val d = a min b
  val e = d min c
  if (n == 1) println(0)
  else if (n == 2) println(d)
  else println(d + (n - 2) * e)
}


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(l, r) = readInts(2)

  var res = l
  var max = 1

  var x = 2
  while (x * x <= r) {
    val cnt = r / x - l / x + (if (l % x == 0) 1 else 0)
    if (cnt > max) {
      max = cnt
      res = x
    }
    x += 1
  }

  println(res)
}


object P1A {
  def main(args : Array[String]) {
    val a = readInt;
    val b = readInt;
    val c: Long = readInt;
    System.out.println((((a - 1) / c) + 1) * (((b - 1) / c) + 1));
  }

  ///********************************************************************
  ///                    for read integers
  ///
  def readInt : Int = {
    var result = 0
    var read = 0
    var sign = false

    do {
      read = System.in.read()
    } while (read != -1 && (read != '-' && read < '0' || read > '9'))

    if (read == -1) return Integer.MIN_VALUE;
    if (read == '-') { sign = true; read = System.in.read() }

    do {
      result = (result << 3) + (result << 1) + read - '0';
      read = System.in.read();
    } while (read != -1 && read >= '0' && read <= '9');
    if (read == 13) System.in.read(); // skip 10

    if (sign) -result else result
  }
}


import scala.io.StdIn

object p1 {
  def main(args: Array[String]): Unit = {
    val in = StdIn.readLine()

    val res = if (in.contains("ABC") || in.contains("ACB") || in.contains("BAC") || in.contains("BCA") || in.contains("CAB") || in.contains("CBA")) "Yes" else "No"

    println(res)
  }
}


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 = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N, W, B = ni()
    val A = na(N)
    var ok = true
    var ans = 0

    rep(N / 2) { i =>
      val j = N - 1 - i
      if (A(i) == A(j)) {
        if (A(i) == 2) {
          ans += min(W, B) * 2
        }
      } else if (Set(A(i), A(j)) == Set(0, 1)){
        ok = false
      } else {
        val a = (Set(A(i), A(j)) - 2).head
        if (a == 0) ans += W
        else ans += B
      }
    }
    if (N % 2 == 1) {
      if (A(N / 2) == 2) ans += min(B, W)
    }

    if (!ok) ans = -1
    out.println(ans)
  }

  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)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int): Array[Int] = map(n)(_ => ni())
  def nm(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  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
  }
}


object Main
{
  def main(args : Array[String])
  {
    val Array(w,h) = readLine split " " map (_.toInt)
    var c : BigInt = 0
    for(x <- 0 to w/2; y <- 0 to h/2)
    {
      val xx = (w-x) min x
      val yy = (h-y) min y
      var mn = 4
      val mx = x == w/2 && w%2==0
      val my = y == h/2 && h%2==0
      if (mx && my)
	mn = 1
      else if (mx || my)
	mn = 2
      c += mn*xx*yy
    }
    println(c)
  }
}


object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class 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 = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N, K = nl()
    val l = max(1, K - N)
    val r = min(K - 1, N)
    val len = r - l + 1
    val ans =
      if (2 * N - 1 < K) 0
      else if (len % 2 == 0) {
        len / 2
      } else {
        len / 2
      }

    out.println(ans)
  }

  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)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int): Array[Int] = map(n)(_ => ni())
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  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
  }

  def sumL(as: Array[Int]): Long = {
    var s = 0L
    rep(as.length)(i => s += as(i))
    s
  }
}


object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class 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 = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N = ni()
    val even = N.toLong * (N + 1) / 2 % 2 == 0
    if (even) out.println(0)
    else out.println(1)
  }

  def debug(as: Array[Boolean]): Unit = {
    System.err.println(as.map(x => if(x) "1" else "0").mkString)
  }

  def debug(as: Array[Int]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(as: Array[Long]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(s: String): Unit = {
    System.err.println(s)
  }

  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)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    REP(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    REP(n) { i =>
      REP(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  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, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }

  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}


import java.util._

object Main{
  def main(args: Array[String]) {
    val sc = new Scanner(System.in);
    val n = sc.nextInt();
    val x = sc.nextInt();
    val a = for (i <- 0 until n) yield sc.nextInt();

    val ret = 0.until(x).map(i => if (a.contains(i)) 0 else 1).sum + (if (a.contains(x)) 1 else 0)

    println(ret);
  }
}


import java.util.Scanner

object R273_InitialBet {
  def main(args:Array[String]) = {
    val in = new Scanner(System.in).nextLine().split(" ").map(_.toInt)
    if (in.sum % in.length == 0 && in.sum != 0) {
      println(in.sum / in.length)
    }
    else{
      println(-1)
    }
  }
}


object c402A {
    def main(args: Array[String]) {
        val l = Console.readLine().split(" ").map(i => Integer.parseInt(i))
        val max_sections = l(0)
        var nuts = l(1)
        var divisors = l(2)
        val section_capacity = l(3)
        var nsections = (nuts-1)/section_capacity + 1

        //Complete boxes
        //println("nsections:" + nsections)
        val complete_boxes = divisors/max_sections
        //println("complete_boxes:" + complete_boxes)
        var boxes = 0
        if (complete_boxes > 0) {
            boxes += math.min(nsections/max_sections, complete_boxes)
            divisors -= boxes*(max_sections - 1)
            nsections -= boxes*max_sections
        }
        //println("nsections 2:" + nsections)
        //Partial box
        if (nsections > 0 && divisors > 0) {
            boxes += 1
            nsections -= divisors + 1
        }
        //println("nsections 3:" + nsections)
        if (nsections > 0) boxes += nsections
        println(boxes)
    }
}


import java.util.Scanner

object Main {

   def main(args: Array[String]): Unit = {
       val scanner = new Scanner (System.in)
		 val a, b, c = scanner.nextInt()
		 val ans = (a * c + b - 1) / b - c
		 println (ans)
   }

}


object Main extends App {
  val in = readLine.toInt
  println(Range(1, 17).find(t => (in + t).toString.contains('8')).get)
}


object Solution extends App {
  val in = scala.io.Source.stdin.getLines()
  val n = in.next().toInt
  val data = in.next().split(" ").map(_.toInt)
  val sum = data.sum
  var left = if (n % sum == 0) n - sum * (n / sum - 1) else n % sum
  println(data.indices.find { i =>
    left -= data(i)
    left <= 0
  }.get + 1)
}


import scala.io.StdIn

object Main {
  def abs(x: BigInt): BigInt = {
    if(x >= 0) x
    else -x
  }

  def getStepsCount(x: BigInt, y: BigInt, destX: BigInt, destY: BigInt): BigInt = {
    abs(destX - x) >= abs(destY - y) match {
      case true => abs(destX - x)
      case false => abs(destY - y)
    }
  }

  def main(args: Array[String]): Unit = {
    val n = BigInt(StdIn.readLine())
    val input = StdIn.readLine().split(" ").map(BigInt(_))
    val (destX, destY) = (input(0), input(1))
    if(getStepsCount(1, 1, destX, destY) <= getStepsCount(n, n, destX, destY)) println("White")
    else println("Black")
  }
}


object CF_522_2_A {
  def solve(n: Int, k: Int, as: Seq[Int]): Int = {
    val counts = as.groupBy(identity).mapValues(_.size)
    val maxCount = counts.values.max
    val numSetsEach = Utility.intCeil(maxCount, k)
    val numUtensilsInSet = counts.size
    val totalUtensils = k * numSetsEach * numUtensilsInSet
    val numStolen = totalUtensils - n
    numStolen
  }

  def solution(i: Input) = solve(i.int, i.int, {i.nextLine; i.intSeq()})

//     ~~~ Boilerplate ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  val out = new java.io.PrintWriter(System.out)
  def main(args: Array[String]) = {
    val sol = solution(new Input(System.in))
    out.println(sol)
    out.close()
  }

//     ~~~ Utility methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  import java.util.Scanner
  class Input(sc: Scanner) {
    def this(i: java.io.InputStream) = this(new Scanner(i))
    def this(s: String) = this(new Scanner(s))
    def nextLine = sc.nextLine() // do this if still on previous line before collecting line of data
    def collect[T](f: String => T) = {sc.nextLine().split(" ").toVector.map(f)}
    def intSeq() = collect(_.toInt)
    def doubleSeq() = collect(_.toDouble)
    def int() = sc.nextInt()
    def long() = sc.nextLong()
    def double() = sc.nextDouble()
  }

  object Utility {
    def intCeil(a: Int, b: Int) = (a - 1) / b + 1
    def longCeil(a: Long, b: Long) = (a - 1) / b + 1
  }
}


import scala.io.Source

object Hello extends App {

  val v = Source.stdin.getLines().next().toLong

  val result = if (v == 0)
    1 else
    v % 4 match {
      case 1 => 8
      case 2 => 4
      case 3 => 2
      case _ => 6
    }
  print(result)
}


object Main {
    def main(args: Array[String]): Unit = {
        val n = readInt
        val (l, r) = readLine.toList.take(n).foldLeft((0, 0)){
            case ((l, r), 'L') => (l - 1, r)
            case ((l, r), 'R') => (l, r + 1)
        }
        println(r - l + 1)
    }
}


import scala.collection.mutable.ArrayBuffer
import scala.io.StdIn._
import scala.util.Sorting._
import scala.math._
import scala.collection._
import java.util._

object HelloWorld {

  def main(args: Array[String]) {

    val n: BigInt = BigInt(readLine.trim)
    print(if(n % 2 != 0) "-" else "")

    val even = (n/2)*((n/2)+1)
    val odd = n*(n+1)/2 - even
    val ans = odd - even

    println(ans.abs)
  }
}


import java.util.Scanner
object Cifera {

  val scanner = new Scanner(System.in)
  val a = scanner.nextInt()
  var b = scanner.nextInt();

  def main(args: Array[String]) {
    var i = 0
    while (b%a == 0) {
        b /= a
        i +=1
    }
    println(if (b==1) "YES" else "NO" )
    if (b==1){
      println(i-1)
    }
  }
}


object RepeatingCipher1095A//  extends TSolver {
                     extends App {
    import java.io.{InputStream, PrintStream}
    import java.util.Scanner
    solve(System.in,System.out)
    def solve(in: InputStream, out: PrintStream): Unit = {
        val scanner = new Scanner(in)
      val szT = scanner.nextInt
      val t = scanner.next
      val n: Int = Math.floor(Math.sqrt(szT*2.0)).toInt

      val result = (1 to n).map{ i =>
        //position of the i th element?
        val pos = (i*(i+1))/2 - 1

        t(pos).toString
      }.mkString
      out.println(result)
    }
}


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 n = readLine
  val s = readLine

  val res = new StringBuilder
  var prev = 'x'
  val isWovel = Set('a', 'e', 'i', 'o', 'u', 'y')

  for (c <- s) {
    if (!isWovel(prev) || !isWovel(c)) res += c
    prev = c
  }

  println(res.result())

  Console.flush
}


import java.util.StringTokenizer

object _513B extends App {
  var token = new StringTokenizer("")
  def next = {
    while (!token.hasMoreTokens()) token = new StringTokenizer(readLine)
    token.nextToken()
  }

  def calc(cand: Vector[Int], m: Long): Vector[Int] =
    if (cand.size == 1) cand
    else {
      val half = 1L << (cand.size - 2)
      if (m <= half) cand.head +: calc(cand.tail, m)
      else calc(cand.tail, m - half) :+ cand.head
    }
  val n = next.toInt
  val m = next.toLong
  println(calc((1 to n).toVector, m).mkString(" "))
}


object Main {
  def solution_exists(a: Int, b: Int, c: Int, d: Int): Boolean = {
    def gcd(a: Int, b: Int): Int = {
      if (b > 0) gcd(b, a % b)
      else a
    }
    val x = b % a
    val y = d % c
    val g = gcd(a, c)
    (x - y) % g == 0
  }
  def main(args: Array[String]) {
    var Array(a, b): Array[Int] = Console.in.readLine().split(" ").map(_.toInt)
    var Array(c, d): Array[Int] = Console.in.readLine().split(" ").map(_.toInt)
    if (solution_exists(a, b, c, d)) {
      var q = b
      while (q < d)
        q += a
      var t = d
      while (t < b)
        t += c
      var delta = c
      if (q > t) {
        t = q
        delta = a
      }
      while ((t - d) % c != 0 || (t - b) % a != 0)
        t += delta
      println(t)
    }
    else
      println(-1)
  }
}


import scala.io.Source

object a10 {
  def main(args: Array[String]): Unit = {
    val lines = Source.stdin.getLines().map(_.split(' ').map(_.toInt))toArray
    val k = lines(0)(1)
    val a = lines(1).sortWith((a,b)=>b<a).find(k % _ == 0).get
    println(k/a)
  }

}


object Main {
  def main(args: Array[String]) = {
    val n = readInt()
    val a = readLine().split(" ").map(_.toInt)
    val xy = readLine().split(" ").map(_.toInt)
    val x = xy(0)
    val y = xy(1)

    val sc = a.scanLeft(0)(_ + _)
    val f = sc.zipWithIndex.filter(_._1 >= x).filter(_._1 <= y)
    val sum = sc.last
    f.find(t => sum - t._1 >= x && sum - t._1 <= y) match {
      case None => println("0")
      case Some(t) => println(t._2 + 1)
    }
  }
}


import io.StdIn._

import scala.collection.mutable._

object Solution {

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

  def main(args: Array[String]) {
    val Array(n, m) = readInts(2)

    var l = 2
    var r = Int.MaxValue

    while (l <= r) {
      val mid = (l + r) / 2
      val a = mid / 2
      val b = mid / 3
      val x = mid / 6

      if (n <= a && m <= b && n + m <= a + b - x) r = mid - 1
      else l = mid + 1
    }

    println(l)

//    Console.withOut(new java.io.BufferedOutputStream(Console.out))
//    println(res.mkString("\n"))
//    Console.flush
  }
}


import scala.io.StdIn
object Main extends App {

  class Board(val data: Seq[String], lastMove: (Int, Int)) {

    val X: Char = 'x'
    val O: Char  = 'o'
    val Empty : Char = '.'
    val Available : Char  = '!'
    val Valid = Set(X, O, Empty)

    lazy val availableMoves: String = {
      val newBoard = if (subgame.map(tiles(_)).contains(Empty)) {
        tiles.zipWithIndex.map(t => {
          if (subgame.contains(t._2) && t._1 == Empty) Available
          else t._1
        })
      } else {
        tiles.map(t => if (t == Empty) Available else t)
      }
      newBoard.grouped(9).map(a => a.grouped(3).map(String.valueOf).mkString(" ")).grouped(3).map(_.mkString("\n")).mkString("\n\n")
    }

    lazy val tiles: Array[Char] = data.map(_.toCharArray.filter(Valid.contains)).filter(!_.isEmpty).flatten.toArray

    lazy val subgame: Set[Int] = {
      val gY = (lastMove._1 - 1) / 3
      val gX = (lastMove._2 - 1) / 3
      val pY = (lastMove._1 - 1) % 3
      val pX = (lastMove._2 - 1) % 3
      (for (
        x <- 0 to 2;
        y <- 0 to 2
      ) yield ((y + pY * 3) * 9) + pX * 3 + x).toSet[Int]
    }

  }
  val data = for (_ <- 1 to 11) yield StdIn.readLine()
  val coords = StdIn.readLine().split(" ").map(_.toInt)
  println(new Board(data, (coords.head, coords.tail.head)).availableMoves)
}


import scala.util.Sorting

object A347 {
  @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 main(args: Array[String]): Unit = {
    val Array(n) = readInts(1)
    val input = readInts(n).sortBy(-1*identity(_))

    println((Array(input(0)) ++ input.dropRight(1).drop(1).sortBy(identity) ++ Array(input(n-1))).mkString(" "))

  }
}


object B743 {

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

  def main(args: Array[String]): Unit = {
    val Array(n, k) = readLongs(2)

    println(find(n, k))
  }

  def find(n: Long, k: Long): Long = {
    val pow = math.pow(2, n-1).toLong
    if(k == math.pow(2, n-1)) {
      n
    } else if(k < math.pow(2, n-1)){
      find(n-1, k)
    } else {
      find(n-1, k-pow)
    }
  }

  object IO {
    private val input = new java.io.BufferedReader(new java.io.InputStreamReader(System.in))

    //    private val input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream("src/input")))
    @inline def read: String = input.readLine()

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

    def readInt: Int = tokenizeLine.nextToken.toInt

    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.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    val nk = StdIn.readLine().split(" ").map(item => item.toInt)
    val (n, k) = (nk(0), nk(1))
    val a = StdIn.readLine().split(" ").map(item => item.toInt)
    val b = a.distinct
    if (b.length < k) {
      println("NO")
    } else {
      println("YES")
      val c = (0 until k).map(i => a.indexOf(b(i)) + 1)
      c.foreach(item => print(item + " "))
    }
  }
}


import java.util.Scanner

object Main{
  def main (args: Array[String]){
    val sc = new Scanner(System.in)
    val n = sc.nextInt()

    var choko = new Array[Int](n)
    var flagz = true
    for(i <- 0 until n){
      val tmp = sc.nextInt()
      if(tmp == 1)
        flagz = false
      choko(i) = tmp
    }

    //
    if(flagz)
      println(0)
    else{
      var ind = -1
      var iii = 0

      while(ind == -1){
        if(choko(iii) == 1)
          ind = iii

        iii += 1
      }

      if(ind == n-1)
        println(1)
      else{
        var ans = 1L
        var zero = 0
        for(i <- ind+1 until n){
          choko(i) match{
            case 0 => zero += 1
            case 1 =>
              ans *= zero + 1
              zero = 0
            case _ => ()
          }
        }
        println(ans)
      }
    }
  }
}


object Solution extends App {
  val in = scala.io.Source.stdin.getLines()
  val n = in.next().toInt
  val str = in.next()
  val part1 = str.take(n).sorted
  val part2 = str.drop(n).sorted
  if (part1.zip(part2).forall(x => x._1 < x._2) || part1.zip(part2).forall(x => x._1 > x._2))
    println("YES")
  else
    println("NO")
}


import java.util.StringTokenizer

import scala.io.StdIn

object A extends App with Reader {
  read()
  val n = int()
  val k = (0 until 31).filter(i => n >= (1 << i)).last
  println(k+1)
}

trait Reader {
  var st: StringTokenizer = _
  def read() = { st = new StringTokenizer(StdIn.readLine()) }
  def int() = st.nextToken().toInt
  def long() = st.nextToken().toLong
}


object Solution extends App {
  val lines = io.Source.stdin.getLines()
  val n = lines.next().toInt
  val str = lines.next()
  val (curr, max, inside, _) = str.foldLeft((0, 0, 0, false)) {
    case ((currentLength, maxLength, inside, false), '_') => (0, Math.max(maxLength, currentLength), inside, false)
    case ((currentLength, maxLength, inside, true), '_') if currentLength > 0 => (0, maxLength, inside + 1, true)
    case ((currentLength, maxLength, inside, true), '_') => (0, maxLength, inside, true)
    case ((currentLength, maxLength, inside, false), '(') => (0, Math.max(maxLength, currentLength), inside, true)
    case ((currentLength, maxLength, inside, true), ')') if currentLength > 0 => (0, maxLength, inside + 1, false)
    case ((currentLength, maxLength, inside, true), ')') => (0, maxLength, inside, false)
    case ((currentLength, maxLength, inside, state), el) => (currentLength + 1, maxLength, inside, state)
  }
  println(s"${Math.max(max, curr)} $inside")
}