from collections import defaultdict

def main():
    N, M = map(int, input().split())
    a_b_dict = defaultdict(int)
    for _ in range(N):
        a, b = map(int, input().split())
        a_b_dict[a] += b
    ans = 0
    for a, b in sorted(a_b_dict.items()):
        if M >= b:
            M -= b
            ans += a * b
        else:
            ans += a * M
            break
    print(ans)


if __name__ == '__main__':
    main() from collections import defaultdict def main():
    N, M = map(int, input().split())
    a_b_dict = defaultdict(int)
    for _ in range(N):
        a, b = map(int, input().split())
        a_b_dict[a] += b
    ans = 0
    for a, b in sorted(a_b_dict.items()):
        if M >= b:
            M -= b
            ans += a * b
        else:
            ans += a * M
            break
    print(ans) main N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M a_b_dict = defaultdict(int) a_b_dict defaultdict(int) defaultdict int for _ in range(N):
        a, b = map(int, input().split())
        a_b_dict[a] += b
     _ range(N) range N a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b a_b_dict[a] += b a_b_dict[a] a_b_dict a b ans = 0 ans 0 for a, b in sorted(a_b_dict.items()):
        if M >= b:
            M -= b
            ans += a * b
        else:
            ans += a * M
            break
     a b sorted(a_b_dict.items()) sorted a_b_dict.items() a_b_dict.items a_b_dict items if M >= b:
            M -= b
            ans += a * b
        else:
            ans += a * M
            break
     M >= b M b M -= b M b ans += a * b ans a * b a b ans += a * M ans a * M a M break print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N, M = map(int, input().split())
    a_b_dict = defaultdict(int)
    for _ in range(N):
        a, b = map(int, input().split())
        a_b_dict[a] += b
    ans = 0
    for a, b in sorted(a_b_dict.items()):
        if M >= b:
            M -= b
            ans += a * b
        else:
            ans += a * M
            break
    print(ans) def main():
    N, M = map(int, input().split())
    a_b_dict = defaultdict(int)
    for _ in range(N):
        a, b = map(int, input().split())
        a_b_dict[a] += b
    ans = 0
    for a, b in sorted(a_b_dict.items()):
        if M >= b:
            M -= b
            ans += a * b
        else:
            ans += a * M
            break
    print(ans) main
from collections import defaultdict

def main():
    N, M = map(int, input().split())
    a_b_dict = defaultdict(int)
    for _ in range(N):
        a, b = map(int, input().split())
        a_b_dict[a] += b
    ans = 0
    for a, b in sorted(a_b_dict.items()):
        if M >= b:
            M -= b
            ans += a * b
        else:
            ans += a * M
            break
    print(ans)


if __name__ == '__main__':
    main()
