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

public class Solution {
    static long solution(int n, int k, Pair[] songs) {
        long maxPleasure = Long.MIN_VALUE;

        Arrays.sort(songs, new SortByTime());
        maxPleasure = Math.max(maxPleasure, pleasure(k, songs));

        Arrays.sort(songs, new SortByBeauty());
        maxPleasure = Math.max(maxPleasure, pleasure(k, songs));

        return maxPleasure;
    }

    static long pleasure(int k, Pair[] songs) {
        long maxPleasure = Long.MIN_VALUE;

        long sumTime = 0;
        long minBeauty = Long.MAX_VALUE;
        for (int i = 0; i < k; i++) {
            sumTime += songs[i].t;
            minBeauty = Math.min(minBeauty, songs[i].b);
            maxPleasure = Math.max(maxPleasure, sumTime * minBeauty);
        }

        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 t, b;
    Pair(int t, int b) {
        this.t = t;
        this.b = b;
    }
}

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

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