def main():
    n, m = map(int, input().split())
    ab_list = [list(map(int, input().split())) for _ in range(n)]
    ab_list.sort(key=lambda x: x[0])
    ans, cnt = 0, 0

    for i in range(n):
        ans += ab_list[i][0] * ab_list[i][1]
        cnt += ab_list[i][1]
        if cnt > m:
            ans -= ab_list[i][0] * (cnt - m)
            break

    print(ans)


if __name__ == "__main__":
    main() def main():
    n, m = map(int, input().split())
    ab_list = [list(map(int, input().split())) for _ in range(n)]
    ab_list.sort(key=lambda x: x[0])
    ans, cnt = 0, 0

    for i in range(n):
        ans += ab_list[i][0] * ab_list[i][1]
        cnt += ab_list[i][1]
        if cnt > m:
            ans -= ab_list[i][0] * (cnt - m)
            break

    print(ans) main n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ab_list = [list(map(int, input().split())) for _ in range(n)] ab_list [list(map(int, input().split())) for _ in range(n)] ab_list.sort(key=lambda x: x[0]) ab_list.sort ab_list sort key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x ans, cnt = 0, 0 ans 0 cnt 0 for i in range(n):
        ans += ab_list[i][0] * ab_list[i][1]
        cnt += ab_list[i][1]
        if cnt > m:
            ans -= ab_list[i][0] * (cnt - m)
            break

     i range(n) range n ans += ab_list[i][0] * ab_list[i][1] ans ab_list[i][0] * ab_list[i][1] ab_list[i][0] [i] ab_list i 0 ab_list[i][1] [i] ab_list i 1 cnt += ab_list[i][1] cnt ab_list[i][1] [i] ab_list i 1 if cnt > m:
            ans -= ab_list[i][0] * (cnt - m)
            break

     cnt > m cnt m ans -= ab_list[i][0] * (cnt - m) ans ab_list[i][0] * (cnt - m) ab_list[i][0] [i] ab_list i 0 cnt - m cnt m break print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    n, m = map(int, input().split())
    ab_list = [list(map(int, input().split())) for _ in range(n)]
    ab_list.sort(key=lambda x: x[0])
    ans, cnt = 0, 0

    for i in range(n):
        ans += ab_list[i][0] * ab_list[i][1]
        cnt += ab_list[i][1]
        if cnt > m:
            ans -= ab_list[i][0] * (cnt - m)
            break

    print(ans) def main():
    n, m = map(int, input().split())
    ab_list = [list(map(int, input().split())) for _ in range(n)]
    ab_list.sort(key=lambda x: x[0])
    ans, cnt = 0, 0

    for i in range(n):
        ans += ab_list[i][0] * ab_list[i][1]
        cnt += ab_list[i][1]
        if cnt > m:
            ans -= ab_list[i][0] * (cnt - m)
            break

    print(ans) main
def main():
    n, m = map(int, input().split())
    ab_list = [list(map(int, input().split())) for _ in range(n)]
    ab_list.sort(key=lambda x: x[0])
    ans, cnt = 0, 0

    for i in range(n):
        ans += ab_list[i][0] * ab_list[i][1]
        cnt += ab_list[i][1]
        if cnt > m:
            ans -= ab_list[i][0] * (cnt - m)
            break

    print(ans)


if __name__ == "__main__":
    main()
