import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Solution {


    public static void main(String[] args) throws Exception{
        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());

        Node array[] = new Node[n];

        for(int i = 0;i < n;i++){
            st = new StringTokenizer(br.readLine());
            int t = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            array[i] = new Node(t, b);
        }

        Arrays.sort(array);
        TreeMap<Integer, Integer>map = new TreeMap<>();

        long sum = 0;
        long ans = 0;

        int totalElements = 0;

        for(int i = 0;i < n;i++){
            if(map.containsKey(array[i].len)){
                map.put(array[i].len, map.get(array[i].len) + 1);
            } else {
                map.put(array[i].len, 1);
            }

            sum += array[i].len;
            totalElements += 1;

            if(totalElements > k){
                int key = map.firstKey();
                map.put(key, map.get(key) - 1);
                if(map.get(key) == 0)
                    map.remove(key);
                sum -= key;
                --totalElements;
            }
            ans = Math.max(ans, sum*array[i].beauty);
        }

        System.out.println(ans);
    }

    static class Node implements Comparable<Node>{
        int len;
        int beauty;
        Node(int len, int beauty){
            this.len = len;
            this.beauty = beauty;
        }
        public int compareTo(Node other){
            return Integer.compare(other.beauty, beauty);
        }
    }
}
