import java.util.*

fun main(args: Array<String>) {
    val s = Scanner(System.`in`)
    val n = s.nextInt()
    val m = s.nextLong()

    val ab = Array(n) { s.nextLong() to s.nextLong() }

    val ret = ab
        .sortedBy { p -> p.first }
        .fold(0L to m) { acc, p ->
            val buy = Math.max(Math.min(acc.second, p.second), 0)
            acc.first + p.first * buy to acc.second - buy
        }
        .first

    println(ret)
}