#include <bits/stdc++.h>
using namespace std;
int n, k;
pair<int, int> a[300010];
int main() {
  while (scanf("%d%d", &n, &k) != EOF) {
    for (int i = 1; i <= n; ++i) scanf("%d%d", &a[i].first, &a[i].second);
    sort(a + 1, a + 1 + n, [](pair<int, int> a, pair<int, int> b) {
      return a.second > b.second;
    });
    priority_queue<int, vector<int>, greater<int> > pq;
    long long len = 0;
    long long res = 0;
    for (int i = 1; i <= n; ++i) {
      len += a[i].first;
      pq.push(a[i].first);
      if ((int)pq.size() > k) {
        len -= pq.top();
        pq.pop();
      }
      res = max(res, len * a[i].second);
    }
    printf("%lld\n", res);
  }
  return 0;
}
