#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long> > a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i].second >> a[i].first;
  }
  sort(a.rbegin(), a.rend());
  priority_queue<long long> q;
  long long ans = 0, sum = 0;
  for (long long i = 0; i < n; i++) {
    if (q.size() < k) {
      sum += a[i].second;
      q.push(-a[i].second);
      ans = max(ans, sum * a[i].first);
    } else if (-q.top() < a[i].second) {
      sum += q.top();
      sum += a[i].second;
      q.pop();
      q.push(-a[i].second);
      ans = max(ans, sum * a[i].first);
    }
  }
  cout << ans << "\n";
  return 0;
}
