n, m = list(map(int, input().split()))

ab = [tuple(map(int, input().split())) for _ in range(n)]

ab.sort()



ans = 0

for a, b in ab:

    buy = [m, b][0 <= m-b]

    m -= buy

    ans += a*buy

print(ans)

import sys

input = sys.stdin.readline

n, m = list(map(int, input().split()))

ab = [tuple(map(int, input().split())) for _ in range(n)]

ab.sort()

ans = 0

for a, b in ab:

    buy = [m, b][0 <= m-b]

    m -= buy

    ans += a*buy

print(ans)

n, m = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort()
ans = 0
for a, b in ab:
    buy = [m, b][0 <= m - b]
    m -= buy
    ans += a * buy
print(ans)

import sys

input = sys.stdin.readline
n, m = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort()
ans = 0
for a, b in ab:
    buy = [m, b][0 <= m - b]
    m -= buy
    ans += a * buy
print(ans)

+import sys + +input = sys.stdin.readline