fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toInt)
    val shops = (1..n).map {
        val (a, b) = readLine()!!.split(' ').map(String::toInt)
        a to b
    }.sortedBy { shop -> shop.first }
    var amt = 0L
    var qty = 0
    for (shop in shops) {
        val q = Math.min(m - qty, shop.second)
        amt += shop.first.toLong() * q
        qty += q
        if (qty == m) break
    }
    println(amt)
}
