local DBG = false
function dbgpr(...)
    if DBG then
        io.write("[dbg]")
        print(...)
    end
end

function dbgpr_t(tbl)
    if DBG then
        dbgpr(tbl)
        io.write("[dbg]")
        for i,v in ipairs(tbl) do
            io.write(i)
            io.write(":")
            io.write(tostring(v))
            io.write(" ")
        end
        print("")
    end
end

function dbgpr_t2d(tbl2d)
    if DBG then
        dbgpr(tbl2d)
        for i,t in ipairs(tbl2d) do
            io.write("[dbg]")
            for j,v in ipairs(t) do
                io.write("(" .. tostring(i) .. "," .. tostring(j) .. "): ")
                io.write(tostring(v))
                io.write("; ")
            end
            print("")
        end
    end
end
function create_tbl(a, initial)
    local tbl = {}
    for i=1,a do
        tbl[i] = initial
    end
    return tbl
end

function create_2d_tbl(a, b, initial)
    local tbl = {}
    for i=1,a do
        local t = {}
        for j=1,b do
            t[j] = initial
        end
        tbl[i] = t
    end
    return tbl
end

function parse_problem()
    local N, M = io.read("n", "n")
    local stores = {}
    for i=1,N do
        local a, b = io.read("n", "n")
        stores[i] = {a, b}
    end
    table.sort(stores, function (x, y) return x[1] < y[1] end)
    return N, M, stores
end

function main()
    local N, M, stores = parse_problem()
    dbgpr(N, M)
    dbgpr("====stores")
    dbgpr_t2d(stores)
    local remain = M
    local total_price = 0
    local idx = 1
    while remain > 0 do
        local unit_price, stock = stores[idx][1], stores[idx][2]
        local units = stock
        if remain - units < 0 then
            units = remain
        end
        total_price = total_price + unit_price * units
        remain = remain - units
        dbgpr(idx, remain)
        idx = idx + 1
    end
    print(total_price)
end

main()
