#include <bits/stdc++.h>
using namespace std;
const long long N = 300009;
long long n, k;
pair<long long, long long> a[N];
int32_t main() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> a[i].second >> a[i].first;
  sort(a, a + n);
  long long sum = 0;
  long long ans = 0;
  set<pair<long long, long long> > s;
  for (long long i = n - 1; i >= 0; i--) {
    s.insert(make_pair(a[i].second, i));
    sum += a[i].second;
    while (s.size() > k) {
      auto it = s.begin();
      sum -= it->first;
      s.erase(it);
    }
    ans = max(ans, sum * a[i].first);
  }
  cout << ans << endl;
}
