import scala.io.StdIn.readLine import scala.collection.mutable.PriorityQueue import scala.annotation.tailrec // PriorityQueue[Long]()(scala.math.Ordering.Long.reverse) package net.pushl { package number { // Prime (Prime.scala) // Number (Number.scala) } package string { // RollingHash (RollingHash.scala) } object EnRich { implicit class AString(val self : String) extends AnyVal { def splitToIntArray = self.split(" ").map(_.toInt) } } } object Main { def main(args : Array[String]) : Unit = { var lower = 0 // lower < x // var upper = 100 // x <= upper var upper = 1000000010 // x <= upper for(i <- 0 to 80){ val mid = (lower+upper)/2 println("?" + mid) Console.flush() val mid_is_greater_than_or_equal_to_x = readLine() == "1" if(mid_is_greater_than_or_equal_to_x){ lower = mid }else{ upper = mid } } println("!" + lower) Console.flush() } }