#include <bits/stdc++.h>
#pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")
using namespace std;
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
signed main() {
  fastio();
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long> > v(n);
  for (long long i = 0; i < n; ++i) cin >> v[i].second >> v[i].first;
  sort(v.begin(), v.end());
  set<pair<long long, long long> > s;
  long long ans = 0;
  long long Cur = 0;
  for (long long i = n - 1; i >= 0; --i) {
    Cur += v[i].second;
    long long mul = v[i].first;
    s.insert({v[i].second, i});
    while (s.size() > k) {
      Cur -= s.begin()->first;
      s.erase(s.begin());
    }
    ans = max(ans, mul * Cur);
  }
  cout << ans << "\n";
  return 0;
}
