#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k, sum = 0, ans = 0;
  cin >> n >> k;
  vector<pair<long long, long long> > v;
  for (long long i = 0; i < n; i++) {
    long long temp1, temp2;
    cin >> temp1 >> temp2;
    v.push_back(make_pair(temp2, temp1));
  }
  sort(v.begin(), v.end());
  priority_queue<long long, vector<long long>, greater<long long> > q;
  for (long long i = n - 1; i >= 0; i--) {
    sum = sum + v[i].second;
    q.push(v[i].second);
    if (q.size() > k) {
      sum = sum - q.top();
      q.pop();
    }
    ans = max(ans, sum * v[i].first);
  }
  cout << ans << endl;
  return 0;
}
