import java.util.*;
import java.util.function.IntConsumer;
import java.util.function.ToIntFunction;
import java.util.stream.IntStream;

import static java.lang.Long.max;
import static java.lang.Math.min;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[][] arr = new int[n][2];
        for (int i = 0; i < n; i++) {
            arr[i][0] = scanner.nextInt() ;
            arr[i][1] = scanner.nextInt();
        }
        Arrays.sort(arr, new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                return o1[1] - o2[1];
            }
        });
        long su = 0;
        long res = -1;
        PriorityQueue<Integer> h = new PriorityQueue<>();
        for (int i = n - 1; i >= 0; i--) {
            h.add(arr[i][0]);
            su += arr[i][0];
            if (h.size() > k) {
                su -= h.poll();
            }
            res = max(res, su * arr[i][1]);
        }
        System.out.println(res);
    }
}


