                                                                                                    
                                                                                                                        
                                                                                                                        
import java.util.ArrayList;                                                                                             
import java.util.Arrays;                                                                                                
import java.util.Collections;                                                                                           
import java.util.Comparator;                                                                                            
import java.util.PriorityQueue;                                                                                         
import java.util.Scanner;                                                                                               
                                                                                                                        
public class Main {                                                                                                     
	public static void main(String args[]) {                                                                            
		Scanner sc = new Scanner(System.in);                                                                            
		int n,k;                                                                                                        
		n=sc.nextInt();                                                                                                 
		k=sc.nextInt();                                                                                                 
		PriorityQueue<Long> pq= new PriorityQueue<Long>(k+1);                                                           
		                                                                                                                
		long arr[][]=new long[n][2];                                                                                    
		for(int i=0;i<n;i++) {                                                                                          
			arr[i][0]=sc.nextLong();                                                                                    
			arr[i][1]=sc.nextLong();                                                                                    
		}                                                                                                               
		Arrays.sort(arr,(a,b)->(Long.compare(a[1], b[1])));                                                             
		pq.add(arr[n-1][0]);                                                                                            
		long ans = arr[n-1][0]*arr[n-1][1];                                                                             
		long previousP = arr[n-1][0];                                                                                   
		for(int i=n-2;i>=0;i--) {                                                                                       
			if(pq.peek()<arr[i][0]&&pq.size()==k) {                                                                     
				long temp =0;                                                                                           
				long rem=0;                                                                                             
				if(pq.size()==k) {                                                                                      
				 rem = pq.remove();                                                                                     
				pq.add(arr[i][0]);                                                                                      
				temp = arr[i][1]*((previousP-rem+arr[i][0]));                                                           
				}else {                                                                                                 
					pq.add(arr[i][0]);                                                                                  
					temp = arr[i][1]*((previousP)*arr[i][0]);                                                           
				}                                                                                                       
				                                                                                                        
				if(temp >ans) {                                                                                         
					ans=temp;                                                                                           
				}                                                                                                       
				previousP= ((previousP-rem+arr[i][0]));	                                                                
			}else if(pq.size()<k){                                                                                      
				long temp=0;                                                                                            
				                                                                                                        
					pq.add(arr[i][0]);                                                                                  
					temp = arr[i][1]*((previousP+arr[i][0]));                                                           
			                                                                                                            
				                                                                                                        
				if(temp >ans) {                                                                                         
					ans=temp;                                                                                           
				}                                                                                                       
				previousP= ((previousP+arr[i][0]));	                                                                    
				                                                                                                        
				                                                                                                        
			}                                                                                                           
			                                                                                                            
		}                                                                                                               
		System.out.println(ans);                                                                                        
	}                                                                                                                   
}                                                                                                                       
                                                                                                                        