import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author macbookpro
 */
public class C1140 {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken()), k = Integer.parseInt(st.nextToken());
        int[][] songs = new int[n][2];
       
        for( int i =0; i<n; i++)
        {  st = new StringTokenizer(f.readLine());
            songs[i][0]= Integer.parseInt(st.nextToken());
            songs[i][1]= Integer.parseInt(st.nextToken());
            
            
        }
        
        Arrays.sort(songs, new Comparator<int[]>(){
            @Override
            public int compare(int[] o1, int[] o2) {
               
                
                return o1[1]-o2[1];}
        
        
        
    });
        PriorityQueue<Integer> lengths= new PriorityQueue<>();
        long sum =0;
        long pleasure=0;
        for(int i =n-1; i>=0; i--)
        {
           lengths.add(songs[i][0]);
           sum+=songs[i][0];
           if(lengths.size()>k)
           {
               int l= lengths.poll();
               sum-=l;
               
           }
          pleasure= Math.max(pleasure, sum*songs[i][1]);
           
           
        }
        System.out.println(pleasure);  
    }
 
}
