import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Solution {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());

		int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());

		Point[] points = new Point[n];
		for (int i = 0; i < n; i++) {
			st = new StringTokenizer(br.readLine());
			int t = Integer.parseInt(st.nextToken());
			int b = Integer.parseInt(st.nextToken());
			points[i] = new Point(t, b);
		}
		Arrays.sort(points);

		Heap h = new Heap(n);
		long[] sum = new long[n];
		for (int i = 0; i < k - 1; i++) {
			sum[n - 1 - i] = h.getSum();
			h.add(points[n - 1 - i].t);
		}

		sum[n - k] = h.getSum();
		for (int i = 1; i < n - k + 1; i++) {
			sum[n - k - i] = h.replaceWithMin(points[n - k - i + 1].t);
		}

		long max = -1l;
		for (int i = 0; i < n; i++) {
			max = Math.max(max, (sum[i] + points[i].t) * points[i].b);
		}

		System.out.println(max);

	}
}

class Point implements Comparable<Point> {
	int t, b;

	Point(int t, int b) {
		this.t = t;
		this.b = b;
	}

	@Override
	public int compareTo(Point o) {
		return this.b - o.b;
	}

	@Override
	public String toString() {
		return "Point [t=" + t + ", b=" + b + "]";
	}

}

class Heap {
	int size;
	int[] a;
	long sum = 0;

	Heap(int n) {
		size = 0;
		a = new int[n + 10];
	}

	public long getSum() {
		return sum;
	}

	void add(int t) {
		sum += t;
		int in = ++size;
		a[in] = t;

		while (in > 0) {
			int par = in / 2;
			if (a[par] > a[in]) {
				int temp = a[in];
				a[in] = a[par];
				a[par] = temp;
			}
			in = par;
		}
	}

	int getMin() {
		return a[1];
	}

	long replaceWithMin(int t) {

		if (t <= a[0]) {
			return sum;
		}
		sum = sum - a[1] + t;
		a[1] = t;
		int in = 1;
		while (in <= size) {
			int left = 2 * in;
			int right = 2 * in + 1;

			if (left <= size) {
				if (right <= size) {

					if (a[left] <= a[right]) {
						if (a[in] > a[left]) {
							int temp = a[left];
							a[left] = a[in];
							a[in] = temp;
							in = left;
							continue;
						} else {
							return sum;
						}
					} else {
						if (a[in] > a[right]) {
							int temp = a[right];
							a[right] = a[in];
							a[in] = temp;
							in = right;
							continue;
						} else {
							return sum;
						}
					}
				} else {

					if (a[in] > a[left]) {
						int temp = a[left];
						a[left] = a[in];
						a[in] = temp;
						in = left;
					} else {
						return sum;
					}
				}
			} else {
				return sum;
			}
		}
		return sum;
	}
}