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

public class Playlist {
	static BufferedReader br;
	static StringTokenizer tokenizer;

	public static void main(String[] args) throws Exception {
		br = new BufferedReader(new InputStreamReader(System.in));
		int n = nextInt();
		int k = nextInt();
		Song[] playList = new Song[n];
		for(int i = 0; i < n; i++)
			playList[i] = new Song(nextInt(), nextInt(), i);
		Arrays.sort(playList, null);
		PriorityQueue<Song> minL = new PriorityQueue<Song>(new Comparator<Song>() {
			public int compare(Song o1, Song o2) {return o1.l - o2.l;}});
		TreeSet<Song> minB = new TreeSet<Song>();
		long sum = 0;
		int B = 0;
		long max = 0;
		for(int i = n - 1; i >= 0; i--) {
			while(minL.size() > k) {
				Song s = minL.poll();
				minB.remove(s);
				sum -= s.l;
				B = minB.first().b;
			}
			max = Math.max(max, sum * B);
			minL.add(playList[i]);
			minB.add(playList[i]);
			sum += playList[i].l;
			B = playList[i].b;
		}
		while(minL.size() > k) {
			Song s = minL.poll();
			minB.remove(s);
			sum -= s.l;
			B = minB.first().b;
		}
		max = Math.max(max, sum * B);
		System.out.println(max);
	}

	public static String next() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null)
				throw new IOException();
			tokenizer = new StringTokenizer(line);
		}
		return tokenizer.nextToken();
	}

	public static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}
}
class Song implements Comparable<Song> {
	int l, b, ID;

	public Song(int l, int b, int ID) {
		super();
		this.l = l;
		this.b = b;
		this.ID = ID;
	}

	@Override
	public int compareTo(Song o) {
		if(b != o.b)
			return b - o.b;
		return ID - o.ID;
	}
	@Override
	public String toString() {
		return l + " " + b;
	}
	
}