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

a = []

for _ in range(n):

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

a.sort()

pm = s = 0

for item in a:

    if pm + item[1] >= m:

        print((s + item[0] * (m - pm)))

        break

    else:

        pm += item[1]

        s += item[0] * item[1]

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

a = []

for _ in range(n):

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

a.sort()

pm = s = 0

m_minus_1 = m - 1

for item in a:

    tmp = pm + item[1]

    if tmp > m_minus_1:

        print((s + item[0] * (m - pm)))

        break

    else:

        pm = tmp

        s += item[0] * item[1]

n, m = list(map(int, input().split()))
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))
a.sort()
pm = s = 0
for item in a:
    if pm + item[1] >= m:
        print((s + item[0] * (m - pm)))
        break
    else:
        pm += item[1]
        s += item[0] * item[1]

n, m = list(map(int, input().split()))
a = []
for _ in range(n):
    a.append(list(map(int, input().split())))
a.sort()
pm = s = 0
m_minus_1 = m - 1
for item in a:
    tmp = pm + item[1]
    if tmp > m_minus_1:
        print((s + item[0] * (m - pm)))
        break
    else:
        pm = tmp
        s += item[0] * item[1]

+m_minus_1 = m - 1 -    if pm + item[1] >= m: +    tmp = pm + item[1] +    if tmp > m_minus_1: -        pm += item[1] +        pm = tmp