N, M=map(int, input().split())
info=[]
for _ in range(N):
  a, b=map(int, input().split())
  info.append([a,b])

info.sort(key=lambda x:x[0])
ans=0
for a, b in info:
  if M>=b:
    ans+=a*b
    M-=b
  elif M<b and M>0:
    ans+=a*M
    break
  else:
    break
print(ans) N, M=map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M info=[] info [] for _ in range(N):
  a, b=map(int, input().split())
  info.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 info.append([a,b]) info.append info append [a,b] a b info.sort(key=lambda x:x[0]) info.sort info sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x ans=0 ans 0 for a, b in info:
  if M>=b:
    ans+=a*b
    M-=b
  elif M<b and M>0:
    ans+=a*M
    break
  else:
    break a b info if M>=b:
    ans+=a*b
    M-=b
  elif M<b and M>0:
    ans+=a*M
    break
  else:
    break M>=b M b ans+=a*b ans a*b a b M-=b M b elif M<b and M>0:
    ans+=a*M
    break
   M<b and M>0 M<b M b M>0 M 0 ans+=a*M ans a*M a M break break print(ans) print ans ans+=a*M a*M ans M=map(int, input().split()) map(int, input().split()) M ans+=a*b a*b ans N, M=map(int, input().split()) map(int, input().split()) N a, b=map(int, input().split()) map(int, input().split()) a ans=0 0 ans M-=b b M info=[] [] info b=map(int, input().split()) map(int, input().split()) b
N, M=map(int, input().split())
info=[]
for _ in range(N):
  a, b=map(int, input().split())
  info.append([a,b])

info.sort(key=lambda x:x[0])
ans=0
for a, b in info:
  if M>=b:
    ans+=a*b
    M-=b
  elif M<b and M>0:
    ans+=a*M
    break
  else:
    break
print(ans)