#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, a, b;
  cin >> n >> k;
  vector<pair<long long int, long long int>> vec;
  multiset<long long int> ms;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    vec.push_back({b, a});
  }
  sort(vec.begin(), vec.end());
  vector<long long int> ans;
  long long int sum = 0, sum2 = 0, mini2 = 99999999999, mini = 0, tota = 0;
  for (int i = (int)vec.size() - 1; i >= 0; i--) {
    sum2 += vec[i].second;
    ms.insert(vec[i].second);
    while (ms.size() > k) {
      long long int dif;
      sum2 -= (*ms.begin());
      ms.erase(ms.begin());
    }
    tota = max(tota, sum2 * vec[i].first);
  }
  cout << tota << endl;
}
