#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, i;
  cin >> n >> k;
  vector<pair<long long int, long long int> > v;
  for (i = 0; i < n; i++) {
    long long int l, b;
    cin >> l >> b;
    v.push_back(make_pair(b, l));
  }
  sort(v.rbegin(), v.rend());
  priority_queue<long long int, vector<long long int>, greater<long long int> >
      ms;
  long long int ans = INT_MIN, sum = 0;
  for (i = 0; i < n; i++) {
    if (ms.size() < k) {
      ms.push(v[i].second);
      sum += v[i].second;
    } else {
      if (v[i].second > ms.top()) {
        sum -= ms.top();
        ms.pop();
        sum += v[i].second;
        ms.push(v[i].second);
      }
    }
    ans = max(ans, sum * v[i].first);
  }
  cout << ans;
  return 0;
}
