n,m=map(int,input().split())
ablist=[]
for i in range(n):
  ab=list(map(int,input().split()))
  ablist.append(ab)
ablistsort=sorted(ablist)
ans=0
ko=0
for i in range(n):
  ans+=ablistsort[i][0]*ablistsort[i][1]
  ko+=ablistsort[i][1]
  if ko>m:
      ans-=(ablistsort[i][0]*ablistsort[i][1])
      ko-=ablistsort[i][1]
      while ko<m:
        ans+=ablistsort[i][0]
        ko+=1
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m ablist=[] ablist [] for i in range(n):
  ab=list(map(int,input().split()))
  ablist.append(ab) i range(n) range n ab=list(map(int,input().split())) ab list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ablist.append(ab) ablist.append ablist append ab ablistsort=sorted(ablist) ablistsort sorted(ablist) sorted ablist ans=0 ans 0 ko=0 ko 0 for i in range(n):
  ans+=ablistsort[i][0]*ablistsort[i][1]
  ko+=ablistsort[i][1]
  if ko>m:
      ans-=(ablistsort[i][0]*ablistsort[i][1])
      ko-=ablistsort[i][1]
      while ko<m:
        ans+=ablistsort[i][0]
        ko+=1 i range(n) range n ans+=ablistsort[i][0]*ablistsort[i][1] ans ablistsort[i][0]*ablistsort[i][1] ablistsort[i][0] [i] ablistsort i 0 ablistsort[i][1] [i] ablistsort i 1 ko+=ablistsort[i][1] ko ablistsort[i][1] [i] ablistsort i 1 if ko>m:
      ans-=(ablistsort[i][0]*ablistsort[i][1])
      ko-=ablistsort[i][1]
      while ko<m:
        ans+=ablistsort[i][0]
        ko+=1 ko>m ko m ans-=(ablistsort[i][0]*ablistsort[i][1]) ans ablistsort[i][0]*ablistsort[i][1] ablistsort[i][0] [i] ablistsort i 0 ablistsort[i][1] [i] ablistsort i 1 ko-=ablistsort[i][1] ko ablistsort[i][1] [i] ablistsort i 1 while ko<m:
        ans+=ablistsort[i][0]
        ko+=1 ko<m ko m ans+=ablistsort[i][0] ans ablistsort[i][0] [i] ablistsort i 0 ko+=1 ko 1 print(ans) print ans ko=0 0 ko ko+=1 1 ko ablist=[] [] ablist ans+=ablistsort[i][0] ablistsort[i][0] ans ab=list(map(int,input().split())) list(map(int,input().split())) ab ans=0 0 ans ko-=ablistsort[i][1] ablistsort[i][1] ko n,m=map(int,input().split()) map(int,input().split()) n ans+=ablistsort[i][0]*ablistsort[i][1] ablistsort[i][0]*ablistsort[i][1] ans ans-=(ablistsort[i][0]*ablistsort[i][1]) ablistsort[i][0]*ablistsort[i][1] ans ko+=ablistsort[i][1] ablistsort[i][1] ko ablistsort=sorted(ablist) sorted(ablist) ablistsort m=map(int,input().split()) map(int,input().split()) m
n,m=map(int,input().split())
ablist=[]
for i in range(n):
  ab=list(map(int,input().split()))
  ablist.append(ab)
ablistsort=sorted(ablist)
ans=0
ko=0
for i in range(n):
  ans+=ablistsort[i][0]*ablistsort[i][1]
  ko+=ablistsort[i][1]
  if ko>m:
      ans-=(ablistsort[i][0]*ablistsort[i][1])
      ko-=ablistsort[i][1]
      while ko<m:
        ans+=ablistsort[i][0]
        ko+=1
print(ans)