#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<pair<int, int> > p(n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &p[i].second, &p[i].first);
    p[i].first *= -1;
    p[i].second *= -1;
  }
  sort(p.begin(), p.end());
  long long int ans = 0;
  long long int sum = 0;
  priority_queue<int> pq;
  for (int i = 0; i < n; i++) {
    pq.push(p[i].second);
    sum += p[i].second;
    if (pq.size() > k) {
      int tmp = pq.top();
      sum -= tmp;
      pq.pop();
    }
    ans = max(ans, sum * p[i].first);
  }
  cout << ans << endl;
  return 0;
}
