from operator import itemgetter
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=itemgetter(0))
ans = 0
for i in range(N):
    ans += min(M, AB[i][1]) * AB[i][0]
    M -= min(M, AB[i][1])
    if M==0:
        break
print(ans) from operator import itemgetter N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M tuple(map(int, input().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split AB = [tuple(map(int, input().split())) for _ in range(N)] AB [tuple(map(int, input().split())) for _ in range(N)] AB.sort(key=itemgetter(0)) AB.sort AB sort key=itemgetter(0) key itemgetter(0) itemgetter 0 ans = 0 ans 0 for i in range(N):
    ans += min(M, AB[i][1]) * AB[i][0]
    M -= min(M, AB[i][1])
    if M==0:
        break i range(N) range N ans += min(M, AB[i][1]) * AB[i][0] ans min(M, AB[i][1]) * AB[i][0] min(M, AB[i][1]) min M AB[i][1] [i] AB i 1 AB[i][0] [i] AB i 0 M -= min(M, AB[i][1]) M min(M, AB[i][1]) min M AB[i][1] [i] AB i 1 if M==0:
        break M==0 M 0 break print(ans) print ans N, M = map(int, input().split()) map(int, input().split()) N ans = 0 0 ans M -= min(M, AB[i][1]) min(M, AB[i][1]) M ans += min(M, AB[i][1]) * AB[i][0] min(M, AB[i][1]) * AB[i][0] ans AB = [tuple(map(int, input().split())) for _ in range(N)] [tuple(map(int, input().split())) for _ in range(N)] AB M = map(int, input().split()) map(int, input().split()) M
from operator import itemgetter
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=itemgetter(0))
ans = 0
for i in range(N):
    ans += min(M, AB[i][1]) * AB[i][0]
    M -= min(M, AB[i][1])
    if M==0:
        break
print(ans)
