
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.function.Supplier;
import java.util.*;

public class Playlist {
    static Supplier<InputStream> inputSupplier = () -> System.in;
    static Supplier<PrintWriter> outSupplier = () -> new PrintWriter(System.out);
    static class P {
        public int x, y;
        public P(int x, int y) {this.x=x;this.y=y;}
        public int getX() {return x;} public int getY() {return y;}
    }

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(inputSupplier.get());
        PrintWriter out = outSupplier.get();
        int n = sc.nextInt();
        int k = sc.nextInt();
        P[] p = new P[n];
        for (int i = 0; i < n; i++) {
            p[i] = new P(sc.nextInt(), sc.nextInt());
        }
        Arrays.sort(p, Comparator.comparingInt(P::getY));

        PriorityQueue<P> pq = new PriorityQueue<>(Comparator.comparingInt(P::getX));

        long sum = 0;
        long max = 0;
        int b = 0;
        for (int i = n-1; i >=0 ; i--) {
            P curr = p[i];
            if (pq.size() == k) {
                P inq = pq.peek();
                if(inq.getX()<curr.getX()) {
                    P deleted = pq.poll();
                    pq.offer(curr);
                    sum += (long)curr.getX();
                    sum -= (long)deleted.getX();
                    b = curr.getY();
                }
            } else {
                pq.offer(curr);
                sum += (long)curr.getX();
                b = curr.getY();
            }
            max = Math.max(max, sum*b);
        }

        out.println(max);

        sc.close();
        out.close();
    }
}
