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

public class playlist {
	public void run() throws Exception {
		FastReader file = new FastReader();
		int times = file.nextInt();
		int k = file.nextInt();
		ArrayList<Pair> a = new ArrayList(), b = new ArrayList();
		for (int i = 0; i < times; i++) {
			long t = file.nextLong(), c = file.nextLong();
			a.add(new Pair(t, c)); b.add(new Pair(c, t)); 
		}
		Collections.sort(a); Collections.sort(b);
		long max = Integer.MIN_VALUE, minb = Integer.MAX_VALUE;
		long cur = 0l;
		for (int i = 0; i < k; i++) {
			cur += a.get(i).x;
			minb = Math.min(minb, a.get(i).y);
			max = Math.max(max, cur * minb);
		}
		long max2 = Integer.MIN_VALUE, minb2 = Integer.MAX_VALUE;
		long cur2 = 0l;
		for (int i = 0; i < k; i++) {
			cur2 += b.get(i).y;
			minb2 = Math.min(minb2, b.get(i).x);
			max2 = Math.max(max2, cur2 * minb2);
		}
		System.out.println(Math.max(max2, max));
	}
	static class Pair implements Comparable<Pair> {
		long x; long y;
		public Pair(long x, long y) {
			this.x = x;
			this.y = y;
		}
		public int compareTo(Pair o) {
			if (o.x == x) return Long.compare(o.y, y);
			return Long.compare(o.x, x);
		}
	}
	public static void main(String[] args) throws Exception {
		new playlist().run();
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}
