n, m = map(int, input().split())
AB = []
for i in range(n):
    a,b = map(int, input().split())
    AB.append((a, b))
AB.sort()

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

ans = 0
for i in range(m):
    a, b = AB[i]
    if b >= m:
        ans += a*m
        break
    else:
        ans += a*b
        m -= b
print(ans)
