#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int n) {
  if (n == 0) return 1;
  if ((n % 2) == 0)
    return (power((a * a), n / 2));
  else
    return (a * (power((a * a), n / 2)));
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  priority_queue<long long int, vector<long long int>, greater<long long int>>
      q;
  long long int n, k;
  cin >> n >> k;
  pair<long long int, long long int> p[n];
  for (long long int i = 0; i < n; i++) {
    cin >> p[i].second >> p[i].first;
  }
  sort(p, p + n);
  long long int sum = 0, m = -1;
  for (long long int i = n - 1; i >= 0; i--) {
    sum = sum + p[i].second;
    q.push(p[i].second);
    if (q.size() > k) {
      sum = sum - q.top();
      q.pop();
    }
    m = max(m, sum * p[i].first);
  }
  cout << m << "\n";
  return 0;
}
