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

public class GFG {
    
    static class Pair {
        int l;
        int b;
        
        public Pair(int l1, int b1){
            l = l1;
            b = b1;
        }
    }
    static class beautyComparator implements Comparator<Pair>{
        
        public int compare(Pair p1, Pair p2){
            if(p1.b != p2.b)
                return p2.b - p1.b;
            return p2.l - p1.l;
        }
    }
    
    static class lengthComparator implements Comparator<Pair>{
        
        public int compare(Pair p1, Pair p2){
            if(p1.l != p2.l)
                return p1.l - p2.l;
            return p2.b - p1.b;
        }
    }
    
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		Pair[] A = new Pair[n];
		for(int i=0;i<n;i++){
		    int l = sc.nextInt();
		    int b = sc.nextInt();
		    A[i] = new Pair(l,b);
		}
		Arrays.sort(A,new beautyComparator());
		long len = 0, prod = -1, temp = -1;
		TreeSet<Pair> ts = new TreeSet<Pair>(new lengthComparator());
		for(int i = 0; i < n; i++){
		   len += A[i].l;
		   while(ts.size() > (k-1)){
		       len -= ts.pollFirst().l;
		   }
		   ts.add(new Pair(A[i].l,i));
		   prod = Math.max(prod, len * A[i].b);
		   //System.out.println(len * A[i].b);
		}
		
		System.out.println(prod);
	}
}