#include <bits/stdc++.h>
using namespace std;
signed solve();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}
const int MAX_N = 3e5 + 5;
int n, k;
pair<int, int> a[MAX_N];
signed solve() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  long long ans = 0, sum = 0;
  sort(a, a + n,
       [&](pair<int, int> x, pair<int, int> y) { return x.second > y.second; });
  multiset<int> ms;
  for (int i = 0; i < n; ++i) {
    sum += 1ll * a[i].first;
    ms.insert(a[i].first);
    if (ms.size() > k) {
      sum -= (*ms.begin());
      ms.erase(ms.begin());
    }
    ans = max(ans, sum * a[i].second);
  }
  cout << ans << '\n';
  return 0;
}
