#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<pair<int, int>> v;
priority_queue<int, vector<int>, greater<int>> pq;
long long int sm = 0;
void add(int x) {
  pq.push(x);
  sm += x;
  if (pq.size() <= k) {
    return;
  } else {
    while (pq.size() > k) {
      sm -= pq.top();
      pq.pop();
    }
  }
}
int main() {
  cin >> n >> k;
  int i, t, b;
  for (i = 0; i < n; i++) {
    cin >> t >> b;
    v.push_back({b, t});
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  long long int ans = 0;
  for (i = 0; i < n; i++) {
    add(v[i].second);
    ans = max(ans, (long long int)(v[i].first) * sm);
  }
  cout << ans << "\n";
  return 0;
}
