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

public class Solution {
    static long solution(int n, int k, Pair[] songs) {
        Arrays.sort(songs, new SortBySecond()); // (time, beauty)

        TreeSet<Pair> lengths = new TreeSet<>(new SortByFirstThenSecond());
        long sumLengths = 0;
        long maxPleasure = Long.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            sumLengths += songs[i].first;
            lengths.add(new Pair(songs[i].first, i));

            while (lengths.size() > k) {
                sumLengths -= lengths.pollFirst().first;
            }  

            maxPleasure = Math.max(maxPleasure, songs[i].second * sumLengths);
        }

        return maxPleasure;
    }

    public static void main(String[] args) throws IOException {
        Scanner reader = reader(args);

        int n = reader.nextInt();
        int k = reader.nextInt();

        Pair[] songs = new Pair[n];
        for (int i = 0; i < n; i++) {
            int t = reader.nextInt();
            int b = reader.nextInt();
            songs[i] = new Pair(t, b);
        }

        System.out.println(solution(n, k, songs));
    }

    static Scanner reader(String[] args) throws FileNotFoundException {
        if (args.length > 0 && args[0].equals("dev")) {
            return new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream("input.txt"))));
        }

        return new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    }
}

class Pair {
    int first, second;
    Pair(int first, int second) {
        this.first = first;
        this.second = second;
    }

    
}

class SortByFirstThenSecond implements Comparator<Pair> {
    @Override
    public int compare(Pair o1, Pair o2) {
        if (o1.first == o2.first) {
            return o1.second - o2.second;
        }

        return o1.first - o2.first;
    }
}

class SortBySecond implements Comparator<Pair> {
    @Override
    public int compare(Pair o1, Pair o2) {
        return o2.second - o1.second;
    }
}