
object Main extends App {

  import scala.io.StdIn._
  val n = readLine.trim.toInt
  val Array(a, b) = readLine.trim.split(' ').map(_.toInt)
  val c = readLine.trim.toInt
  val toppings = Array.tabulate(n){_ ⇒ Topping(b, readLine.trim.toInt)}
  println(
    toppings.sortBy(-_.caloriePerPrice).foldLeft(Pizza(a, c)){case (pizza, topping) ⇒ if (pizza.caloriePerPrice > topping.caloriePerPrice) pizza else pizza.addTopping(topping)}.caloriePerPrice.toInt
  )
  case class Pizza(price: Int, calorie: Int){
    def caloriePerPrice:Double = calorie.toDouble / price
    def addTopping(topping: Topping): Pizza = Pizza(price + topping.price, calorie + topping.calorie)
  }
  case class Topping(price: Int, calorie: Int){
    def caloriePerPrice: Double = calorie.toDouble / price
  }
}

