#include <bits/stdc++.h>
using namespace std;
int main() {
  long long mx1 = 0, mx2 = 0, sum1 = 0, sum2 = 0, mi1 = 1e9, mi2 = 1e9;
  int n, k;
  cin >> n >> k;
  vector<pair<long long, long long>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first;
    cin >> a[i].second;
  }
  sort(a.begin(), a.end(),
       [](const pair<long long, long long>& a,
          const pair<long long, long long>& b) { return a.second < b.second; });
  multiset<int> q;
  long long sum = 0, ans = 0;
  for (int i = n - 1; i >= 0; --i) {
    sum += a[i].first;
    q.insert(a[i].first);
    while (q.size() > k) {
      sum -= *q.begin();
      q.erase(q.begin());
    }
    ans = max(ans, sum * a[i].second);
  }
  cout << ans;
  return 0;
}
