#include <bits/stdc++.h>
using namespace std;
static int f = []() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  return 0;
}();
int main() {
  int n, k;
  cin >> n >> k;
  vector<pair<long long, long long>> songs(n);
  for (int i = 0; i < n; i++) {
    long long t, b;
    cin >> t >> b;
    songs[i] = {b, t};
  }
  sort(songs.rbegin(), songs.rend());
  priority_queue<int, vector<int>, greater<int>> chosen;
  long long ans = 0, sum = 0;
  for (int i = 0; i < songs.size(); i++) {
    auto p = songs[i];
    sum += p.second;
    chosen.push(p.second);
    if (chosen.size() > k) {
      sum -= chosen.top();
      chosen.pop();
    }
    ans = max(ans, sum * p.first);
  }
  cout << ans;
  return 0;
}
