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