from operator import itemgetter



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

ab = [list(map(int, input().split())) for i in range(n)]

ab.sort()

#print(ab)

i = 0

ans = 0

while m >0:

  if ab[i][1]<=m:

    m -= ab[i][1]

    ans += ab[i][0]*ab[i][1]

  else:

    ans += ab[i][0]*m

    m = 0

  i+=1

print(ans)
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()

ans=0

t=m

for i in range(n):

  if ab[i][1]<t:

    ans+=ab[i][0]*ab[i][1]

    t-=ab[i][1]

  else:

    ans+=ab[i][0]*t

    print(ans)

    exit()
from operator import itemgetter

n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort()
# print(ab)
i = 0
ans = 0
while m > 0:
    if ab[i][1] <= m:
        m -= ab[i][1]
        ans += ab[i][0] * ab[i][1]
    else:
        ans += ab[i][0] * m
        m = 0
    i += 1
print(ans)

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()
ans = 0
t = m
for i in range(n):
    if ab[i][1] < t:
        ans += ab[i][0] * ab[i][1]
        t -= ab[i][1]
    else:
        ans += ab[i][0] * t
        print(ans)
        exit()

-from operator import itemgetter - -ab = [list(map(int, input().split())) for i in range(n)] +ab = [] +for i in range(n): +    a, b = list(map(int, input().split())) +    ab.append([a, b]) -# print(ab) -i = 0 -while m > 0: -    if ab[i][1] <= m: -        m -= ab[i][1] +t = m +for i in range(n): +    if ab[i][1] < t: +        t -= ab[i][1] -        ans += ab[i][0] * m -        m = 0 -    i += 1 -print(ans) +        ans += ab[i][0] * t +        print(ans) +        exit()