N, M = list(map(int, input().split()))

AB = [0] * N

for i in range(N):

    AB[i] = list(map(int, input().split()))



AB = sorted(AB)

cnt = 0

ans = 0



for e in AB:

    if cnt + e[1] < M:

        ans += e[0] * e[1]

        cnt += e[1]

    else:

        ans += e[0] * (M - cnt) 

        break



print(ans)
import sys



N, M = list(map(int, sys.stdin.readline().split()))

AB = [None] * N

for i in range(N):

    AB[i] = list(map(int, sys.stdin.readline().split()))



AB.sort()

cnt = 0

ans = 0



for a,b in AB:

    if cnt + b < M:

        ans += a * b

        cnt += b

    else:

        ans += a * (M - cnt) 

        break



print(ans)
N, M = list(map(int, input().split()))
AB = [0] * N
for i in range(N):
    AB[i] = list(map(int, input().split()))
AB = sorted(AB)
cnt = 0
ans = 0
for e in AB:
    if cnt + e[1] < M:
        ans += e[0] * e[1]
        cnt += e[1]
    else:
        ans += e[0] * (M - cnt)
        break
print(ans)

import sys

N, M = list(map(int, sys.stdin.readline().split()))
AB = [None] * N
for i in range(N):
    AB[i] = list(map(int, sys.stdin.readline().split()))
AB.sort()
cnt = 0
ans = 0
for a, b in AB:
    if cnt + b < M:
        ans += a * b
        cnt += b
    else:
        ans += a * (M - cnt)
        break
print(ans)

-N, M = list(map(int, input().split())) -AB = [0] * N +import sys + +N, M = list(map(int, sys.stdin.readline().split())) +AB = [None] * N -    AB[i] = list(map(int, input().split())) -AB = sorted(AB) +    AB[i] = list(map(int, sys.stdin.readline().split())) +AB.sort() -for e in AB: -    if cnt + e[1] < M: -        ans += e[0] * e[1] -        cnt += e[1] +for a, b in AB: +    if cnt + b < M: +        ans += a * b +        cnt += b -        ans += e[0] * (M - cnt) +        ans += a * (M - cnt)