import java.io.*;
import java.util.*;

public class Main {
    static class Pair implements Comparable<Pair> {
        int length, beauty;

        public Pair(int length, int beauty) {
            this.length = length;
            this.beauty = beauty;
        }

        @Override
        public int compareTo(Pair o) {
            return Integer.compare(beauty, o.beauty);
        }
    }
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt(), k = sc.nextInt();
        Pair[] pairs = new Pair[n];
        for (int i = 0; i < n; i++) {
            pairs[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        Arrays.sort(pairs);
        PriorityQueue<Integer> pq = new PriorityQueue<>();
        long best = 0;
        long sumInQueue = 0;
        for (int i = n - 1; i >= 0; i--) {
            sumInQueue += pairs[i].length;
            pq.add(pairs[i].length);
            while (pq.size() > k) {
                sumInQueue -= pq.poll();
            }
            best = Math.max(best, sumInQueue * pairs[i].beauty);
        }

        out.println(best);
        out.flush();
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}
