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

public class PlayList {

	public static void main(String[] args) throws Exception{
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st = new StringTokenizer(f.readLine());
		int n =  Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());
		
		Pair[] songs = new Pair[n];
		
		for(int i = 0; i < n; i ++) {
			st = new StringTokenizer(f.readLine());
		    long l = Long.parseLong(st.nextToken());
			long b = Long.parseLong(st.nextToken());
			songs[i] = new Pair(l,b);
		}
		
		Arrays.sort(songs);
		
		TreeMap<Long,Integer> tm = new TreeMap<Long,Integer>();
		long maxLength = 0;
		long ans = 0;
		for(int i = 0; i < n; i++) {
			ans = Math.max(ans, (maxLength + songs[i].x)*songs[i].y);
			
			if(i < k-1) {
				if(tm.containsKey((songs[i].x))){
					tm.put(songs[i].x, tm.get(songs[i].x)+1);
				}
				else {
					tm.put(songs[i].x, 1);
				}
				maxLength += songs[i].x;
			}
			else {
				if(songs[i].x > tm.firstKey()) {
					maxLength += songs[i].x - tm.firstKey();
					if(tm.get(tm.firstKey()) == 1) {
						tm.remove(tm.firstKey());
						tm.put(songs[i].x, 1);
					}
					else {
						tm.put(tm.firstKey(),tm.get(tm.firstKey()) - 1);
						tm.put(songs[i].x,	1);
					}
				
				}
			}
		}
		
		System.out.println(ans);
	}
	
	static class Pair implements Comparable<Pair>{
		long x;
		long y;
		Pair(long x, long y) {
			this.x = x;
			this.y = y;
		}
		@Override
		public int compareTo(Pair arg0) {
			if(y == arg0.y) {
		         return (x > arg0.x) ? -1 : 1;
			}
			else{
				return (y > arg0.y) ? -1: 1;
			}
		}
		
	}

}
