#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<pair<long long, long long>> pairs(n);
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    pairs[i] = {y, x};
  }
  sort(pairs.begin(), pairs.end());
  priority_queue<long long, vector<long long>, greater<long long>> pq;
  long long ksum = 0, ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    long long curB = pairs[i].first;
    if (pq.size() < k) {
      pq.push(pairs[i].second);
      ksum += pairs[i].second;
    } else {
      if (pairs[i].second > pq.top()) {
        ksum -= pq.top();
        pq.pop();
        ksum += pairs[i].second;
        pq.push(pairs[i].second);
      }
    }
    ans = max(ans, curB * ksum);
  }
  cout << ans << endl;
}
