import sys

input = sys.stdin.readline

def main():
    ans = 0
    n, m = map(int, input().split())
    all = []
    for i in range(n):
        all.append(list(map(int, input().split())))
    all.sort()
    for i in range(n):
        if m >= all[i][1]:
            m -= all[i][1]
            ans += all[i][0]*all[i][1]
        else:
            ans += all[i][0]*(m)
            break
    print(ans)

if __name__ == '__main__':
    main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def main():
    ans = 0
    n, m = map(int, input().split())
    all = []
    for i in range(n):
        all.append(list(map(int, input().split())))
    all.sort()
    for i in range(n):
        if m >= all[i][1]:
            m -= all[i][1]
            ans += all[i][0]*all[i][1]
        else:
            ans += all[i][0]*(m)
            break
    print(ans) main ans = 0 ans 0 n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m all = [] all [] for i in range(n):
        all.append(list(map(int, input().split())))
     i range(n) range n all.append(list(map(int, input().split()))) all.append all append list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split all.sort() all.sort all sort for i in range(n):
        if m >= all[i][1]:
            m -= all[i][1]
            ans += all[i][0]*all[i][1]
        else:
            ans += all[i][0]*(m)
            break
     i range(n) range n if m >= all[i][1]:
            m -= all[i][1]
            ans += all[i][0]*all[i][1]
        else:
            ans += all[i][0]*(m)
            break
     m >= all[i][1] m all[i][1] [i] all i 1 m -= all[i][1] m all[i][1] [i] all i 1 ans += all[i][0]*all[i][1] ans all[i][0]*all[i][1] all[i][0] [i] all i 0 all[i][1] [i] all i 1 ans += all[i][0]*(m) ans all[i][0]*(m) all[i][0] [i] all i 0 m break print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    ans = 0
    n, m = map(int, input().split())
    all = []
    for i in range(n):
        all.append(list(map(int, input().split())))
    all.sort()
    for i in range(n):
        if m >= all[i][1]:
            m -= all[i][1]
            ans += all[i][0]*all[i][1]
        else:
            ans += all[i][0]*(m)
            break
    print(ans) def main():
    ans = 0
    n, m = map(int, input().split())
    all = []
    for i in range(n):
        all.append(list(map(int, input().split())))
    all.sort()
    for i in range(n):
        if m >= all[i][1]:
            m -= all[i][1]
            ans += all[i][0]*all[i][1]
        else:
            ans += all[i][0]*(m)
            break
    print(ans) main input = sys.stdin.readline sys.stdin.readline input
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n, m = map(int, input().split())
    all = []
    for i in range(n):
        all.append(list(map(int, input().split())))
    all.sort()
    for i in range(n):
        if m >= all[i][1]:
            m -= all[i][1]
            ans += all[i][0]*all[i][1]
        else:
            ans += all[i][0]*(m)
            break
    print(ans)

if __name__ == '__main__':
    main()