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

C = []
for i in range(N):
    C.append(tuple(map(int,input().split())))

C.sort()

tmp = M
ans = 0
for cost,num in C:
    if tmp - num >= 0:##全部買う
        tmp -= num
        ans += num*cost
    else:
        ans += cost*tmp
        break

print(ans) N,M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M C = [] C [] for i in range(N):
    C.append(tuple(map(int,input().split()))) i range(N) range N C.append(tuple(map(int,input().split()))) C.append C append tuple(map(int,input().split())) tuple map(int,input().split()) map int input().split() ().split () input split C.sort() C.sort C sort tmp = M tmp M ans = 0 ans 0 for cost,num in C:
    if tmp - num >= 0:##全部買う
        tmp -= num
        ans += num*cost
    else:
        ans += cost*tmp
        break cost num C if tmp - num >= 0:##全部買う
        tmp -= num
        ans += num*cost
    else:
        ans += cost*tmp
        break tmp - num >= 0 tmp - num tmp num 0 tmp -= num tmp num ans += num*cost ans num*cost num cost ans += cost*tmp ans cost*tmp cost tmp break print(ans) print ans M = map(int,input().split()) map(int,input().split()) M ans += num*cost num*cost ans C = [] [] C tmp -= num num tmp ans += cost*tmp cost*tmp ans N,M = map(int,input().split()) map(int,input().split()) N ans = 0 0 ans tmp = M M tmp
N,M = map(int,input().split())

C = []
for i in range(N):
    C.append(tuple(map(int,input().split())))

C.sort()

tmp = M
ans = 0
for cost,num in C:
    if tmp - num >= 0:##全部買う
        tmp -= num
        ans += num*cost
    else:
        ans += cost*tmp
        break

print(ans)