from itertools import accumulate

N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
sAB = sorted(AB, key=lambda x: x[0])

sB = [sAB[i][1] for i in range(N)]
cum_num = list(accumulate(sB))

num = 0
ans = 0
index_ = -1
for a, b in sAB:
    index_ += 1
    num += b
    if num >= M:
        break
    ans += a*b

if index_ == 0:
    ans += sAB[0][0]*M
else:
    ans += sAB[index_][0]*(M-cum_num[index_-1])

print(ans) from itertools import accumulate 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)] sAB = sorted(AB, key=lambda x: x[0]) sAB sorted(AB, key=lambda x: x[0]) sorted AB key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x sAB[i][1] for i in range(N) for i in range(N) i range(N) range N for i in range(N) sAB[i][1] [i] sAB i 1 sB = [sAB[i][1] for i in range(N)] sB [sAB[i][1] for i in range(N)] cum_num = list(accumulate(sB)) cum_num list(accumulate(sB)) list accumulate(sB) accumulate sB num = 0 num 0 ans = 0 ans 0 index_ = -1 index_ -1 for a, b in sAB:
    index_ += 1
    num += b
    if num >= M:
        break
    ans += a*b a b sAB index_ += 1 index_ 1 num += b num b if num >= M:
        break
     num >= M num M break ans += a*b ans a*b a b if index_ == 0:
    ans += sAB[0][0]*M
else:
    ans += sAB[index_][0]*(M-cum_num[index_-1]) index_ == 0 index_ 0 ans += sAB[0][0]*M ans sAB[0][0]*M sAB[0][0] [0] sAB 0 0 M ans += sAB[index_][0]*(M-cum_num[index_-1]) ans sAB[index_][0]*(M-cum_num[index_-1]) sAB[index_][0] [index_] sAB index_ 0 M-cum_num[index_-1] M cum_num[index_-1] cum_num index_-1 index_ 1 print(ans) print ans ans += sAB[0][0]*M sAB[0][0]*M ans index_ = -1 -1 index_ cum_num = list(accumulate(sB)) list(accumulate(sB)) cum_num M = map(int, input().split()) map(int, input().split()) M AB = [tuple(map(int, input().split())) for _ in range(N)] [tuple(map(int, input().split())) for _ in range(N)] AB ans += sAB[index_][0]*(M-cum_num[index_-1]) sAB[index_][0]*(M-cum_num[index_-1]) ans sB = [sAB[i][1] for i in range(N)] [sAB[i][1] for i in range(N)] sB sAB = sorted(AB, key=lambda x: x[0]) sorted(AB, key=lambda x: x[0]) sAB ans += a*b a*b ans ans = 0 0 ans num += b b num index_ += 1 1 index_ N, M = map(int, input().split()) map(int, input().split()) N num = 0 0 num
from itertools import accumulate

N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
sAB = sorted(AB, key=lambda x: x[0])

sB = [sAB[i][1] for i in range(N)]
cum_num = list(accumulate(sB))

num = 0
ans = 0
index_ = -1
for a, b in sAB:
    index_ += 1
    num += b
    if num >= M:
        break
    ans += a*b

if index_ == 0:
    ans += sAB[0][0]*M
else:
    ans += sAB[index_][0]*(M-cum_num[index_-1])

print(ans)
