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: #!/usr/bin/env python3
  # -*- coding: utf-8 -*-
  """
  Created on 2019/3/9
  Solved on 2019/3/9
  @author: shinjisu
  """
  
  
  # ABC 121
  # import math
  
  
  def getInt():
      return int(input())
  
  
  def getIntList():
      return [int(x) for x in input().split()]
  
  
  def zeros(n):
      return [0] * n
  
  
  def getIntLines(n):
      return [int(input()) for i in range(n)]
  
  
  def getIntMat(n):
      mat = []
      for i in range(n):
          mat.append(getIntList())
      return mat
  
  
  def zeros2(n, m):
      return [zeros(m)] * n
  
  
  ALPHABET = [chr(i + ord("a")) for i in range(26)]
  DIGIT = [chr(i + ord("0")) for i in range(10)]
  N1097 = 10**9 + 7
  INF = 10**12
  
  
  def dmp(x, cmt=""):
      global debug
      if debug:
          if cmt != "":
              print(cmt, ":  ", end="")
          print(x)
      return x
  
  
  def prob_C():
      N, M = getIntList()
      dmp((N, M))
      BA = zeros(N)
      for i in range(N):
          BA[i] = getIntList()
      dmp(BA, "BA")
      BA.sort()
      dmp(BA, "BA")
      count = 0
      yen = 0
      for i in range(N):
          buyCount = min(BA[i][1], M - count)
          yen += buyCount * BA[i][0]
          count += buyCount
          dmp((buyCount, count, yen), "buyCount, count, yen")
          if buyCount >= M:
              break
      dmp(yen, "yen")
      return yen
  
  
  debug = False  # True False
  ans = prob_C()
  print(ans)
  # for row in ans:
  #    print(row)
  
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."}]