import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto tmp = readln.split.to!(long[]);
    const N = tmp[0], M = tmp[1];
    struct Data { long price; long limit; }
    auto dataList = new Data[N];
    foreach (i; 0..N) {
        tmp = readln.split.to!(long[]);
        const A = tmp[0], B = tmp[1];
        dataList[i] = Data(A, B);
    }
    dataList
        .sort!((a,b) => a.price < b.price)
        .map!(d => d.price.repeat(d.limit).array)
        .join
        .take(M)
        .sum
        .writeln;
}

