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

x,y=[],[]

x=sorted([list(map(int,input().split()))for i in range(n)],key=lambda x:x[0])

#小さい方から買うけど、余ったら減らす



#print(x)

for i in range(n):

    #print(m)

    c=m-x[i][1]

    if c<=0:

        s=0

        for j in range(i+1):

            #print(x[i])

            s+=x[j][0]*x[j][1]

        #print(s)

        print((s+c*x[i][0]))

        break

    m=c

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

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

ab.sort()

ans=0

for i in range(n):

    if m>ab[i][1]:

        ans+=ab[i][0]*ab[i][1]

        m-=ab[i][1]

    else:

        ans+=ab[i][0]*m

        print(ans)

        break

n, m = list(map(int, input().split()))
x, y = [], []
x = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[0])
# 小さい方から買うけど、余ったら減らす
# print(x)
for i in range(n):
    # print(m)
    c = m - x[i][1]
    if c <= 0:
        s = 0
        for j in range(i + 1):
            # print(x[i])
            s += x[j][0] * x[j][1]
        # print(s)
        print((s + c * x[i][0]))
        break
    m = c

n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort()
ans = 0
for i in range(n):
    if m > ab[i][1]:
        ans += ab[i][0] * ab[i][1]
        m -= ab[i][1]
    else:
        ans += ab[i][0] * m
        print(ans)
        break

-x, y = [], [] -x = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[0]) -# 小さい方から買うけど、余ったら減らす -# print(x) +ab = [list(map(int, input().split())) for i in range(n)] +ab.sort() +ans = 0 -    # print(m) -    c = m - x[i][1] -    if c <= 0: -        s = 0 -        for j in range(i + 1): -            # print(x[i]) -            s += x[j][0] * x[j][1] -        # print(s) -        print((s + c * x[i][0])) +    if m > ab[i][1]: +        ans += ab[i][0] * ab[i][1] +        m -= ab[i][1] +    else: +        ans += ab[i][0] * m +        print(ans) -    m = c