from operator import itemgetter

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort()
#print(ab)
i = 0
ans = 0
while m >0:
  if ab[i][1]<=m:
    m -= ab[i][1]
    ans += ab[i][0]*ab[i][1]
  else:
    ans += ab[i][0]*m
    m = 0
  i+=1
print(ans) from operator import itemgetter 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 i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ab = [list(map(int, input().split())) for i in range(n)] ab [list(map(int, input().split())) for i in range(n)] ab.sort() ab.sort ab sort i = 0 i 0 ans = 0 ans 0 while m >0:
  if ab[i][1]<=m:
    m -= ab[i][1]
    ans += ab[i][0]*ab[i][1]
  else:
    ans += ab[i][0]*m
    m = 0
  i+=1 m >0 m 0 if ab[i][1]<=m:
    m -= ab[i][1]
    ans += ab[i][0]*ab[i][1]
  else:
    ans += ab[i][0]*m
    m = 0
   ab[i][1]<=m ab[i][1] [i] ab i 1 m m -= ab[i][1] m ab[i][1] [i] ab i 1 ans += ab[i][0]*ab[i][1] ans ab[i][0]*ab[i][1] ab[i][0] [i] ab i 0 ab[i][1] [i] ab i 1 ans += ab[i][0]*m ans ab[i][0]*m ab[i][0] [i] ab i 0 m m = 0 m 0 i+=1 i 1 print(ans) print ans ans += ab[i][0]*ab[i][1] ab[i][0]*ab[i][1] ans m -= ab[i][1] ab[i][1] m ans += ab[i][0]*m ab[i][0]*m ans i+=1 1 i m = 0 0 m ans = 0 0 ans ab = [list(map(int, input().split())) for i in range(n)] [list(map(int, input().split())) for i in range(n)] ab m = map(int, input().split()) map(int, input().split()) m n, m = map(int, input().split()) map(int, input().split()) n i = 0 0 i
from operator import itemgetter

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort()
#print(ab)
i = 0
ans = 0
while m >0:
  if ab[i][1]<=m:
    m -= ab[i][1]
    ans += ab[i][0]*ab[i][1]
  else:
    ans += ab[i][0]*m
    m = 0
  i+=1
print(ans)