
fun main(args:Array<String>):Unit {
    while(true){
        val (n, m) = readLine()!!.split(' ').map(String::toInt)
        if (n == 0 && m == 0) return
        val pair = Array(n){
            val (d, p) = readLine()!!.split(' ').map(String::toInt)
            Pair(d, p)
        }.sortedByDescending{it.second}.toTypedArray()
        var money = m
        loop@for (i in 0 until pair.size){
            if (money == 0) break@loop
            if (money > pair[i].first){
                money -= pair[i].first
                pair[i] = Pair(0, 0)
            }else{
                pair[i] = Pair(pair[i].first - money, pair[i].second)
                money = 0
            }
        }
        println(
                pair.sumBy { (d, p) -> d * p }
        )
    }
}
