#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k, x, y;
  cin >> n >> k;
  vector<pair<long long int, pair<long long int, long long int> > > v;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(make_pair(y, make_pair(x, i)));
  }
  sort(v.begin(), v.end());
  vector<long long int> t;
  for (int i = 0; i < n; i++) {
    t.push_back(v[i].second.first);
  }
  for (int i = n - 2; i >= 0; i--) {
    v[i].second.first += v[i + 1].second.first;
  }
  long long int val;
  if (k > 1)
    val = v[n - 1 - k + 2].second.first;
  else
    val = 0;
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i < n - 1 - k + 2)
      ans = max(ans, (v[i].first * (val + t[i])));
    else {
      ans = max(ans, v[i].first * v[i].second.first);
    }
  }
  cout << ans << endl;
  return 0;
}
