# -*- coding: utf-8 -*-

def inpl(): return list(map(int, input().split()))



N, M = inpl()

X = sorted([inpl() for _ in range(N)], key=lambda x: x[0])



ans = 0

for a, b in X:

    cnt = min(M, b)

    ans += a*cnt

    M -= cnt



print(ans)
def inpl(): return list(map(int, input().split()))

N, M = inpl()

X = sorted([inpl() for _ in range(N)], key=lambda x: -x[0])

ans = 0

while M:

    a, b = X.pop()

    buy = min(M, b)

    ans += a*buy

    M -= buy

print(ans)
# -*- coding: utf-8 -*-
def inpl():
    return list(map(int, input().split()))


N, M = inpl()
X = sorted([inpl() for _ in range(N)], key=lambda x: x[0])
ans = 0
for a, b in X:
    cnt = min(M, b)
    ans += a * cnt
    M -= cnt
print(ans)

def inpl():
    return list(map(int, input().split()))


N, M = inpl()
X = sorted([inpl() for _ in range(N)], key=lambda x: -x[0])
ans = 0
while M:
    a, b = X.pop()
    buy = min(M, b)
    ans += a * buy
    M -= buy
print(ans)

-# -*- coding: utf-8 -*- -X = sorted([inpl() for _ in range(N)], key=lambda x: x[0]) +X = sorted([inpl() for _ in range(N)], key=lambda x: -x[0]) -for a, b in X: -    cnt = min(M, b) -    ans += a * cnt -    M -= cnt +while M: +    a, b = X.pop() +    buy = min(M, b) +    ans += a * buy +    M -= buy