L=list()
R=list()
T=0
N,M=map(int,input().split())
for i in range(N):
  A,B=map(int,input().split())
  L.append(A)
  R.append(B)
c = zip(L, R)
c=sorted(c)
L, R = zip(*c)
L=list(reversed(L))
R=list(reversed(R))
while True:
  c=L[-1]
  T+=c*min(M,R[-1])
  M-=min(M,R[-1])
  L.pop(-1)
  R.pop(-1)
  if M==0:
    break
print(T) L=list() L list() list R=list() R list() list T=0 T 0 N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M for i in range(N):
  A,B=map(int,input().split())
  L.append(A)
  R.append(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) L.append L append A R.append(B) R.append R append B c = zip(L, R) c zip(L, R) zip L R c=sorted(c) c sorted(c) sorted c L, R = zip(*c) L zip(*c) zip *c c R L=list(reversed(L)) L list(reversed(L)) list reversed(L) reversed L R=list(reversed(R)) R list(reversed(R)) list reversed(R) reversed R while True:
  c=L[-1]
  T+=c*min(M,R[-1])
  M-=min(M,R[-1])
  L.pop(-1)
  R.pop(-1)
  if M==0:
    break True c=L[-1] c L[-1] L -1 T+=c*min(M,R[-1]) T c*min(M,R[-1]) c min(M,R[-1]) min M R[-1] R -1 M-=min(M,R[-1]) M min(M,R[-1]) min M R[-1] R -1 L.pop(-1) L.pop L pop -1 R.pop(-1) R.pop R pop -1 if M==0:
    break M==0 M 0 break print(T) print T R = zip(*c) zip(*c) R c = zip(L, R) zip(L, R) c B=map(int,input().split()) map(int,input().split()) B c=sorted(c) sorted(c) c L, R = zip(*c) zip(*c) L T=0 0 T L=list(reversed(L)) list(reversed(L)) L R=list() list() R L=list() list() L R=list(reversed(R)) list(reversed(R)) R M-=min(M,R[-1]) min(M,R[-1]) M c=L[-1] L[-1] c 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 T+=c*min(M,R[-1]) c*min(M,R[-1]) T
L=list()
R=list()
T=0
N,M=map(int,input().split())
for i in range(N):
  A,B=map(int,input().split())
  L.append(A)
  R.append(B)
c = zip(L, R)
c=sorted(c)
L, R = zip(*c)
L=list(reversed(L))
R=list(reversed(R))
while True:
  c=L[-1]
  T+=c*min(M,R[-1])
  M-=min(M,R[-1])
  L.pop(-1)
  R.pop(-1)
  if M==0:
    break
print(T)