import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;

public class Main {
	private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	private static class Song implements Comparable<Song> {
		int l;
		int b;
		public Song(int l, int b) {
			super();
			this.l = l;
			this.b = b;
		}
		@Override
		public int compareTo(Song other) {
			// TODO Auto-generated method stub
			return Integer.compare(this.b, other.b);
		}
		
	}
	public static void main(String[] args) throws NumberFormatException, IOException {
		String[] s = br.readLine().trim().split(" ");
		int n = Integer.parseInt(s[0]);
		int k = Integer.parseInt(s[1]);
		Song a[] = new Song[n];
		for(int i = 0; i < n; i++) {
			s = br.readLine().trim().split(" ");
			int l = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[1]);
			a[i] = new Song(l, b);
		}
		Arrays.sort(a);
		PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
		long sum = 0, ans = 0;
		for(int i = n-1; i >= 0; i--) {
			int l = a[i].l;
			int b = a[i].b;
			if(pq.size() < k || l > pq.peek()) {
				pq.add(l);
				sum += l;
				if(pq.size() > k) {
					int t = pq.poll();
					sum -= t;
				}
			}
			if(ans < sum*b) {
				ans = sum*b;
			}
		}
		System.out.println(ans);
	}
}