import java.util.*;
import java.io.*;
 
public class Main {
	public static void main(String args[]) {new Main().run();}
	
	Scanner in = new Scanner(System.in);
	PrintWriter out = new PrintWriter(System.out);
	void run(){
	    out.println(work());
	    out.flush();
	}
	long work() {
	    int n=in.nextInt();
	    int k=in.nextInt();
	    
	    int[][] A=new int[n][2];
	    for(int i=0;i<n;i++){
	        int t=in.nextInt();
	        int b=in.nextInt();
	        A[i]=new int[]{t,b};
	    }
	    
	    PriorityQueue<Integer> pq=new PriorityQueue<Integer>();
	    Arrays.sort(A,new Comparator<int[]>(){
	        public int compare(int[] arr1,int[] arr2){
	            return arr2[1]-arr1[1];
	        }
	    });
	    long ret=0;
	    long sum=0;
	    for(int i=0;i<n;i++){
	        int cur=A[i][1];
	        if(pq.size()==k){
	            int num=pq.poll();
	            sum-=num;
	        }
	        sum+=A[i][0];
	        pq.add(A[i][0]);
	        ret=Math.max(ret,sum*cur);
	    }
	    return ret;
	}
}