import java.io.*;
import java.util.*;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        try (PrintWriter out = new PrintWriter(System.out)) {
            Solution solution = new Solution();
            solution.in = new InputReader(getInput());
            solution.out = out;
            solution.solve();
        }
    }

    static InputStream getInput() {
        String inputFile = getInputFileName();
        if (inputFile == null) {
            return System.in;
        }
        try {
            return new FileInputStream(Main.class.getClassLoader().getResource(inputFile).getFile());
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

    static String getInputFileName() {
        try {
            return System.getProperty("compet.input");
        } catch (Exception ex) {
            return null;
        }
    }
}

class Solution {
    InputReader in;
    PrintWriter out;

    class Song {
        int l;
        int b;
        int i;
    }

    void solve() {
        int n = in.nextInt();
        int k = in.nextInt();
        List<Song> a = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            Song s = new Song();
            s.l = in.nextInt();
            s.b = in.nextInt();
            s.i = i;
            a.add(s);
        }
        a.sort(Comparator.<Song>comparingInt(s -> s.l).reversed());
        boolean[] inUse = new boolean[n];
        long totLen = 0;
        for (int i = 0; i < k; i++) {
            Song s = a.get(i);
            inUse[s.i] = true;
            totLen += s.l;
        }
        int j = k;

        long ans = 0;
        List<Song> b = new ArrayList<>();
        b.addAll(a);
        b.sort(Comparator.comparingInt(s -> s.b));
        boolean[] done = new boolean[n];
        for (Song s: b) {
            ans = Math.max(totLen * s.b, ans);
            if (inUse[s.i]) {
                totLen -= s.l;
                while (j < n && done[a.get(j).i]) {
                    j++;
                }
                if (j < n) {
                    Song sAdd = a.get(j);
                    totLen += sAdd.l;
                    inUse[sAdd.i] = true;
                    j++;
                }
            }
            done[s.i] = true;
        }
        out.println(ans);
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }
}
