from sys import stdin
input = stdin.buffer.readline

def main():
    n, m = map(int, input().split())
    ab = [(0, 0)] * n
    for i in range(n):
        ab[i] = tuple(map(int, input().split()))

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

    ans = 0
    for a, b in ab:
        if b < m:
            ans += a * b
            m -= b
        else:
            ans += a * m
            print(ans)
            break

main() from sys import stdin input = stdin.buffer.readline input stdin.buffer.readline stdin.buffer stdin buffer readline def main():
    n, m = map(int, input().split())
    ab = [(0, 0)] * n
    for i in range(n):
        ab[i] = tuple(map(int, input().split()))

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

    ans = 0
    for a, b in ab:
        if b < m:
            ans += a * b
            m -= b
        else:
            ans += a * m
            print(ans)
            break main n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m ab = [(0, 0)] * n ab [(0, 0)] * n [(0, 0)] (0, 0) 0 0 n for i in range(n):
        ab[i] = tuple(map(int, input().split()))

     i range(n) range n ab[i] = tuple(map(int, input().split())) ab[i] ab i tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split ab.sort(key=lambda x: x[0]) ab.sort ab sort key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x ans = 0 ans 0 for a, b in ab:
        if b < m:
            ans += a * b
            m -= b
        else:
            ans += a * m
            print(ans)
            break a b ab if b < m:
            ans += a * b
            m -= b
        else:
            ans += a * m
            print(ans)
            break b < m b m ans += a * b ans a * b a b m -= b m b ans += a * m ans a * m a m print(ans) print ans break main() main def main():
    n, m = map(int, input().split())
    ab = [(0, 0)] * n
    for i in range(n):
        ab[i] = tuple(map(int, input().split()))

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

    ans = 0
    for a, b in ab:
        if b < m:
            ans += a * b
            m -= b
        else:
            ans += a * m
            print(ans)
            break def main():
    n, m = map(int, input().split())
    ab = [(0, 0)] * n
    for i in range(n):
        ab[i] = tuple(map(int, input().split()))

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

    ans = 0
    for a, b in ab:
        if b < m:
            ans += a * b
            m -= b
        else:
            ans += a * m
            print(ans)
            break main input = stdin.buffer.readline stdin.buffer.readline input
from sys import stdin
input = stdin.buffer.readline

def main():
    n, m = map(int, input().split())
    ab = [(0, 0)] * n
    for i in range(n):
        ab[i] = tuple(map(int, input().split()))

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

    ans = 0
    for a, b in ab:
        if b < m:
            ans += a * b
            m -= b
        else:
            ans += a * m
            print(ans)
            break

main()