#include <bits/stdc++.h>
using namespace std;
pair<long long, int> a[300005];
struct comp {
  bool operator()(const int& i, const int& j) {
    return a[j].second < a[i].second;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i].second >> a[i].first;
  }
  sort(a, a + n);
  long long maxm = 0, sum = 0;
  multiset<int, comp> active, inactive;
  for (int i = 0; i < n; i++) inactive.insert(i);
  multiset<int, comp>::iterator it;
  for (int i = 0; i < k - 1; i++) {
    it = inactive.begin();
    int val = *it;
    inactive.erase(it);
    active.insert(val);
    sum += a[val].second;
  }
  for (int i = 0; i < n; i++) {
    if (active.find(i) == active.end()) {
      inactive.erase(inactive.find(i));
    } else {
      active.erase(active.find(i));
      sum -= a[i].second;
      if (!inactive.empty()) {
        it = inactive.begin();
        sum += a[*it].second;
        active.insert(*it);
        inactive.erase(it);
      }
    }
    maxm = max(maxm, a[i].first * (sum + a[i].second));
  }
  cout << maxm << "\n";
}
