#include <bits/stdc++.h>
using namespace std;
long long t, a, b, c, d, n, cnt1 = 0, cnt2 = 0, flag = 0, k;
long long ar[1003], br[2000], sum[2999] = {0};
vector<pair<long long, long long>> vp;
int main() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b;
    vp.push_back({b, a});
  }
  sort(vp.begin(), vp.end());
  set<pair<long long, long long>> st;
  for (long long i = n - 1; i >= 0; i--) {
    st.insert({vp[i].second, i});
    cnt1 += vp[i].second;
    if (st.size() > k) {
      auto it = st.begin();
      cnt1 -= it->first;
      st.erase(*it);
    }
    cnt2 = max(cnt2, cnt1 * vp[i].first);
  }
  cout << cnt2 << endl;
}
