def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, m = Input()
    data = sorted([Input() for _ in range(n)])
    amount = 0
    for x, y in data:
        get1 = min(y, m)
        m = m - get1
        amount += get1 * x
        if m <= 0:
            return amount

print(main()) def mapt(fn, *args):
    return tuple(map(fn, *args)) mapt return tuple(map(fn, *args)) tuple(map(fn, *args)) tuple map(fn, *args) map fn *args args fn fn *args def Input():
    return mapt(int, input().split(" ")) Input return mapt(int, input().split(" ")) mapt(int, input().split(" ")) mapt int input().split(" ") ().split () input split " " def main():
    n, m = Input()
    data = sorted([Input() for _ in range(n)])
    amount = 0
    for x, y in data:
        get1 = min(y, m)
        m = m - get1
        amount += get1 * x
        if m <= 0:
            return amount main n, m = Input() n Input() Input m Input() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) Input() Input data = sorted([Input() for _ in range(n)]) data sorted([Input() for _ in range(n)]) sorted [Input() for _ in range(n)] amount = 0 amount 0 for x, y in data:
        get1 = min(y, m)
        m = m - get1
        amount += get1 * x
        if m <= 0:
            return amount x y data get1 = min(y, m) get1 min(y, m) min y m m = m - get1 m m - get1 m get1 amount += get1 * x amount get1 * x get1 x if m <= 0:
            return amount m <= 0 m 0 return amount amount print(main()) print main() main def Input():
    return mapt(int, input().split(" ")) def Input():
    return mapt(int, input().split(" ")) Input def main():
    n, m = Input()
    data = sorted([Input() for _ in range(n)])
    amount = 0
    for x, y in data:
        get1 = min(y, m)
        m = m - get1
        amount += get1 * x
        if m <= 0:
            return amount def main():
    n, m = Input()
    data = sorted([Input() for _ in range(n)])
    amount = 0
    for x, y in data:
        get1 = min(y, m)
        m = m - get1
        amount += get1 * x
        if m <= 0:
            return amount main def mapt(fn, *args):
    return tuple(map(fn, *args)) def mapt(fn, *args):
    return tuple(map(fn, *args)) mapt
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, m = Input()
    data = sorted([Input() for _ in range(n)])
    amount = 0
    for x, y in data:
        get1 = min(y, m)
        m = m - get1
        amount += get1 * x
        if m <= 0:
            return amount

print(main())