import java.util.*;

import static java.util.Optional.ofNullable;

public class C62E {

    public static void main(String[] args) {
        int n,k;
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        k = scanner.nextInt();
        List<Song> songs = new ArrayList<>();
        for (int i = 0; i < n; i++){
            songs.add(new Song(scanner.nextInt(), scanner.nextInt()));
        }
        songs.sort(Comparator.comparingLong(Song::getBeauty));
        PriorityQueue<Long> lengths = new PriorityQueue<>();
        long length = 0;
        long max = -1;
        for (int i = n - 1; i >= 0; i--){
            Song currentSong = songs.get(i);
            long value = currentSong.getBeauty() * (length + currentSong.getLength());
            if (value > max){
                max = value;
            }
            if ( k > 1){

                if (lengths.size() < k - 1){
                    lengths.add(currentSong.getLength());
                    length += currentSong.getLength();
                    continue;
                }
                Long currentMin = ofNullable(lengths.peek()).orElse(0l);
                if (currentMin < currentSong.getLength()){
                    length += (currentSong.getLength() - currentMin);
                    lengths.remove(currentMin);
                    lengths.add(currentSong.getLength());
                }
            }
        }
        System.out.println(max);
    }

}

class Song{
    private long length;
    private long beauty;

    public void setLength(long length) {
        this.length = length;
    }

    public void setBeauty(long beauty) {
        this.beauty = beauty;
    }

    public long getLength() {
        return length;
    }

    public long getBeauty() {
        return beauty;
    }

    public Song(long length, long beauty) {
        this.length = length;
        this.beauty = beauty;
    }
}

