

import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class CCCC {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int	k=scan.nextInt();
		pair[] S=new pair[n];
		
		for(int i=0;i<n;i++)
		{
			int a=scan.nextInt();
			int b=scan.nextInt();
			S[i]=new pair(b,a);
		}
		Arrays.sort(S,new compare());
		PriorityQueue<Integer> queue=new PriorityQueue<Integer>();
		long sum=0,ans=0;
		for(int i=n-1;i>=0;i--)
		{
			sum+=S[i].length;
			queue.add(S[i].length);
			if(queue.size()>k)
			{
				sum-=queue.poll();
				
			}
			ans=Math.max(ans,sum*S[i].cost);
		}
		System.out.println(ans);
	}
}class pair{
	int cost;
	int length;
	pair(int a,int b)
	{
		cost=a;
		length=b;
	}
}
 class compare implements Comparator<pair>
{

	@Override
	public int compare(pair o1, pair o2) {
		if(o1.cost>o2.cost)
		{
			return 1;
		}else if(o2.cost>o1.cost)
		{
			return -1;
		}else
		{
			return 0;
		}
	}
	
}
