from operator import itemgetter
n, m = map(int, input().split())
lst = []
for i in range(n):
  lst.append(tuple(map(int, input().split())))
lst.sort(key=itemgetter(0))
res = 0
for i in range(n):
  if lst[i][1] <= m:
    m -= lst[i][1]
    res += (lst[i][0] * lst[i][1])
  else:
    res += (lst[i][0] * m)
    break
print(res) from operator import itemgetter n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m lst = [] lst [] for i in range(n):
  lst.append(tuple(map(int, input().split()))) i range(n) range n lst.append(tuple(map(int, input().split()))) lst.append lst append tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split lst.sort(key=itemgetter(0)) lst.sort lst sort key=itemgetter(0) key itemgetter(0) itemgetter 0 res = 0 res 0 for i in range(n):
  if lst[i][1] <= m:
    m -= lst[i][1]
    res += (lst[i][0] * lst[i][1])
  else:
    res += (lst[i][0] * m)
    break i range(n) range n if lst[i][1] <= m:
    m -= lst[i][1]
    res += (lst[i][0] * lst[i][1])
  else:
    res += (lst[i][0] * m)
    break lst[i][1] <= m lst[i][1] [i] lst i 1 m m -= lst[i][1] m lst[i][1] [i] lst i 1 res += (lst[i][0] * lst[i][1]) res lst[i][0] * lst[i][1] lst[i][0] [i] lst i 0 lst[i][1] [i] lst i 1 res += (lst[i][0] * m) res lst[i][0] * m lst[i][0] [i] lst i 0 m break print(res) print res res = 0 0 res n, m = map(int, input().split()) map(int, input().split()) n res += (lst[i][0] * m) lst[i][0] * m res m -= lst[i][1] lst[i][1] m m = map(int, input().split()) map(int, input().split()) m lst = [] [] lst res += (lst[i][0] * lst[i][1]) lst[i][0] * lst[i][1] res
from operator import itemgetter
n, m = map(int, input().split())
lst = []
for i in range(n):
  lst.append(tuple(map(int, input().split())))
lst.sort(key=itemgetter(0))
res = 0
for i in range(n):
  if lst[i][1] <= m:
    m -= lst[i][1]
    res += (lst[i][0] * lst[i][1])
  else:
    res += (lst[i][0] * m)
    break
print(res)