import sys



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

lst = []

for i in range(N):

    lst += [list(map(int, input().split()))]

lst.sort()    

#print (lst)

count = M

yen = 0



for i in range(N):

    yen += lst[i][0] * min(count, lst[i][1])  

    count -= min(count, lst[i][1])

#    print (count)

    if count <= 0:

        print (yen)

        sys.exit()
import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 9)

MOD = 10 ** 9 + 7



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

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

AB.sort(key = lambda x: x[0])



ans = 0

for i in range(N):

    if AB[i][1] >= M:

        ans += AB[i][0] * M

        print (ans)

        break

    ans += AB[i][0] * AB[i][1]

    M -= AB[i][1]
import sys

N, M = list(map(int, input().split()))
lst = []
for i in range(N):
    lst += [list(map(int, input().split()))]
lst.sort()
# print (lst)
count = M
yen = 0
for i in range(N):
    yen += lst[i][0] * min(count, lst[i][1])
    count -= min(count, lst[i][1])
    #    print (count)
    if count <= 0:
        print(yen)
        sys.exit()

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
N, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[0])
ans = 0
for i in range(N):
    if AB[i][1] >= M:
        ans += AB[i][0] * M
        print(ans)
        break
    ans += AB[i][0] * AB[i][1]
    M -= AB[i][1]

+input = sys.stdin.readline +sys.setrecursionlimit(10**9) +MOD = 10**9 + 7 -lst = [] +AB = [tuple(map(int, input().split())) for _ in range(N)] +AB.sort(key=lambda x: x[0]) +ans = 0 -    lst += [list(map(int, input().split()))] -lst.sort() -# print (lst) -count = M -yen = 0 -for i in range(N): -    yen += lst[i][0] * min(count, lst[i][1]) -    count -= min(count, lst[i][1]) -    #    print (count) -    if count <= 0: -        print(yen) -        sys.exit() +    if AB[i][1] >= M: +        ans += AB[i][0] * M +        print(ans) +        break +    ans += AB[i][0] * AB[i][1] +    M -= AB[i][1]