import java.io.*;
import java.util.*;
public class Solution {
	static class FastReader {
        BufferedReader br; 
        StringTokenizer st; 
        public FastReader() {
        	boolean env=System.getProperty("ONLINE_JUDGE") != null;
        	if(!env) {
        		try {
					br=new BufferedReader(new FileReader("src\\input.txt"));
				} catch (FileNotFoundException e) {
					e.printStackTrace();
				}
        	}
        	else 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; 
        } 
    }
	static FastReader sc=new FastReader();
	static PrintWriter out=new PrintWriter(System.out);
	//debug
	static void debug(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
	//pair
	static class pair{
		long x,y;
		pair(long a,long b){
			x=a;
			y=b;
		}
	}
	//Main
	public static void main(String args[]) {
		int test=1;
		//test=sc.nextInt();
		while(test-->0) {
			//Think before code, it won't hurt
			int n=sc.nextInt(),k=sc.nextInt();
			pair a[]=new pair[n];
			PriorityQueue<Long> q=new PriorityQueue<>();
			for(int i=0;i<n;i++) a[i]=new pair(sc.nextLong(),sc.nextLong());
			Arrays.parallelSort(a,(p1,p2)->(int)(p1.y-p2.y));
			long sum=0,ans=0;
			for(int i=n-1,j=1;i>=0;i--,j++) {
				ans=Math.max(ans,(sum+a[i].x)*a[i].y);
				if(j<k) {
					sum+=a[i].x;
					q.add(a[i].x);
				}
				else if(!q.isEmpty() && a[i].x>q.peek()) {
					sum-=q.poll();
					sum+=a[i].x;
					q.add(a[i].x);
				}
			}
			out.println(ans);
		}
		out.flush();
		out.close();
	}
}
