import java.util.*;
public class div570{
	public static void main(String s[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		ArrayList<pair> al = new ArrayList<>();
		for(int i=0;i<n;i++){
			pair p = new pair();
			p.a=sc.nextLong();
			p.b=sc.nextLong();
			al.add(p);	
		}
		Collections.sort(al, new comp());
		long sum=0;
		PriorityQueue<Long> pr = new PriorityQueue<>();
		long max = Long.MIN_VALUE;
		for(int i=0;i<n;i++){
			long temp = 0;
			pair p = al.get(i);
			if(pr.size()==k){
				temp = pr.poll();
			}
			sum-=temp;
			sum+=p.a;
			long store = sum*p.b;
			max = Math.max(store,max);
			pr.add(p.a);
		}
		System.out.println(max);
	}
	
	public static class pair{
		long a;
		long b;
	}
	
	public static class comp implements Comparator<pair>{
		public int compare(pair o1, pair o2){
			return Long.valueOf(o2.b).compareTo(Long.valueOf(o1.b));
		}
	}
}