fun main(args: Array<String>) {
    var (x, y) = readLine()!!.split(" ").map { it.toInt() }
    var l = (0 until x).map{ readLine()!!.split(" ").map { it.toInt()}.toMutableList()}.sortedBy{it[0]}.toMutableList()
    var sum = 0L
    var store = 0
    while (y != 0){
        if (l[store][1] != 0){
            y -= 1
            sum += l[store][0]
            l[store][1] -= 1
        }
        else store += 1
    }
    println(sum)
}