#include <bits/stdc++.h>
using namespace std;
long long t[300000 + 50], b[300000 + 50];
multiset<pair<pair<long long, long long>, int> > pq;
multiset<pair<pair<long long, long long>, int> > kval;
priority_queue<pair<pair<long long, long long>, int> > pqr;
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> t[i] >> b[i];
    pq.insert(make_pair(make_pair(t[i], b[i]), i));
    pqr.push(make_pair(make_pair(-b[i], -t[i]), i));
  }
  long long ans = 0;
  long long sum = 0;
  for (int i = 1; i < k; i++) {
    auto bc = pq.end();
    --bc;
    auto bcc = (*bc);
    kval.insert(bcc);
    sum += bcc.first.first;
    pq.erase(pq.find(bcc));
  }
  int cnt = 0;
  while (pqr.empty() == 0) {
    auto topp = pqr.top();
    topp.first.first = -1LL * topp.first.first;
    topp.first.second = -1LL * topp.first.second;
    pqr.pop();
    if (pq.find(make_pair(make_pair(topp.first.second, topp.first.first),
                          topp.second)) != pq.end())
      pq.erase(pq.find(make_pair(make_pair(topp.first.second, topp.first.first),
                                 topp.second)));
    if (kval.find(make_pair(make_pair(topp.first.second, topp.first.first),
                            topp.second)) != kval.end()) {
      sum -= topp.first.second;
      kval.erase(kval.find(make_pair(
          make_pair(topp.first.second, topp.first.first), topp.second)));
      if (pq.empty() == 0) {
        auto bc = pq.end();
        --bc;
        auto bcc = (*bc);
        kval.insert(bcc);
        sum += bcc.first.first;
        pq.erase(pq.find(bcc));
      }
    }
    ans = max(ans, (sum + topp.first.second) * topp.first.first);
  }
  cout << ans;
  return 0;
}
