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

public class Solution {

    public static void main(String[] args) throws Exception {
        MyScanner scan = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n = scan.nextInt();
        int k = scan.nextInt();
        long[][] songSortByQuality = new long[n][2];
        for (int i = 0; i < n; i++) {
            songSortByQuality[i][0] = scan.nextLong();
            songSortByQuality[i][1] = scan.nextLong();
        }
        Arrays.sort(songSortByQuality, (o1, o2) -> {
            return Long.compare(o2[1], o1[1]);
        });

        PriorityQueue<Long> q = new PriorityQueue<>((o1, o2) -> {
            return Long.compare(o1, o2);
        });

        long sum = 0;
        long max = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            long quality = songSortByQuality[i][1];
            long time = songSortByQuality[i][0];
            sum += time;
            q.add(time);
            if (q.size() > k) {
                Iterator<Long> iterator = q.iterator();
                sum -= iterator.next();
                iterator.remove();
            }

            max = Math.max(max, sum * quality);
        }
        out.println(max);
        out.close();
    }


    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            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;
        }

    }
    //--------------------------------------------------------

}