

import java.io.BufferedReader;


import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.util.TreeSet;



public class C implements Runnable
{

	static BufferedReader br = null;
	static PrintWriter pw = null;
	static StringTokenizer stk = new StringTokenizer("");

	public static void main(String[] args)
	{
		try
		{
			//br = new BufferedReader(new FileReader("input.txt"));
			//pw = new PrintWriter("output.txt");
			br = new BufferedReader(new InputStreamReader(System.in));
			pw = new PrintWriter(new OutputStreamWriter(System.out));
			
		} catch (Exception e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		(new Thread(new C())).start();
	}

	public void nline()
	{
		try
		{
			stk = new StringTokenizer(br.readLine());
		} catch (IOException e)
		{
			e.printStackTrace();
		}
	}

	public int ni()
	{
		while (!stk.hasMoreTokens())
			nline();
		return Integer.valueOf(stk.nextToken());
	}

	public double nd()
	{
		while (!stk.hasMoreTokens())
			nline();
		return Double.valueOf(stk.nextToken());
	}

	public String nwrd()
	{
		while (!stk.hasMoreTokens())
			nline();
		return stk.nextToken();
	}

	public long nl()
	{
		while (!stk.hasMoreTokens())
			nline();
		return Long.valueOf(stk.nextToken());
	}

	public BigInteger nbi()
	{
		while (!stk.hasMoreTokens())
			nline();
		return new BigInteger(stk.nextToken());
	}

	public char nc()
	{
		while (!stk.hasMoreTokens())
			nline();
		return stk.nextToken().charAt(0);
	}

	public boolean isready()
	{
		try
		{
			return br.ready();
		} catch (IOException e)
		{
			return false;
		}
	}

	String rline()
	{
		try
		{
			return br.readLine();
		} catch (IOException e)
		{
			e.printStackTrace();
		}
		return null;
	}

	public void run()
	{
		solve();
		pw.close();
	}
	public class Hero {
		public long max_health;
		public long regen;
		public Hero(long h, long regen) {
			// TODO Auto-generated constructor stub
			max_health = h;
			this.regen = regen;
		}
	}
	public class Pair implements Comparable<Pair>{
		public long a;
		public long b;
		public Pair( int a , int b) {
			// TODO Auto-generated constructor stub
			this.a = a;
			this.b = b;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if	( o.b - b == 0)
				return (int) (a - o.a);
			return (int) (o.b - b);

		}
		public  String toString() {
			return a + " " + b;
		}
		
	}
	
	
	

	public void solve()
	{
		int	n = ni();
		int k = ni();
		ArrayList<Pair> pairs = new ArrayList<>(n);
		for( int i =0; i < n; i++ )
			pairs.add(new Pair(ni(), ni()));
		Collections.sort(pairs);
		TreeSet<Long> bestLens = new TreeSet<>();
		long allLenBest = 0;
		long res = 0;
		for(int i =0; i<n; i++)
		{
			Pair curPair = pairs.get(i);
			if (bestLens.size() == k) {
				if (bestLens.first() >= curPair.a)
					continue;
				else
				{
					allLenBest -= bestLens.pollFirst();
				}
			}
			bestLens.add(curPair.a);
			allLenBest += curPair.a;
			
			if(res < allLenBest * curPair.b )
				res = allLenBest * curPair.b;
			
		}
		pw.println(res);
		
		
				
	}

}