import java.util.*;
import java.io.*;
import static java.lang.System.in;

public class Main {
    static int n,k;
    static long mod = 1000000000+7;
    static long[] fac,inv;
    static int[] id,size;
    //static long mod = 1000000000+7;
    //static HashSet<Integer>[] graph;
    public static void main(String[] args)throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] buf = reader.readLine().split(" ");
        //Scanner sc = new Scanner(System.in);
        n = Integer.parseInt(buf[0]); k = Integer.parseInt(buf[1]);
        long[][] tb = new long[n][2];
        for(int i=0;i<n;i++){
            buf = reader.readLine().split(" ");
            tb[i][0]=Long.parseLong(buf[0]); tb[i][1]=Long.parseLong(buf[1]);
        }
        Arrays.sort(tb,(a,b)->(Long.compare(b[1],a[1]))); // reversed sorting of beauty
        PriorityQueue<Long> pq = new PriorityQueue<>();
        long sum = 0, ans = 0;
        for(int i=0;i<n;i++){
            sum += tb[i][0];
            pq.add(tb[i][0]);
            while(pq.size()>k) sum -= pq.poll();
            ans = Math.max(ans,sum*tb[i][1]);
        }
        System.out.println(ans);
    }
}