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

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

count = 0

ans = 0

for a, b in AB:

    if count + b >= M:

        ans += a * (M - count)

        break

    else:

        ans += a * b

        count += b

print(ans)
def main():

    import sys

    input = sys.stdin.readline

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

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

    money = 0

    count = 0

    for a, b in AB:

        if count + b >= M:

            money += a * (M - count)

            break

        else:

            money += a * b

            count += b

    print(money)





if __name__ == '__main__':

    main()
N, M = list(map(int, input().split()))
AB = sorted([tuple(map(int, input().split())) for _ in range(N)])
count = 0
ans = 0
for a, b in AB:
    if count + b >= M:
        ans += a * (M - count)
        break
    else:
        ans += a * b
        count += b
print(ans)

def main():
    import sys

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


if __name__ == "__main__":
    main()

-N, M = list(map(int, input().split())) -AB = sorted([tuple(map(int, input().split())) for _ in range(N)]) -count = 0 -ans = 0 -for a, b in AB: -    if count + b >= M: -        ans += a * (M - count) -        break -    else: -        ans += a * b -        count += b -print(ans) +def main(): +    import sys + +    input = sys.stdin.readline +    N, M = list(map(int, input().split())) +    AB = sorted([tuple(map(int, input().split())) for _ in range(N)]) +    money = 0 +    count = 0 +    for a, b in AB: +        if count + b >= M: +            money += a * (M - count) +            break +        else: +            money += a * b +            count += b +    print(money) + + +if __name__ == "__main__": +    main()