#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, x, y;
  cin >> n >> k;
  vector<pair<long long, long long> > vec;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    vec.push_back({y, x});
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  long long minPleasure = 1e9, currLength = 0, maxi = 0;
  set<pair<int, int> > st;
  set<pair<int, int> >::iterator it;
  for (int i = 0; i < n; i++) {
    currLength += vec[i].second;
    st.insert({vec[i].second, i});
    while (st.size() > k) {
      it = st.begin();
      currLength -= it->first;
      st.erase(it);
    }
    maxi = max(currLength * vec[i].first, maxi);
  }
  cout << maxi;
  return 0;
}
