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


public class asitis
{

	

	static OutputStream outputStream = System.out;
	static PrintWriter out = new PrintWriter(outputStream);

	static class node implements Comparable<node>
	{
		int t;int b;

		node(int i,int o)
		{
			t=i;b=o;
		}
		public int compareTo(node n)
		{
			if(this.b!=n.b) return n.b-this.b;


			return n.t-this.t;
		}
	}

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

			String[] s=br.readLine().split(" ");

			int n=Integer.parseInt(s[0]),k=Integer.parseInt(s[1]);k--;

			node[] a=new node[n];

			for(int i=0;i<n;i++)
			{
				s=br.readLine().split(" ");
				a[i]=new node(Integer.parseInt(s[0]),Integer.parseInt(s[1]));
			}

			Arrays.sort(a);

			if(k==0)
			{
				long t=0;

				for(int i=0;i<n;i++)
				{
					long h=a[i].t;h*=a[i].b;
					t=Math.max(t,h);
				}
				out.println(t);
				out.close();
				System.exit(0);
			}

			PriorityQueue<Integer> pq=new PriorityQueue<Integer>();


			long tot=0;
			long sum=0;
			


			for(int i=0;i<n;i++)
			{
				long temp=sum;
				temp+=a[i].t;

				temp*=a[i].b;

				tot=Math.max(temp,tot);

				if(pq.size()<k)
				{
					pq.add(a[i].t);
					sum+=a[i].t;
				}
				else
				{
					if(a[i].t>pq.peek())
					{
						sum-=(pq.poll());
						sum+=a[i].t;
						pq.add(a[i].t);
					}
				}
			}

			out.println(tot);


			out.close();

	}
}