n,m=map(int,input().split())
l=[]

for i in range(n):
  a,b=map(int,input().split())
  l.append([a,b])

l.sort()
c=0
for a,b in l:
  c+=min(b,m)*a
  m=max(m-b,0)

print(c) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m l=[] l [] for i in range(n):
  a,b=map(int,input().split())
  l.append([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 l.append([a,b]) l.append l append [a,b] a b l.sort() l.sort l sort c=0 c 0 for a,b in l:
  c+=min(b,m)*a
  m=max(m-b,0) a b l c+=min(b,m)*a c min(b,m)*a min(b,m) min b m a m=max(m-b,0) m max(m-b,0) max m-b m b 0 print(c) print c l=[] [] l c=0 0 c m=max(m-b,0) max(m-b,0) m b=map(int,input().split()) map(int,input().split()) b m=map(int,input().split()) map(int,input().split()) m n,m=map(int,input().split()) map(int,input().split()) n a,b=map(int,input().split()) map(int,input().split()) a c+=min(b,m)*a min(b,m)*a c
n,m=map(int,input().split())
l=[]

for i in range(n):
  a,b=map(int,input().split())
  l.append([a,b])

l.sort()
c=0
for a,b in l:
  c+=min(b,m)*a
  m=max(m-b,0)

print(c)