#include <bits/stdc++.h>
using namespace std;
bool sortinrev(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.first > b.first);
}
int main() {
  long long int n, k, z, count, max, i, b, t, s = 0, temp, element;
  cin >> n >> k;
  vector<pair<long long int, long long int> > v;
  vector<pair<long long int, long long int> >::iterator itr, itr2;
  multiset<long long int> st;
  multiset<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(), sortinrev);
  itr = v.begin();
  temp = (itr->second);
  temp = temp * (itr->first);
  st.insert(itr->second);
  long long int l = itr->second;
  s = temp;
  for (i = 0; i < k - 1; i++) {
    itr++;
    l = l + itr->second;
    temp = l * (itr->first);
    st.insert(itr->second);
    if (temp > s) s = temp;
  }
  while ((itr + 1) != v.end()) {
    itr++;
    sit = st.begin();
    if (*sit < itr->second) {
      l = l - *sit;
      st.erase(sit);
      st.insert(itr->second);
      l = l + itr->second;
      temp = l * (itr->first);
      if (temp > s) {
        s = temp;
      }
    }
  }
  cout << s << endl;
}
