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