#include <bits/stdc++.h>
using namespace std;
long long update_window(multiset<long long> &window, long long sum, long long k,
                        long long elem) {
  sum += elem;
  window.insert(elem);
  if (window.size() > k) {
    sum -= *window.begin();
    window.erase(window.begin());
  }
  return sum;
}
int main() {
  long long n, k;
  vector<pair<long long, long long> > t;
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    long long length, beauty;
    cin >> length >> beauty;
    t.push_back(make_pair(beauty, length));
  }
  sort(t.begin(), t.end());
  long long sum = 0;
  long long max_beauty = 0;
  multiset<long long> window;
  for (long long i = n - 1; i >= 0; --i) {
    sum = update_window(window, sum, k, t[i].second);
    max_beauty = max(max_beauty, sum * t[i].first);
  }
  cout << max_beauty;
}
