N,M=list(map(int,input().split()))

AB=[]

for i in range(N):

  AB.append(list(map(int,input().split())))

AB=sorted(AB,key=lambda x: x[0])

#print(AB)



ans=0

num=0

for i in range(N):

  if num+AB[i][1]>=M:

    ans+=AB[i][0]*(M-num)

    break

  else:

    num+=AB[i][1]

    ans+=AB[i][0]*AB[i][1]

  #print(ans)

print(ans)
import sys

input = sys.stdin.buffer.readline



N, M = list(map(int, input().split()))

AB = [list(map(int, input().split())) for _ in range(N)]



AB = sorted(AB)



answer = 0

for a, b in AB:

  if M > b:

    answer += a * b

    M -= b

  else:

    answer += a * M

    break



print(answer)
N, M = list(map(int, input().split()))
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
AB = sorted(AB, key=lambda x: x[0])
# print(AB)
ans = 0
num = 0
for i in range(N):
    if num + AB[i][1] >= M:
        ans += AB[i][0] * (M - num)
        break
    else:
        num += AB[i][1]
        ans += AB[i][0] * AB[i][1]
    # print(ans)
print(ans)

import sys

input = sys.stdin.buffer.readline
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB)
answer = 0
for a, b in AB:
    if M > b:
        answer += a * b
        M -= b
    else:
        answer += a * M
        break
print(answer)

+import sys + +input = sys.stdin.buffer.readline -AB = [] -for i in range(N): -    AB.append(list(map(int, input().split()))) -AB = sorted(AB, key=lambda x: x[0]) -# print(AB) -ans = 0 -num = 0 -for i in range(N): -    if num + AB[i][1] >= M: -        ans += AB[i][0] * (M - num) +AB = [list(map(int, input().split())) for _ in range(N)] +AB = sorted(AB) +answer = 0 +for a, b in AB: +    if M > b: +        answer += a * b +        M -= b +    else: +        answer += a * M -    else: -        num += AB[i][1] -        ans += AB[i][0] * AB[i][1] -    # print(ans) -print(ans) +print(answer)