import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        ArrayList<int[]> list = new ArrayList<int[]>();
        for (int i=0;i<n;i++) {
            int t = sc.nextInt();
            int b = sc.nextInt();
            int[] add = {t, b};
            list.add(add);
        }
        Collections.sort(list, (o1, o2)->Integer.compare(o2[0], o1[0]));
        Collections.sort(list, (o1, o2)->Integer.compare(o2[1], o1[1]));
        long len = 0L;
        long ans = 0L;
        PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
        for (int[] tmp : list) {
            pq.add(tmp[0]);
            len+=tmp[0];
            if (pq.size()>k) {
                int val = pq.poll();
                len-=val;
            }
            ans = Math.max(ans, len*tmp[1]);
        }
        System.out.println(ans);
    }
}