from heapq import heappush,heappop
n,m=map(int,input().split())
d=[]
for i in range(n):
  a,b=map(int,input().split())
  heappush(d,(a,b))
ans=0
while d:
  a,b=heappop(d)
  if m>b:
    ans+=a*b
    m-=b
  else:
    ans+=a*m
    break
print(ans) from heapq import heappush,heappop n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m d=[] d [] for i in range(n):
  a,b=map(int,input().split())
  heappush(d,(a,b)) i range(n) range n a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b heappush(d,(a,b)) heappush d (a,b) a b ans=0 ans 0 while d:
  a,b=heappop(d)
  if m>b:
    ans+=a*b
    m-=b
  else:
    ans+=a*m
    break d a,b=heappop(d) a heappop(d) heappop d b if m>b:
    ans+=a*b
    m-=b
  else:
    ans+=a*m
    break m>b m b ans+=a*b ans a*b a b m-=b m b ans+=a*m ans a*m a m break print(ans) print ans d=[] [] d b=map(int,input().split()) map(int,input().split()) b b=heappop(d) heappop(d) b ans=0 0 ans ans+=a*m a*m ans ans+=a*b a*b ans n,m=map(int,input().split()) map(int,input().split()) n a,b=map(int,input().split()) map(int,input().split()) a m=map(int,input().split()) map(int,input().split()) m a,b=heappop(d) heappop(d) a m-=b b m
from heapq import heappush,heappop
n,m=map(int,input().split())
d=[]
for i in range(n):
  a,b=map(int,input().split())
  heappush(d,(a,b))
ans=0
while d:
  a,b=heappop(d)
  if m>b:
    ans+=a*b
    m-=b
  else:
    ans+=a*m
    break
print(ans)