#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<pair<int, int>> v(n);
  for (int i = 0; i != n; i++) {
    cin >> v[i].second >> v[i].first;
  }
  sort(v.begin(), v.end());
  long long sum = 0;
  long long res = 0;
  multiset<int> s;
  for (int i = n - 1; i != -1; i--) {
    s.insert(v[i].second);
    sum += v[i].second;
    if (s.size() > k) {
      auto it = s.begin();
      sum -= *it;
      s.erase(it);
    }
    res = max(res, v[i].first * sum);
  }
  cout << res << endl;
  return 0;
}
