N,M=map(int,input().split())
C=[]
ans=0
cnt=0
for i in range(N):
  a,b=map(int,input().split())
  C.append((a,b))
C=sorted(C)
for i in range(N):
  if cnt+C[i][1]<=M:
    cnt+=C[i][1]
    ans+=C[i][1]*C[i][0]
  else:
    break
print((M-cnt)*C[i][0]+ans) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M C=[] C [] ans=0 ans 0 cnt=0 cnt 0 for i in range(N):
  a,b=map(int,input().split())
  C.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 C.append((a,b)) C.append C append (a,b) a b C=sorted(C) C sorted(C) sorted C for i in range(N):
  if cnt+C[i][1]<=M:
    cnt+=C[i][1]
    ans+=C[i][1]*C[i][0]
  else:
    break i range(N) range N if cnt+C[i][1]<=M:
    cnt+=C[i][1]
    ans+=C[i][1]*C[i][0]
  else:
    break cnt+C[i][1]<=M cnt+C[i][1] cnt C[i][1] [i] C i 1 M cnt+=C[i][1] cnt C[i][1] [i] C i 1 ans+=C[i][1]*C[i][0] ans C[i][1]*C[i][0] C[i][1] [i] C i 1 C[i][0] [i] C i 0 break print((M-cnt)*C[i][0]+ans) print (M-cnt)*C[i][0]+ans (M-cnt)*C[i][0] M-cnt M cnt C[i][0] [i] C i 0 ans ans=0 0 ans cnt=0 0 cnt N,M=map(int,input().split()) map(int,input().split()) N ans+=C[i][1]*C[i][0] C[i][1]*C[i][0] ans cnt+=C[i][1] C[i][1] cnt M=map(int,input().split()) map(int,input().split()) M C=sorted(C) sorted(C) C a,b=map(int,input().split()) map(int,input().split()) a b=map(int,input().split()) map(int,input().split()) b C=[] [] C
N,M=map(int,input().split())
C=[]
ans=0
cnt=0
for i in range(N):
  a,b=map(int,input().split())
  C.append((a,b))
C=sorted(C)
for i in range(N):
  if cnt+C[i][1]<=M:
    cnt+=C[i][1]
    ans+=C[i][1]*C[i][0]
  else:
    break
print((M-cnt)*C[i][0]+ans)