#include <bits/stdc++.h>
using namespace std;
bool comparator(const pair<long long, long long> &a,
                const pair<long long, long long> &b) {
  return (a.second < b.second);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long a[n], b[n];
  vector<pair<long long, long long> > v;
  long long tot = 0;
  long long mini = 10000000;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    tot += a[i];
    v.push_back(make_pair(a[i], b[i]));
    mini = min(mini, b[i]);
  }
  sort(v.begin(), v.end(), comparator);
  set<pair<long long, long long> > s;
  long long r = 0, sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    s.insert(make_pair(v[i].first, i));
    sum += v[i].first;
    if (s.size() > k) {
      auto it = s.begin();
      sum -= it->first;
      s.erase(it);
    }
    r = max(r, sum * v[i].second);
  }
  cout << r << endl;
}
