#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<vector<long long> > a(n, vector<long long>(2));
  for (int i = 0; i < n; i++) cin >> a[i][1] >> a[i][0];
  sort(a.begin(), a.end());
  set<long long> s;
  long long sum = 0, ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    s.insert(a[i][1]);
    sum += a[i][1];
    while (s.size() > k) {
      auto it = s.begin();
      sum -= *it;
      s.erase(it);
    }
    ans = max(ans, sum * a[i][0]);
  }
  cout << ans << endl;
}
void sj26() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  bool q = 0;
  sj26();
  int t = 1;
  if (q) cin >> t;
  while (t--) {
    solve();
  }
}
