n,m=map(int,input().split())
l=[]
for _ in range(n):
  a,b=map(int,input().split())
  l.append([a,b])
l.sort()
ans=0
for a,b in l:
  ans+=min(b,m)*a
  m=max(0,m-b)
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m l=[] l [] for _ in range(n):
  a,b=map(int,input().split())
  l.append([a,b]) _ range(n) range n a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b l.append([a,b]) l.append l append [a,b] a b l.sort() l.sort l sort ans=0 ans 0 for a,b in l:
  ans+=min(b,m)*a
  m=max(0,m-b) a b l ans+=min(b,m)*a ans min(b,m)*a min(b,m) min b m a m=max(0,m-b) m max(0,m-b) max 0 m-b m b print(ans) print ans b=map(int,input().split()) map(int,input().split()) b ans=0 0 ans m=max(0,m-b) max(0,m-b) m a,b=map(int,input().split()) map(int,input().split()) a l=[] [] l m=map(int,input().split()) map(int,input().split()) m ans+=min(b,m)*a min(b,m)*a ans n,m=map(int,input().split()) map(int,input().split()) n
n,m=map(int,input().split())
l=[]
for _ in range(n):
  a,b=map(int,input().split())
  l.append([a,b])
l.sort()
ans=0
for a,b in l:
  ans+=min(b,m)*a
  m=max(0,m-b)
print(ans)