n, m = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
x.sort()

s = 0
for a, b in x:
  if m > b:
    s += a * b
    m += -b
  else:
    s += a * m
    break

print(s) 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 _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split x = [list(map(int, input().split())) for _ in range(n)] x [list(map(int, input().split())) for _ in range(n)] x.sort() x.sort x sort s = 0 s 0 for a, b in x:
  if m > b:
    s += a * b
    m += -b
  else:
    s += a * m
    break a b x if m > b:
    s += a * b
    m += -b
  else:
    s += a * m
    break m > b m b s += a * b s a * b a b m += -b m -b b s += a * m s a * m a m break print(s) print s n, m = map(int, input().split()) map(int, input().split()) n s += a * b a * b s m += -b -b m x = [list(map(int, input().split())) for _ in range(n)] [list(map(int, input().split())) for _ in range(n)] x s = 0 0 s s += a * m a * m s m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
x.sort()

s = 0
for a, b in x:
  if m > b:
    s += a * b
    m += -b
  else:
    s += a * m
    break

print(s)