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

public class Main {

    private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

    private static class Song {

        public long duration;
        public long beauty;

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

    public static void main(String[] args) throws IOException {
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        long ans = 0;
        List<Song> songs = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(br.readLine());
            songs.add(new Song(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())));
        }
        Collections.sort(songs, (s1, s2) -> {
            if (s1.beauty == s2.beauty) return 0;
            return s1.beauty < s2.beauty ? 1 : -1;
        });
        TreeMap<Long, Integer> tm = new TreeMap<>();
        int songCount = 0;
        long durationSum = 0;
        for (Song song : songs) {
            songCount = addSong(tm, songCount, song);
            if (songCount > k) {
                durationSum = removeSong(tm, durationSum);
                songCount--;
            }
            durationSum += song.duration;
            if (song.beauty * durationSum > ans) {
                ans = song.beauty * durationSum;
            }
        }
        pw.println(ans);
        pw.close();
    }

    private static long removeSong(TreeMap<Long, Integer> tm, long durationSum) {
        long leastDurationSong = tm.firstKey();
        tm.put(leastDurationSong, tm.get(leastDurationSong) - 1);
        if (tm.get(leastDurationSong) == 0) {
            tm.remove(leastDurationSong);
        }
        durationSum -= leastDurationSong;
        return durationSum;
    }

    private static int addSong(TreeMap<Long, Integer> tm, int songCount, Song song) {
        if (tm.get(song.duration) == null) {
            tm.put(song.duration, 1);
        } else {
            tm.put(song.duration, tm.get(song.duration) + 1);
        }
        songCount++;
        return songCount;
    }

}