from operator import itemgetter

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

AB = []

sAB = []



s = 0

c = 0



for i in range(n):

    AB.append(list(map(int,input().split())))



sAB = sorted(AB,key=itemgetter(0))



for i,(a,b) in enumerate(sAB):

    if c + b < m:

        c += b

        s += a*b

    elif c + b >= m:

        for j in range(b):

            if c < m:

                c += 1

                s += a

            else:

                break



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

ab=[]

for i in range(n):

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

  ab.append((a,b))

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

ans=0

t=10**10

for a,b in ab:

  t=min(b,m)

  if t<=0:break

  m-=t

  ans+=a*t

print(ans)
from operator import itemgetter

n, m = list(map(int, input().split()))
AB = []
sAB = []
s = 0
c = 0
for i in range(n):
    AB.append(list(map(int, input().split())))
sAB = sorted(AB, key=itemgetter(0))
for i, (a, b) in enumerate(sAB):
    if c + b < m:
        c += b
        s += a * b
    elif c + b >= m:
        for j in range(b):
            if c < m:
                c += 1
                s += a
            else:
                break
print(s)

n, m = list(map(int, input().split()))
ab = []
for i in range(n):
    a, b = list(map(int, input().split()))
    ab.append((a, b))
ab.sort(key=lambda x: x[0])
ans = 0
t = 10**10
for a, b in ab:
    t = min(b, m)
    if t <= 0:
        break
    m -= t
    ans += a * t
print(ans)

-from operator import itemgetter - -AB = [] -sAB = [] -s = 0 -c = 0 +ab = [] -    AB.append(list(map(int, input().split()))) -sAB = sorted(AB, key=itemgetter(0)) -for i, (a, b) in enumerate(sAB): -    if c + b < m: -        c += b -        s += a * b -    elif c + b >= m: -        for j in range(b): -            if c < m: -                c += 1 -                s += a -            else: -                break -print(s) +    a, b = list(map(int, input().split())) +    ab.append((a, b)) +ab.sort(key=lambda x: x[0]) +ans = 0 +t = 10**10 +for a, b in ab: +    t = min(b, m) +    if t <= 0: +        break +    m -= t +    ans += a * t +print(ans)