n, m = map(int, input().split())
l = [list(map(int,input().split())) for i in range(n)]

l.sort()

drink = 0
shop = 0
money = 0
while drink < m:
  if l[shop][1] == 0:
    shop += 1
  else:
    drink += 1
    money += l[shop][0]
    l[shop][1] -= 1
"""    
    print("shop:",shop)
    print("drink:",drink)
    print("money:",money)
"""
print(money) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m list(map(int,input().split())) for i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split l = [list(map(int,input().split())) for i in range(n)] l [list(map(int,input().split())) for i in range(n)] l.sort() l.sort l sort drink = 0 drink 0 shop = 0 shop 0 money = 0 money 0 while drink < m:
  if l[shop][1] == 0:
    shop += 1
  else:
    drink += 1
    money += l[shop][0]
    l[shop][1] -= 1 drink < m drink m if l[shop][1] == 0:
    shop += 1
  else:
    drink += 1
    money += l[shop][0]
    l[shop][1] -= 1 l[shop][1] == 0 l[shop][1] [shop] l shop 1 0 shop += 1 shop 1 drink += 1 drink 1 money += l[shop][0] money l[shop][0] [shop] l shop 0 l[shop][1] -= 1 l[shop][1] [shop] l shop 1 1 """    
    print("shop:",shop)
    print("drink:",drink)
    print("money:",money)
""" print(money) print money drink += 1 1 drink shop += 1 1 shop shop = 0 0 shop money = 0 0 money m = map(int, input().split()) map(int, input().split()) m l = [list(map(int,input().split())) for i in range(n)] [list(map(int,input().split())) for i in range(n)] l money += l[shop][0] l[shop][0] money n, m = map(int, input().split()) map(int, input().split()) n drink = 0 0 drink
n, m = map(int, input().split())
l = [list(map(int,input().split())) for i in range(n)]

l.sort()

drink = 0
shop = 0
money = 0
while drink < m:
  if l[shop][1] == 0:
    shop += 1
  else:
    drink += 1
    money += l[shop][0]
    l[shop][1] -= 1
"""    
    print("shop:",shop)
    print("drink:",drink)
    print("money:",money)
"""
print(money)