#include <bits/stdc++.h>
using namespace std;
void optimizeIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  optimizeIO();
  int n, k;
  cin >> n >> k;
  vector<pair<long long, long long> > arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i].second >> arr[i].first;
  sort(arr.rbegin(), arr.rend());
  priority_queue<long long, vector<long long>, greater<long long> > pq;
  long long sm = 0, mx = 0;
  for (int i = 0; i < k; i++) {
    sm += arr[i].second;
    mx = max(mx, sm * arr[i].first);
    pq.push(arr[i].second);
  }
  mx = max(mx, sm * arr[k - 1].first);
  for (int i = k; i < n; i++) {
    long long cur = arr[i].second;
    if (cur > pq.top()) {
      sm = sm - pq.top();
      sm += cur;
      pq.pop();
      pq.push(cur);
      mx = max(mx, sm * arr[i].first);
    } else {
      sm = sm - pq.top();
      sm += cur;
      mx = max(mx, sm * arr[i].first);
      sm -= cur;
      sm += pq.top();
    }
  }
  cout << mx << endl;
  return 0;
}
