import java.util.*;

public class C {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        long[] lengths = new long[n];
        long[] beauties = new long[n];
        List<Integer> indices = new ArrayList<>(n);

        for (int i = 0; i < n; i++) {
            lengths[i] = sc.nextInt();
            beauties[i] = sc.nextInt();
            indices.add(i);
        }

        indices.sort(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return -Long.compare(beauties[o1], beauties[o2]);
            }
        });

        // Result can be big, need long
        PriorityQueue<Long> curKBiggest = new PriorityQueue<>();

        long sum = 0;
        long best = 0;

        for (int i = 0; i < n; i++) {
            long cur = lengths[indices.get(i)];

            curKBiggest.add(cur);
            sum += cur;

            if (curKBiggest.size() > k) {
                sum -= curKBiggest.poll();
            }

            long thisBeauty = beauties[indices.get(i)];

            best = Math.max(best, thisBeauty * sum);
        }

        System.out.println(best);
    }
}
