
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class playlist {

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
        FastReader sc = new FastReader();

        int n, k;
        n = sc.nextInt();
        k = sc.nextInt();

        song arr[] = new song[n];

        for (int i = 0; i < n; i++) {
            arr[i] = new song(sc.nextInt(), sc.nextInt());
        }
        Arrays.sort(arr);

        long res, sum;
        res = sum = 0;

        TreeSet<pair> list = new TreeSet <pair>() ;
      
        for (int i = n-1; i > -1 ; i--) {
            list.add(new pair(arr[i].length,i));
            
            sum += arr[i].length;
            if(list.size() > k) {
                
                sum -= list.pollFirst().length;
       
            }
            
            res = Math.max(res, sum * arr[i].beauty);
           
        }
        System.out.println(res);
    }

    static class song implements Comparable<song> {

        int length;
        int beauty;

        song(int a, int b) {
            length = a;
            beauty = b;
        }

        public int compareTo(song other) {
            return beauty - other.beauty;
        }
    }
    
    static class pair implements Comparable<pair> {

        int length;
        int no ;

        pair(int a, int b) {
            length = a;
            no = b;
        }

        public int compareTo(pair other) {
            if(length == other.length) {
                return no - other.no ;
            }
            return  length - other.length; 
        }
    }
    
}
