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

ll = sorted([list(map(int,input().split())) for _ in range(n)])

ans = 0

for p, c in ll:

  ans += p*min(m,c)

  m -= c

  if m < 1:

    break

print(ans)
import sys

input = sys.stdin.readline

f = lambda : list(map(int,input().split()))

n,m = f()

ll = sorted([list(f()) for _ in range(n)])



ans = 0

for p, c in ll:

  ans += p*min(m,c)

  m -= c

  if m < 1:

    break



print(ans)
n, m = list(map(int, input().split()))
ll = sorted([list(map(int, input().split())) for _ in range(n)])
ans = 0
for p, c in ll:
    ans += p * min(m, c)
    m -= c
    if m < 1:
        break
print(ans)

import sys

input = sys.stdin.readline
f = lambda: list(map(int, input().split()))
n, m = f()
ll = sorted([list(f()) for _ in range(n)])
ans = 0
for p, c in ll:
    ans += p * min(m, c)
    m -= c
    if m < 1:
        break
print(ans)

-n, m = list(map(int, input().split())) -ll = sorted([list(map(int, input().split())) for _ in range(n)]) +import sys + +input = sys.stdin.readline +f = lambda: list(map(int, input().split())) +n, m = f() +ll = sorted([list(f()) for _ in range(n)])