

n,m = map(int,input().split(" "))
li = []

for i in range(n):
    a,b = map(int,input().split(" "))
    li.append((a,b))

li.sort()

result = 0
count = 0
flag = False
for i in range(m):
    for j in range(li[i][1]):
        result += li[i][0]
        count += 1
        if count == m:
            flag = True
            break
    if flag:
        break
print(result) n,m = map(int,input().split(" ")) n map(int,input().split(" ")) map int input().split(" ") ().split () input split " " m li = [] li [] for i in range(n):
    a,b = map(int,input().split(" "))
    li.append((a,b)) i range(n) range n a,b = map(int,input().split(" ")) a map(int,input().split(" ")) map int input().split(" ") ().split () input split " " b li.append((a,b)) li.append li append (a,b) a b li.sort() li.sort li sort result = 0 result 0 count = 0 count 0 flag = False flag False for i in range(m):
    for j in range(li[i][1]):
        result += li[i][0]
        count += 1
        if count == m:
            flag = True
            break
    if flag:
        break i range(m) range m for j in range(li[i][1]):
        result += li[i][0]
        count += 1
        if count == m:
            flag = True
            break
     j range(li[i][1]) range li[i][1] [i] li i 1 result += li[i][0] result li[i][0] [i] li i 0 count += 1 count 1 if count == m:
            flag = True
            break
     count == m count m flag = True flag True break if flag:
        break flag break print(result) print result flag = False False flag count = 0 0 count result = 0 0 result li = [] [] li flag = True True flag n,m = map(int,input().split(" ")) map(int,input().split(" ")) n b = map(int,input().split(" ")) map(int,input().split(" ")) b a,b = map(int,input().split(" ")) map(int,input().split(" ")) a m = map(int,input().split(" ")) map(int,input().split(" ")) m result += li[i][0] li[i][0] result count += 1 1 count


n,m = map(int,input().split(" "))
li = []

for i in range(n):
    a,b = map(int,input().split(" "))
    li.append((a,b))

li.sort()

result = 0
count = 0
flag = False
for i in range(m):
    for j in range(li[i][1]):
        result += li[i][0]
        count += 1
        if count == m:
            flag = True
            break
    if flag:
        break
print(result)