import java.util.*;

public class Main {
	static class Pair {
		int amount, nutrition;

		Pair(int amount, int nutrition) {
			this.amount = amount;
			this.nutrition = nutrition;
		}
	}

	
	public static void main(String args[]) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int k = s.nextInt();
		Pair array[] = new Pair[n];
		for (int i = 0; i < n; i++)
			array[i] = new Pair(s.nextInt(), s.nextInt());
		
		Arrays.sort(array, (p, b) -> (b.nutrition - p.nutrition));
        
		long max = Long.MIN_VALUE, sum = 0;
		PriorityQueue<Integer> pq = new PriorityQueue<>();
		for (int i = 0; i < n; i++) {
			sum += array[i].amount;
			pq.add(array[i].amount);
			while (pq.size() > k)
				sum -= pq.remove();
         //  System.out.println(sum+"   "+array[i].nutrition);
			max = Math.max(max, sum * array[i].nutrition);
		}

		System.out.print(max);
		s.close();
	}
}


