import java.util.*;
import java.math.*;
import java.io.*;
 public class Solution {
	 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; 
	        } 
	    }
	  
  public static void main(String [] args) {
	FastReader ip=new FastReader();
	int n=ip.nextInt();
	int k=ip.nextInt();
	int arr[][]=new int[n][2];
	for(int i=0;i<n;i++) {
		arr[i][0]=ip.nextInt();
		arr[i][1]=ip.nextInt();
	}
	Arrays.sort(arr, new Comparator<int[]>() {
        @Override
        public int compare(int[] o1, int[] o2) {
            return o1[1] - o2[1];
        }
    });
	
	int len=0;
	long sum=0;
	long max=0;
	PriorityQueue<Integer> pq=new PriorityQueue<>();
	for(int i=n-1;i>=0;i--) {
		if(len<k) {
			sum+=arr[i][0];
			long ans=sum*arr[i][1];
			if(ans>max) {
				max=ans;
			}
			pq.add(arr[i][0]);
			len++;
		}else {
			sum-=pq.poll();
			sum+=arr[i][0];
			long ans=sum*arr[i][1];
			if(ans>max) {
				max=ans;
			}
			pq.add(arr[i][0]);
		}
	}
	System.out.println(max);
	
  }
}