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

AB = [list(map(int,input().split())) for _ in range(n)]

cost = 0

temp = 0

s_AB = sorted(AB)

for ab in s_AB:

    cost += ab[0]*ab[1]

    temp += ab[1]

    if(temp > m):

        cost -= ab[0]*(temp - m)

        break

    elif(temp == m):

        break

print(cost)

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

AB = [list(map(int,input().split())) for _ in range(n)]





from operator import itemgetter

def main():

    AB.sort(key = itemgetter(0))

    cnt = 0

    ans = 0

    for a,b in AB:

        if b + cnt < m:

            cnt += b 

            ans += b*a

        else:

            ans += (m - cnt)*a

            print(ans)

            return







if __name__ == "__main__":

    main()
n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(n)]
cost = 0
temp = 0
s_AB = sorted(AB)
for ab in s_AB:
    cost += ab[0] * ab[1]
    temp += ab[1]
    if temp > m:
        cost -= ab[0] * (temp - m)
        break
    elif temp == m:
        break
print(cost)

n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(n)]
from operator import itemgetter


def main():
    AB.sort(key=itemgetter(0))
    cnt = 0
    ans = 0
    for a, b in AB:
        if b + cnt < m:
            cnt += b
            ans += b * a
        else:
            ans += (m - cnt) * a
            print(ans)
            return


if __name__ == "__main__":
    main()

-cost = 0 -temp = 0 -s_AB = sorted(AB) -for ab in s_AB: -    cost += ab[0] * ab[1] -    temp += ab[1] -    if temp > m: -        cost -= ab[0] * (temp - m) -        break -    elif temp == m: -        break -print(cost) +from operator import itemgetter + + +def main(): +    AB.sort(key=itemgetter(0)) +    cnt = 0 +    ans = 0 +    for a, b in AB: +        if b + cnt < m: +            cnt += b +            ans += b * a +        else: +            ans += (m - cnt) * a +            print(ans) +            return + + +if __name__ == "__main__": +    main()