#include <bits/stdc++.h>
using namespace std;
const long long prime = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k, t, b, ksum = 0, maxpleasure = 0;
  multiset<pair<long long, long long>> bl;
  multiset<long long> kset;
  cin >> n >> k;
  while (n--) {
    cin >> t >> b;
    bl.insert(make_pair(b, t));
  }
  for (auto it = bl.rbegin(); it != bl.rend(); it++) {
    b = (*it).first;
    t = (*it).second;
    ksum += t;
    kset.insert(t);
    if (kset.size() > k) {
      auto f = kset.begin();
      ksum -= (*f);
      kset.erase(f);
    }
    maxpleasure = max(maxpleasure, b * ksum);
  }
  cout << maxpleasure;
  return 0;
}
