import java.io.*;
import java.util.*;
public class Main
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
		int k=sc.nextInt();
		long t[]=new long[n];
		long b[]=new long[n];
		Pair c[]=new Pair[n];
		for( int i=0;i<n;i++ )
		{
			t[i]=sc.nextLong();
			b[i]=sc.nextLong();
			c[i]=new Pair(t[i],b[i]);
		}
		Arrays.sort(c,new Comparator<Pair>(){
			public int compare(Pair a, Pair b)
			{
				if(a.y>b.y)
					return -1;
				if(a.y < b.y)
					return 1;
				return 0;
		}});
			/*for( int i=0;i<n;i++)
			{
				System.out.println(c[i].x+" "+c[i].y);
			}*/
			PriorityQueue<Long> pq=new PriorityQueue<>();
			long sum=0;long max=Long.MIN_VALUE;
			for( int i=0;i<n;i++)
			{
				long rem=0;
				if(pq.size()<=k)
				{
					pq.add(c[i].x);
					sum+=c[i].x;
					max=Math.max((sum-rem)*c[i].y,max);
					
				}
				else
				{
					rem=pq.poll();
				}
			}
			System.out.println(max);
					
					
				
					
			
				
		
		
	}
}
class Pair
{
	long x,y;
	Pair( long a , long b)
	{
		this.x=a;
		this.y=b;
	}
}
