import numpy as np

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

A = np.empty(N,dtype=np.int64)

B = np.empty(N,dtype=np.int64)

for i in range(N):

    A[i],B[i] = list(map(np.int64, input().split()))



order = A.argsort()

A = A[order]

B = B[order]

Y = 0

for i in range(N):

    if B[i] >= M:

        Y += A[i]*M

        break

    else:

        Y += A[i]*B[i]

        M -= B[i]



print(Y)
inpl = lambda: list(map(int,input().split()))

N,M = inpl()

A = []

for i in range(N):

    A.append(inpl())



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

Y = 0

for i in range(N):

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

        Y += A[i][0]*M

        break

    else:

        Y += A[i][0]*A[i][1]

        M -= A[i][1]



print(Y)
import numpy as np

N, M = list(map(int, input().split()))
A = np.empty(N, dtype=np.int64)
B = np.empty(N, dtype=np.int64)
for i in range(N):
    A[i], B[i] = list(map(np.int64, input().split()))
order = A.argsort()
A = A[order]
B = B[order]
Y = 0
for i in range(N):
    if B[i] >= M:
        Y += A[i] * M
        break
    else:
        Y += A[i] * B[i]
        M -= B[i]
print(Y)

inpl = lambda: list(map(int, input().split()))
N, M = inpl()
A = []
for i in range(N):
    A.append(inpl())
A.sort(key=lambda x: x[0])
Y = 0
for i in range(N):
    if A[i][1] >= M:
        Y += A[i][0] * M
        break
    else:
        Y += A[i][0] * A[i][1]
        M -= A[i][1]
print(Y)

-import numpy as np - -N, M = list(map(int, input().split())) -A = np.empty(N, dtype=np.int64) -B = np.empty(N, dtype=np.int64) +inpl = lambda: list(map(int, input().split())) +N, M = inpl() +A = [] -    A[i], B[i] = list(map(np.int64, input().split())) -order = A.argsort() -A = A[order] -B = B[order] +    A.append(inpl()) +A.sort(key=lambda x: x[0]) -    if B[i] >= M: -        Y += A[i] * M +    if A[i][1] >= M: +        Y += A[i][0] * M -        Y += A[i] * B[i] -        M -= B[i] +        Y += A[i][0] * A[i][1] +        M -= A[i][1]