import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Comparator;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            Pair[] list = new Pair[n];
            for (int i = 0; i < n; i++) {
                Pair a = new Pair();
                a.first = in.nextInt();
                a.last = in.nextInt();
                list[i] = a;
            }
            Arrays.sort(list, new Comparator<Pair>() {

                public int compare(Pair o1, Pair o2) {
                    return o1.last - o2.last;
                }
            });
            PriorityQueue<Pair> knapsack = new PriorityQueue<>(new Comparator<Pair>() {

                public int compare(Pair o1, Pair o2) {
                    return o1.first - o2.first;
                }
            });
            long max = 0;
            long knapsackSum = 0;

            for (int i = n - 1; i >= 0; i--) {
                if (knapsack.size() > k - 1) {
                    knapsackSum = knapsackSum - knapsack.poll().first;
                }
                knapsack.add(list[i]);
                knapsackSum = knapsackSum + list[i].first;
                long config = 0;
                config = knapsackSum * list[i].last;

                max = Math.max(config, max);
            }
            out.println(max);

        }

        class Pair {
            int first;
            int last;

        }

    }
}

