#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, z, count, max, i, b, t, s = 0, temp;
  cin >> n >> k;
  vector<pair<long long int, long long int> > v;
  vector<pair<long long int, long long int> >::iterator itr;
  multiset<pair<long long int, long long int> > st;
  multiset<pair<long long int, long long int> >::iterator sit;
  for (i = 0; i < n; i++) {
    cin >> t >> b;
    v.push_back(make_pair(b, t));
  }
  sort(v.begin(), v.end());
  itr = v.begin();
  for (i = 0; i < k; i++) {
    s = s + (itr->second);
    st.insert(make_pair(itr->first, itr->second));
    itr++;
  }
  s = s * ((itr - k)->first);
  for (i = k; i < n; i++) {
    sit = st.begin();
    temp = (s / (sit->first)) - (sit->second);
    st.erase(sit);
    st.insert(make_pair(itr->first, itr->second));
    sit = st.begin();
    temp = (temp + (itr->second)) * (sit->first);
    if (temp > s) s = temp;
    itr++;
  }
  while (!st.empty()) {
    sit = st.begin();
    temp = temp / (sit->first);
    temp = temp - (sit->second);
    st.erase(sit);
    sit = st.begin();
    temp = temp * (sit->first);
    if (temp > s) s = temp;
  }
  cout << s << endl;
}
