import numpy as np

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

f = lambda:list(map(int, input().split()))

arr = np.zeros((n,2),'i8')

#print(arr)

Q = m

price = 0



for i in range(n):

  p, q = f()

  #print(p,q)

  arr[i] = (p,q)

arr = sorted(arr.tolist())

#print(arr)

while Q>0:

  for i in range(n):

    p = arr[i][0]

    q = arr[i][1]

    if q > Q:

      q = Q

      price += p*q

      #print(price)

      Q -= q

    else:

      price += p*q

      #print(price)

      Q -= q

  

print(price)
import sys

n, m,*l = list(map(int, sys.stdin.read().split()))

#print(n,m,l)

a = 0

for p, q in sorted(zip(l[::2],l[1::2])):

  a += p*min(q,m)

  m -= q

  if m <= 0:

    print(a)

    break
import numpy as np

n, m = list(map(int, input().split()))
f = lambda: list(map(int, input().split()))
arr = np.zeros((n, 2), "i8")
# print(arr)
Q = m
price = 0
for i in range(n):
    p, q = f()
    # print(p,q)
    arr[i] = (p, q)
arr = sorted(arr.tolist())
# print(arr)
while Q > 0:
    for i in range(n):
        p = arr[i][0]
        q = arr[i][1]
        if q > Q:
            q = Q
            price += p * q
            # print(price)
            Q -= q
        else:
            price += p * q
            # print(price)
            Q -= q
print(price)

import sys

n, m, *l = list(map(int, sys.stdin.read().split()))
# print(n,m,l)
a = 0
for p, q in sorted(zip(l[::2], l[1::2])):
    a += p * min(q, m)
    m -= q
    if m <= 0:
        print(a)
        break

-import numpy as np +import sys -n, m = list(map(int, input().split())) -f = lambda: list(map(int, input().split())) -arr = np.zeros((n, 2), "i8") -# print(arr) -Q = m -price = 0 -for i in range(n): -    p, q = f() -    # print(p,q) -    arr[i] = (p, q) -arr = sorted(arr.tolist()) -# print(arr) -while Q > 0: -    for i in range(n): -        p = arr[i][0] -        q = arr[i][1] -        if q > Q: -            q = Q -            price += p * q -            # print(price) -            Q -= q -        else: -            price += p * q -            # print(price) -            Q -= q -print(price) +n, m, *l = list(map(int, sys.stdin.read().split())) +# print(n,m,l) +a = 0 +for p, q in sorted(zip(l[::2], l[1::2])): +    a += p * min(q, m) +    m -= q +    if m <= 0: +        print(a) +        break