//package ContestEd62;
///package ContestEd62;

import javafx.util.Pair;

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;
/*
5 5
1 10000000
2 3
4 5
5 5
6 7
 */
public class mainC {
    public static Scanner enter = new Scanner(System.in);
    public static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n=enter.nextInt();
        int k=enter.nextInt();
        Pair<Integer,Integer> mass[]=new Pair[n];
        for (int i = 0; i <mass.length; i++) {
            mass[i]=new Pair<>(enter.nextInt(),enter.nextInt());
        }
        Arrays.sort(mass,(a,b)->Integer.compare(a.getValue(),b.getValue()));
        PriorityQueue<Integer> pq =new PriorityQueue<>((a,b)->Integer.compare(a,b));
        //System.out.println(Arrays.toString(mass));
        //Value - красота *
        //Key -Длина +
        long[] dp=new long[n];
        long[] arr=new long[n];
        arr[n-1]=mass[n-1].getKey();
        dp[n-1]=(long)mass[n-1].getValue()*mass[n-1].getKey();
        int used=1;
        int nice=mass[n-1].getValue();
        int min_length=mass[n-1].getKey();
        pq.add(min_length);
        for (int i = n-2,j=1; i >=0 ; i--,j++) {
            if(j<k){
                arr[i]=arr[i+1]+mass[i].getKey();
                pq.add(mass[i].getKey());
            }
            else{
                int h=pq.poll();
                arr[i]=arr[i+1]-h;
                arr[i]+=mass[i].getKey();
                pq.add(mass[i].getKey());
            }
            dp[i]=(long)(mass[i].getValue())*arr[i];

        }
        //System.out.println(Arrays.toString(dp));
        long max=Long.MIN_VALUE;
        for (int i = 0; i <n ; i++) {
            max=Math.max(max,dp[i]);
        }
        System.out.println(max);
        // System.out.println(Arrays.toString(mass));

    }
}