def main():
    N,M = map(int, input().split())
    AB = []
    for i in range(N):
        A,B =  map(int, input().split())
        AB.append((A,B))
    AB.sort()
    coin = 0

    for i in range(N):
        temp = min(M,AB[i][1])
        coin += temp * AB[i][0]
        M -= temp
        if M==0:
            break


    print(coin)


if __name__ == '__main__':
    main()
 def main():
    N,M = map(int, input().split())
    AB = []
    for i in range(N):
        A,B =  map(int, input().split())
        AB.append((A,B))
    AB.sort()
    coin = 0

    for i in range(N):
        temp = min(M,AB[i][1])
        coin += temp * AB[i][0]
        M -= temp
        if M==0:
            break


    print(coin) main 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 coin = 0 coin 0 for i in range(N):
        temp = min(M,AB[i][1])
        coin += temp * AB[i][0]
        M -= temp
        if M==0:
            break


     i range(N) range N temp = min(M,AB[i][1]) temp min(M,AB[i][1]) min M AB[i][1] [i] AB i 1 coin += temp * AB[i][0] coin temp * AB[i][0] temp AB[i][0] [i] AB i 0 M -= temp M temp if M==0:
            break


     M==0 M 0 break print(coin) print coin if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N,M = map(int, input().split())
    AB = []
    for i in range(N):
        A,B =  map(int, input().split())
        AB.append((A,B))
    AB.sort()
    coin = 0

    for i in range(N):
        temp = min(M,AB[i][1])
        coin += temp * AB[i][0]
        M -= temp
        if M==0:
            break


    print(coin) def main():
    N,M = map(int, input().split())
    AB = []
    for i in range(N):
        A,B =  map(int, input().split())
        AB.append((A,B))
    AB.sort()
    coin = 0

    for i in range(N):
        temp = min(M,AB[i][1])
        coin += temp * AB[i][0]
        M -= temp
        if M==0:
            break


    print(coin) main
def main():
    N,M = map(int, input().split())
    AB = []
    for i in range(N):
        A,B =  map(int, input().split())
        AB.append((A,B))
    AB.sort()
    coin = 0

    for i in range(N):
        temp = min(M,AB[i][1])
        coin += temp * AB[i][0]
        M -= temp
        if M==0:
            break


    print(coin)


if __name__ == '__main__':
    main()

