#include <bits/stdc++.h>
using namespace std;
bool comp1(pair<long long, long long> p1, pair<long long, long long> p2) {
  return p1.second > p2.second;
}
bool comp(pair<long long, long long> p1, pair<long long, long long> p2) {
  return p1.first > p1.first;
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long x, y;
  k--;
  vector<pair<long long, long long> > p, p1;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    p.push_back(make_pair(x, y));
  }
  sort(p.begin(), p.end(), comp1);
  set<long long> se;
  long long sum = 0;
  long long mm = 0;
  for (int i = 0; i < n; i++) {
    sum += p[i].first;
    while (se.size() > k) {
      auto it = se.begin();
      sum -= *it;
      se.erase(it);
    }
    mm = max(mm, sum * p[i].second);
    se.insert(p[i].first);
  }
  cout << mm;
}
