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

l = [0 for _ in range(n)]

for i in range(n):

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

l_sort = sorted(l)

ans = 0

drink = 0

for j in range(n):

    cnt_lim = l_sort[j][1]

    cnt = 0

    while cnt < cnt_lim:

        ans += l_sort[j][0]

        cnt += 1

        drink += 1

        if drink == m:

            print(ans)

            exit()
from collections import defaultdict, deque

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 6)

# MOD = 10 ** 9 + 7

# INF = float("inf")





def main():

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

    dd = defaultdict(int)

    for _ in range(n):

        a, b = list(map(int, input().split()))

        dd[a] += b

    dd_sort = sorted(list(dd.items()), key=lambda x: x[0])

    ans = 0

    r = m

    for cost, num in dd_sort:

        if r >= num:

            ans += cost * num

            r -= num

        else:

            ans += cost * r

            break

    print(ans)

if __name__ == '__main__':

    main()
n, m = list(map(int, input().split()))
l = [0 for _ in range(n)]
for i in range(n):
    l[i] = list(map(int, input().split()))
l_sort = sorted(l)
ans = 0
drink = 0
for j in range(n):
    cnt_lim = l_sort[j][1]
    cnt = 0
    while cnt < cnt_lim:
        ans += l_sort[j][0]
        cnt += 1
        drink += 1
        if drink == m:
            print(ans)
            exit()

from collections import defaultdict, deque
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# MOD = 10 ** 9 + 7
# INF = float("inf")
def main():
    n, m = list(map(int, input().split()))
    dd = defaultdict(int)
    for _ in range(n):
        a, b = list(map(int, input().split()))
        dd[a] += b
    dd_sort = sorted(list(dd.items()), key=lambda x: x[0])
    ans = 0
    r = m
    for cost, num in dd_sort:
        if r >= num:
            ans += cost * num
            r -= num
        else:
            ans += cost * r
            break
    print(ans)


if __name__ == "__main__":
    main()

-n, m = list(map(int, input().split())) -l = [0 for _ in range(n)] -for i in range(n): -    l[i] = list(map(int, input().split())) -l_sort = sorted(l) -ans = 0 -drink = 0 -for j in range(n): -    cnt_lim = l_sort[j][1] -    cnt = 0 -    while cnt < cnt_lim: -        ans += l_sort[j][0] -        cnt += 1 -        drink += 1 -        if drink == m: -            print(ans) -            exit() +from collections import defaultdict, deque +import sys + +input = sys.stdin.readline +sys.setrecursionlimit(10**6) +# MOD = 10 ** 9 + 7 +# INF = float("inf") +def main(): +    n, m = list(map(int, input().split())) +    dd = defaultdict(int) +    for _ in range(n): +        a, b = list(map(int, input().split())) +        dd[a] += b +    dd_sort = sorted(list(dd.items()), key=lambda x: x[0]) +    ans = 0 +    r = m +    for cost, num in dd_sort: +        if r >= num: +            ans += cost * num +            r -= num +        else: +            ans += cost * r +            break +    print(ans) + + +if __name__ == "__main__": +    main()