#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > arr;
priority_queue<int> pq;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, n, k, t, b;
  long long ans, sum;
  cin >> n >> k;
  for (i = 0; i < n; ++i) {
    cin >> t >> b;
    arr.push_back({b, t});
  }
  sort(arr.begin(), arr.end());
  ans = sum = 0;
  for (i = n - 1; i >= 0; --i) {
    if (pq.size() < k) {
      pq.push(-arr[i].second);
      sum += arr[i].second;
    } else {
      t = -pq.top();
      if (t <= arr[i].second) {
        pq.pop();
        pq.push(-arr[i].second);
        sum -= t;
        sum += arr[i].second;
      }
    }
    ans = max(ans, sum * arr[i].first);
  }
  cout << ans << "\n";
  return 0;
}
