import java.util.*;
import java.io.*;

public class TaskC {
    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];
            }
        });
//        System.out.println(Arrays.deepToString(songs));
        PriorityQueue<Integer> lengths = new PriorityQueue<>();
        long pleasure = 0, length = 0;
        for (int i = n-1; i >= 0; i--) {
            lengths.add(songs[i][0]);
            length += songs[i][0];
            if (lengths.size() > k) {
                int l = lengths.poll(); length -= l;
            }
            pleasure = Math.max(pleasure, songs[i][1] * length);
        }
        System.out.println(pleasure);
    }
}
