#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2>& pr) {
  out << pr.first << " " << pr.second;
  return out;
}
const long long INF = (long long)(1e17);
const double PI = 3.141592653589793;
const long long MOD = 1e9 + 7;
long long dx[4] = {-1, 0, 1, 0};
long long dy[4] = {0, 1, 0, -1};
string path = "URDL";
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.second < b.second;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long> > a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i].first >> a[i].second;
  sort(a.begin(), a.end(), comp);
  set<pair<long long, long long> > st;
  long long res = -INF;
  long long len = 0;
  for (long long i = n - 1; i >= 0; i--) {
    st.insert({a[i].first, a[i].second});
    len += a[i].first;
    while ((long long)st.size() > k) {
      auto itr = st.begin();
      len -= itr->first;
      st.erase(itr);
    }
    res = max(res, len * a[i].second);
  }
  cout << res << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  clock_t begin = clock();
  solve();
  clock_t end = clock();
  return 0;
}
