fun main(args: Array<String>) {
    val (n,m) = readLine()!!.split(" ").map { s -> s.toInt() }
    val ab=Array(n){ readLine()!!.split(" ").map { s -> s.toLong() }}.sortedBy { v->v[0] }
    var count = 0
    var price:Long=0
    for (i in 0 until n){
        if(ab[i][1]<m-count){
            count+=ab[i][1].toInt()
            price+=ab[i][1]*ab[i][0]
        }else{
            price+=(m-count)*ab[i][0]
            break
        }
    }
    println(price)
}