
fun main(args : Array<String>) {
    val (N, M) = readLine()!!.split(" ").map { it.toInt() }
    val pairAandB = mutableListOf<Pair<Int, Int>>()

    (1..N).forEach {
        val (a, b) = readLine()!!.split(" ").map { it.toInt() }
        pairAandB.add(Pair(a,b))
    }

    pairAandB.sortBy { it.first }

    var totalCost = 0L
    var count = 0L

    pairAandB.forEach {
        var cost = it.first
        var remainder = it.second
        while(remainder > 0) {
            totalCost += cost
            remainder--
            count++
            if (count == M.toLong()) {
                println(totalCost)
                return
            }
        }
    }
    println(totalCost)
}

