def resolve():

  n, m = list(map(int, input().split()))

  l = []

  for i in range(n):

    a, b = list(map(int, input().split()))

    l.append([a, b])

  l.sort()

  ans = 0

  for ab in l:

    if ab[1] < m:

      m -= ab[1]

      ans += ab[0] * ab[1]

    else:

      ans += ab[0] * m

      m = 0

      break

  print(ans)

  return



if __name__ == "__main__":

  resolve()

def resolve():

  n, m = list(map(int, input().split()))

  arr = []

  for i in range(n):

    a, b = list(map(int, input().split()))

    arr.append([a, b])

  arr.sort()

  ans = 0

  for ab in arr:

    if ab[1] >= m:

      ans += m * ab[0]

      break

    else:

      ans += ab[0] * ab[1]

      m -= ab[1]

  print(ans)



  return



if __name__ == "__main__":

  resolve()

def resolve():
    n, m = list(map(int, input().split()))
    l = []
    for i in range(n):
        a, b = list(map(int, input().split()))
        l.append([a, b])
    l.sort()
    ans = 0
    for ab in l:
        if ab[1] < m:
            m -= ab[1]
            ans += ab[0] * ab[1]
        else:
            ans += ab[0] * m
            m = 0
            break
    print(ans)
    return


if __name__ == "__main__":
    resolve()

def resolve():
    n, m = list(map(int, input().split()))
    arr = []
    for i in range(n):
        a, b = list(map(int, input().split()))
        arr.append([a, b])
    arr.sort()
    ans = 0
    for ab in arr:
        if ab[1] >= m:
            ans += m * ab[0]
            break
        else:
            ans += ab[0] * ab[1]
            m -= ab[1]
    print(ans)
    return


if __name__ == "__main__":
    resolve()

-    l = [] +    arr = [] -        l.append([a, b]) -    l.sort() +        arr.append([a, b]) +    arr.sort() -    for ab in l: -        if ab[1] < m: +    for ab in arr: +        if ab[1] >= m: +            ans += m * ab[0] +            break +        else: +            ans += ab[0] * ab[1] -            ans += ab[0] * ab[1] -        else: -            ans += ab[0] * m -            m = 0 -            break