#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
pair<int, int> bt[N];
long long res[N];
int main() {
  priority_queue<int, vector<int>, greater<int> > q;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> bt[i].second >> bt[i].first;
  sort(bt, bt + n);
  long long sum = 0, R;
  for (int i = n - 1; i > n - k; --i) {
    res[i] = res[i + 1] + bt[i].second;
    q.push(bt[i].second);
    sum += (long long)bt[i].second;
  }
  for (int i = n - k; i >= 0; --i) {
    if (!q.empty()) {
      res[i] = (long long)bt[i].second + sum;
      int p = q.top();
      if (bt[i].second > p) {
        sum -= (long long)p;
        sum += (long long)bt[i].second;
        q.pop();
        q.push(bt[i].second);
      }
    }
  }
  for (int i = 0; i < n; ++i) R = max(R, res[i] * (long long)bt[i].first);
  cout << R;
}
