output_description: Print the minimum amount of money with which Takahashi can buy M cans of
  energy drinks.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
      A_1 B_1
      A_2 B_2
      \vdots
      A_N B_N
attempt: b = list(map(int, input().split()))
  LL = []
  for i in range(b[0]):
      LL.append(list(map(int, input().split())))
  LL.sort()
  x = 0
  z = 0
  y = b[1]
  i = -1
  # 初めi=0で固定しリストの先頭削除をしていたが計算時間がそれなりにかかる
  # i+=1でiを増やしていく方向で行かないといけない
  while y >= 0 and not LL == []:
      i += 1
      if y <= LL[i][1]:
          print(x + LL[i][0] * y)
          break
      else:
          y -= LL[i][1]
          x += LL[i][1] * LL[i][0]
  
problem_description: Statement
  
  Hearing that energy drinks increase rating in those sites, Takahashi decides
  to buy up M cans of energy drinks.
  
  There are N stores that sell energy drinks. In the i-th store, he can buy at
  most B_i cans of energy drinks for A_i yen (the currency of Japan) each.
  
  What is the minimum amount of money with which he can buy M cans of energy
  drinks?
  
  It is guaranteed that, in the given inputs, a sufficient amount of money can
  always buy M cans of energy drinks.
samples: [{"input": "2 5\n    4 9\n    2 4", "output": "12\n    \n\nWith 12 yen, we can buy one drink at the first store and four drinks at the\nsecond store, for the total of five drinks. However, we cannot buy 5 drinks\nwith 11 yen or less.\n\n* * *"}, {"input": "4 30\n    6 18\n    2 5\n    3 10\n    7 9", "output": "130\n    \n\n* * *"}, {"input": "1 100000\n    1000000000 100000", "output": "100000000000000\n    \n\nThe output may not fit into a 32-bit integer type."}]