import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.SortedMap;
import java.util.TreeMap;

public class Contest {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);

    int n = Integer.valueOf(in.next());
    int k = Integer.valueOf(in.next());

    TreeMap<Integer, List<Song>> songsByBeauty = new TreeMap<>(Integer::compareTo);

    for (int i = 0; i < n; i++) {
      Integer length = Integer.valueOf(in.next());
      Integer beauty = Integer.valueOf(in.next());

      Song song = new Song(length, beauty);

      songsByBeauty.putIfAbsent(beauty, new ArrayList<>());

      songsByBeauty.get(beauty).add(song);
    }

    long maxValue = 0;

    PriorityQueue<Song> longestSongs = new PriorityQueue<>(Comparator.comparingInt(s -> s.length));
    long longestSongsSumLength = 0;

    for (Map.Entry<Integer, List<Song>> entry: songsByBeauty.descendingMap().entrySet()) {
      for (Song song: entry.getValue()) {
        longestSongsSumLength += song.length;
        longestSongs.add(song);

        if (longestSongs.size() > k) {
          Song polled = longestSongs.poll();
          longestSongsSumLength -= polled.length;
        }

        maxValue = Math.max(maxValue, entry.getKey() * longestSongsSumLength);
      }
    }

    System.out.println(maxValue);
  }

  static class Song {
    int length;
    int beauty;

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