fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map(String::toInt)
    val AB = Array(N) { readLine()!!.split(" ").map(String::toInt).let { it[0] to it[1] } }
    AB.sortBy { it.first }
    var sum = 0
    var result = 0L
    for (ab in AB) {
        for (i in 1..ab.second) {
            sum++
            result += ab.first
            if (sum == M) {
                println(result)
                return
            }
        }
    }
}

