N,M = map(int,input().split())
AB = []
money = 0
drinks = 0

for i in range(N):
  A,B = map(int,input().split())
  AB.append([A,B])

AB.sort()

for i in range(N):
  if 0 < M-drinks < AB[i][1]:
    money += (M-drinks)*AB[i][0]
    break
  elif AB[i][1] <= M-drinks:
    money += AB[i][1]*AB[i][0]
    drinks += AB[i][1]
  else:
    break
    
print(money) N,M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M AB = [] AB [] money = 0 money 0 drinks = 0 drinks 0 for i in range(N):
  A,B = map(int,input().split())
  AB.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 AB.append([A,B]) AB.append AB append [A,B] A B AB.sort() AB.sort AB sort for i in range(N):
  if 0 < M-drinks < AB[i][1]:
    money += (M-drinks)*AB[i][0]
    break
  elif AB[i][1] <= M-drinks:
    money += AB[i][1]*AB[i][0]
    drinks += AB[i][1]
  else:
    break
     i range(N) range N if 0 < M-drinks < AB[i][1]:
    money += (M-drinks)*AB[i][0]
    break
  elif AB[i][1] <= M-drinks:
    money += AB[i][1]*AB[i][0]
    drinks += AB[i][1]
  else:
    break
     0 < M-drinks < AB[i][1] 0 < M-drinks 0 M-drinks M drinks AB[i][1] [i] AB i 1 money += (M-drinks)*AB[i][0] money (M-drinks)*AB[i][0] M-drinks M drinks AB[i][0] [i] AB i 0 break elif AB[i][1] <= M-drinks:
    money += AB[i][1]*AB[i][0]
    drinks += AB[i][1]
   AB[i][1] <= M-drinks AB[i][1] [i] AB i 1 M-drinks M drinks money += AB[i][1]*AB[i][0] money AB[i][1]*AB[i][0] AB[i][1] [i] AB i 1 AB[i][0] [i] AB i 0 drinks += AB[i][1] drinks AB[i][1] [i] AB i 1 break print(money) print money drinks = 0 0 drinks money += (M-drinks)*AB[i][0] (M-drinks)*AB[i][0] money AB = [] [] AB B = map(int,input().split()) map(int,input().split()) B M = map(int,input().split()) map(int,input().split()) M drinks += AB[i][1] AB[i][1] drinks N,M = map(int,input().split()) map(int,input().split()) N money = 0 0 money money += AB[i][1]*AB[i][0] AB[i][1]*AB[i][0] money A,B = map(int,input().split()) map(int,input().split()) A
N,M = map(int,input().split())
AB = []
money = 0
drinks = 0

for i in range(N):
  A,B = map(int,input().split())
  AB.append([A,B])

AB.sort()

for i in range(N):
  if 0 < M-drinks < AB[i][1]:
    money += (M-drinks)*AB[i][0]
    break
  elif AB[i][1] <= M-drinks:
    money += AB[i][1]*AB[i][0]
    drinks += AB[i][1]
  else:
    break
    
print(money)