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

A_B = []

for i in range(N):

    A_B.append([int(x) for x in input().split()])



money = 0

count = 0

A_B = sorted(A_B)

while count < M:

    if count+A_B[0][1] <= M:

        count += A_B[0][1]

        money += A_B[0][0] * A_B[0][1]

    else:

        money += A_B[0][0] * (M-count)

        count = M

    A_B.pop(0)

print(money)

import sys, re

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd

from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from bisect import bisect, bisect_left

from heapq import heappush, heappop

from functools import reduce

def input(): return sys.stdin.readline().strip()

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(): return list(map(int, input().split()))

def ZIP(n): return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7



N, M = MAP()

AB = [LIST() for _ in range(N)]



ans = 0

cnt = 0

AB = sorted(AB, reverse=True)

while cnt < M:

    A, B = AB[-1]

    if cnt+B <= M:

        cnt += B

        ans += A*B

    else:

        ans += A * (M-cnt)

        cnt = M

    AB.pop()

print(ans)

N, M = list(map(int, input().split()))
A_B = []
for i in range(N):
    A_B.append([int(x) for x in input().split()])
money = 0
count = 0
A_B = sorted(A_B)
while count < M:
    if count + A_B[0][1] <= M:
        count += A_B[0][1]
        money += A_B[0][0] * A_B[0][1]
    else:
        money += A_B[0][0] * (M - count)
        count = M
    A_B.pop(0)
print(money)

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
    accumulate,
    permutations,
    combinations,
    product,
    groupby,
    combinations_with_replacement,
)
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce


def input():
    return sys.stdin.readline().strip()


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST():
    return list(map(int, input().split()))


def ZIP(n):
    return list(zip(*(MAP() for _ in range(n))))


sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
N, M = MAP()
AB = [LIST() for _ in range(N)]
ans = 0
cnt = 0
AB = sorted(AB, reverse=True)
while cnt < M:
    A, B = AB[-1]
    if cnt + B <= M:
        cnt += B
        ans += A * B
    else:
        ans += A * (M - cnt)
        cnt = M
    AB.pop()
print(ans)

-N, M = list(map(int, input().split())) -A_B = [] -for i in range(N): -    A_B.append([int(x) for x in input().split()]) -money = 0 -count = 0 -A_B = sorted(A_B) -while count < M: -    if count + A_B[0][1] <= M: -        count += A_B[0][1] -        money += A_B[0][0] * A_B[0][1] +import sys, re +from collections import deque, defaultdict, Counter +from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd +from itertools import ( +    accumulate, +    permutations, +    combinations, +    product, +    groupby, +    combinations_with_replacement, +) +from operator import itemgetter, mul +from copy import deepcopy +from string import ascii_lowercase, ascii_uppercase, digits +from bisect import bisect, bisect_left +from heapq import heappush, heappop +from functools import reduce + + +def input(): +    return sys.stdin.readline().strip() + + +def INT(): +    return int(eval(input())) + + +def MAP(): +    return list(map(int, input().split())) + + +def LIST(): +    return list(map(int, input().split())) + + +def ZIP(n): +    return list(zip(*(MAP() for _ in range(n)))) + + +sys.setrecursionlimit(10**9) +INF = float("inf") +mod = 10**9 + 7 +N, M = MAP() +AB = [LIST() for _ in range(N)] +ans = 0 +cnt = 0 +AB = sorted(AB, reverse=True) +while cnt < M: +    A, B = AB[-1] +    if cnt + B <= M: +        cnt += B +        ans += A * B -        money += A_B[0][0] * (M - count) -        count = M -    A_B.pop(0) -print(money) +        ans += A * (M - cnt) +        cnt = M +    AB.pop() +print(ans)