#!/anaconda3/bin/python

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

ab=[tuple(map(int,input().split())) for i in range(n)]

money=0

ab.sort(key=lambda tup:tup[0])

for a,b in ab:

    if m-b>0:

        money+=a*b

        m-=b        

    else:

        money+=a*m

        break

print(money)



#!/usr/bin/env python3

import sys, math, itertools, heapq, collections, bisect, string

input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')

sys.setrecursionlimit(10**7)

inf = float('inf')

mod = 10**9+7

ans = 0 ;count = 0 ;pro = 1





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

AB=[tuple(map(int,input().split())) for i in range(n)]

AB.sort(key=lambda tup:tup[0])

i=0

while count<m:

    ans+=min(m-count,AB[i][1])*AB[i][0]

    count += min(m-count, AB[i][1])

    i+=1

print(ans)

    



#!/anaconda3/bin/python
n, m = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(n)]
money = 0
ab.sort(key=lambda tup: tup[0])
for a, b in ab:
    if m - b > 0:
        money += a * b
        m -= b
    else:
        money += a * m
        break
print(money)

#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string

input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**7)
inf = float("inf")
mod = 10**9 + 7
ans = 0
count = 0
pro = 1
n, m = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for i in range(n)]
AB.sort(key=lambda tup: tup[0])
i = 0
while count < m:
    ans += min(m - count, AB[i][1]) * AB[i][0]
    count += min(m - count, AB[i][1])
    i += 1
print(ans)

-#!/anaconda3/bin/python +#!/usr/bin/env python3 +import sys, math, itertools, heapq, collections, bisect, string + +input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") +sys.setrecursionlimit(10**7) +inf = float("inf") +mod = 10**9 + 7 +ans = 0 +count = 0 +pro = 1 -ab = [tuple(map(int, input().split())) for i in range(n)] -money = 0 -ab.sort(key=lambda tup: tup[0]) -for a, b in ab: -    if m - b > 0: -        money += a * b -        m -= b -    else: -        money += a * m -        break -print(money) +AB = [tuple(map(int, input().split())) for i in range(n)] +AB.sort(key=lambda tup: tup[0]) +i = 0 +while count < m: +    ans += min(m - count, AB[i][1]) * AB[i][0] +    count += min(m - count, AB[i][1]) +    i += 1 +print(ans)