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

/* Name of the class has to be "Main" only if the class is public. */
public  class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		aksh[] a=new aksh[n];
		for(int i=0;i<n;i++)
		{
			int x=sc.nextInt();
			int y=sc.nextInt();
			a[i]=new aksh(x,y,i);
		}
		Arrays.sort(a);
		//for(int i=0;i<n;i++)
		//{
		//	System.out.println(a[i].length+" "+a[i].beauty);
		//}
		long sum=0;
        long ans=0;
		PriorityQueue<Integer> p=new PriorityQueue<>();
		for(int i=n-1;i>=0;i--)
		{
			sum+=a[i].length;
			p.add(a[i].length);
			if(p.size()>k)
			{
				sum-=p.remove();
			
			}
		ans=Math.max(ans,sum*a[i].beauty);	
		}
		System.out.println(ans);
	}
}

class aksh implements Comparable<aksh>
{
	int length;
	int beauty;
	int index;
	
	public aksh(int p,int q,int i)
	{
		length=p;
		beauty=q;
		index=i;
	}
	
	public int compareTo(aksh other)
        {
            if (beauty == other.beauty)
            {
                if (length == other.length)
                {
                    return Integer.compare(index, other.index);
                }
                return Long.compare(length, other.length);
            }
            return Long.compare(beauty, other.beauty);
        }


}