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

public class feb20 {

	public static void main(String[] srgs) throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String[] scn = (br.readLine()).trim().split(" ");
		int n = Integer.parseInt(scn[0]);
		int k = Integer.parseInt(scn[1]);
		pair[] arr = new pair[n];
		for (int i = 0; i < n; i++) {
			scn = br.readLine().trim().split(" ");
			arr[i] = new pair(Integer.parseInt(scn[0]), Integer.parseInt(scn[1]));
		}
		Arrays.sort(arr, (o1, o2) -> {
			return -Long.compare(o1.bea, o2.bea);
		});
		PriorityQueue<Long> pq = new PriorityQueue<>();

		long ans = 0;
		long sum = 0;
		for (int i = 0; i < k; i++) {
			pq.add(arr[i].len);
			sum += arr[i].len;
			ans = Math.max(ans, sum * arr[i].bea); 
		}
		for (int i = k; i < n; i++) {
			long rl = pq.poll();
			sum -= rl;
			rl = arr[i].len;
			sum += rl;
			pq.add(rl);
			ans = Math.max(ans, sum * (arr[i].bea));
		}

		System.out.println(ans);
		return;

	}

	static class pair {
		long len;
		long bea;

		pair(long a, long b) {
			len = a;
			bea = b;

		}

	}

	public static void sec() throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		StringBuilder sb = new StringBuilder();
		while (t-- > 0) {
			String[] scn = (br.readLine()).trim().split(" ");
			int n = Integer.parseInt(scn[0]);
			long[] arr = new long[n];
			scn = (br.readLine()).trim().split(" ");
			for (int i = 0; i < n; i++) {
				arr[i] = Long.parseLong(scn[i]);
			}
			sb.append("\n");
		}
		System.out.println(sb);
		return;

	}

	public static void third() throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String[] scn = (br.readLine()).trim().split(" ");
		int n = Integer.parseInt(scn[0]);
		long[] arr = new long[n];
		scn = (br.readLine()).trim().split(" ");
		for (int i = 0; i < n; i++) {
			arr[i] = Long.parseLong(scn[i]);
		}
		System.out.println(sb);
		return;

	}

	public static void sort(long[] arr) {
		int n = arr.length;
		for (int i = 0; i < n; i++) {
			int idx = (int) Math.random() * n;
			long temp = arr[i];
			arr[i] = arr[idx];
			arr[idx] = temp;
		}

		Arrays.sort(arr);
	}

	public static void sort(int[] arr) {
		int n = arr.length;
		for (int i = 0; i < n; i++) {
			int idx = (int) Math.random() * n;
			int temp = arr[i];
			arr[i] = arr[idx];
			arr[idx] = temp;
		}
		Arrays.sort(arr);
	}

	public static void print(long[][] dp) {
		for (long[] a : dp) {
			for (long ele : a) {
				System.out.print(ele + " ");
			}
			System.out.println();
		}
	}

	public static void print(int[][] dp) {
		for (int[] a : dp) {
			for (int ele : a) {
				System.out.print(ele + " ");
			}
			System.out.println();
		}
	}

	public static void print(boolean[] dp) {
		for (boolean ele : dp) {
			System.out.print(ele + " ");
		}
		System.out.println();
	}

	public static void print(int[] dp) {
		for (int ele : dp) {
			System.out.print(ele + " ");
		}
		System.out.println();
	}

	public static void print(long[] dp) {
		for (long ele : dp) {
			System.out.print(ele + " ");
		}
		System.out.println();
	}

	public static void debug() {
		System.out.println("working..");
	}

	public static void debug(int i) {
		System.out.println("working on " + i);
	}

}