import java.awt.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Abc {
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        int n=sc.nextInt();
        int k=sc.nextInt();
        Point p[]=new Point[n];
        long ans=0;
        for (int i=0;i<n;i++){
            int t=sc.nextInt(),b=sc.nextInt();
            p[i]=new Point(b,t);
        }
        Arrays.sort(p, new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                return o1.x-o2.x;
            }
        });
        long sum=0;
        PriorityQueue<Integer> pq=new PriorityQueue<>();
        for (int i=n-1;i>=0;i--){
//            System.out.println(p[i].x+" "+p[i].y);
            sum+=p[i].y;
            if (pq.size()==k){
                long fl=pq.poll();
                sum-=fl;
            }
            pq.add(p[i].y);
            ans=Math.max((long) p[i].x*sum,ans);
        }
        System.out.println(ans);
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}