#include <bits/stdc++.h>
using namespace std;
bool comp(pair<long long int, long long int> a,
          pair<long long int, long long int> b) {
  if (a.second == b.second) {
    return a.first < b.first;
  }
  return a.second < b.second;
}
signed main() {
  long long int n, k;
  cin >> n >> k;
  vector<pair<long long int, long long int>> vp;
  for (long long int i = 0; i < n; i++) {
    long long int t, b;
    cin >> t >> b;
    vp.emplace_back(make_pair(b, t));
  }
  sort(vp.begin(), vp.end());
  set<pair<long long int, long long int>> st;
  long long int sum = 0;
  long long int res = 0;
  for (long long int i = n - 1; i >= 0; i--) {
    st.insert(make_pair(vp[i].second, i));
    sum += vp[i].second;
    while (st.size() > k) {
      auto it = st.begin();
      sum -= it->first;
      st.erase(it);
    }
    res = max(res, sum * vp[i].first);
  }
  cout << res << "\n";
  return 0;
}
