#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long> > x;
  for (long long i = 0; i < n; i++) {
    long long t, b;
    cin >> t >> b;
    x.push_back(make_pair(b, t));
  }
  sort(x.rbegin(), x.rend());
  long long ret = 0;
  int z = 0;
  set<pair<long long, long long> > best;
  long long total = 0;
  for (long long i = 0; i < n; i++) {
    total += x[i].second;
    best.insert(make_pair(-x[i].second, z++));
    if (best.size() == k + 1) {
      total += best.rbegin()->first;
      best.erase(prev(best.end()));
    }
    ret = max(ret, total * x[i].first);
  }
  cout << ret << endl;
  return 0;
}
