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

public class Rextester{
    static class Playlists implements Comparable<Playlists>{
        int length,beauty;
        public Playlists(int l,int b){
            length = l;
            beauty = b;
        }
        @Override
        public int compareTo(Playlists o){
            return this.beauty- o.beauty;
        }
    }
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        Playlists[] ps = new Playlists[n];
        for(int i=0;i<n;i++){
            StringTokenizer st1 = new StringTokenizer(br.readLine());
            ps[i]=new Playlists(Integer.parseInt(st1.nextToken()),Integer.parseInt(st1.nextToken()));
        }
        Arrays.sort(ps);
        long[] maxAft = new long[n];
        PriorityQueue<Integer> pq  = new PriorityQueue<Integer>();
        pq.add(ps[n-1].length);
        long sum = 0;
        sum+=ps[n-1].length;
        int x = 1;
        for(int i=n-2;i>=0;i--){
            maxAft[i]=sum;
            if(x==k){
                int z = pq.poll();
                if(z<ps[i].length){
                    sum+=(long)ps[i].length;
                    sum-=(long)z;
                    pq.add(ps[i].length);
                }
                else{
                    maxAft[i]=sum;
                    pq.add(z);
                }
            }
            else{
                sum+=(long)ps[i].length;
                x++;
            }
        }
        long max = 0;
        for(int i=0;i<n;i++){
            max = Math.max(max,(maxAft[i]+ps[i].length)*ps[i].beauty);
        }
        System.out.println(max);
    }
}