#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
pair<int, int> a[maxn];
priority_queue<int, vector<int>, greater<int> > q;
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i].second >> a[i].first;
  }
  sort(a, a + n);
  long long sum = 0;
  long long ans = 0;
  for (int i = n - 1; i >= 0; --i) {
    sum += a[i].second;
    if (q.size() == k) {
      sum -= q.top();
      q.pop();
    }
    q.push(a[i].second);
    ans = max(ans, sum * a[i].first);
  }
  cout << ans;
  return 0;
}
