import sys

input=sys.stdin.readline



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



A = []

for i in range(N):

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

    A.append([a,b])

A.sort()



x = 0

for a in A:

    if M == 0:

        break

    while a[1] > 0:

        a[1] -= 1

        M -= 1

        x += a[0]

        if M == 0:

            break

print(x)

import sys

input=sys.stdin.readline



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



A = []

for i in range(N):

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

    A.append((a,b))



A.sort()

ans = 0

for a,b in A:

    if M == 0:

        break

    n = M if M <= b else b

    M -= n

    ans += n * a

print(ans)

import sys

input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append([a, b])
A.sort()
x = 0
for a in A:
    if M == 0:
        break
    while a[1] > 0:
        a[1] -= 1
        M -= 1
        x += a[0]
        if M == 0:
            break
print(x)

import sys

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

-    A.append([a, b]) +    A.append((a, b)) -x = 0 -for a in A: +ans = 0 +for a, b in A: -    while a[1] > 0: -        a[1] -= 1 -        M -= 1 -        x += a[0] -        if M == 0: -            break -print(x) +    n = M if M <= b else b +    M -= n +    ans += n * a +print(ans)