#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<pair<long long, long long> > all(n);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    all.push_back(make_pair(b, a));
  }
  sort(all.rbegin(), all.rend());
  long long miin = 1e9;
  long long maax = 0;
  set<long long> has;
  long long ans = 0;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    if (has.size() < k) {
      has.insert(all[i].second);
      miin = min(all[i].second, miin);
      maax = max(all[i].second, maax);
      sum += all[i].second;
      ans = max(ans, sum * all[i].first);
    } else if (all[i].second > miin && has.size() == k) {
      has.erase(miin);
      has.insert(all[i].second);
      sum += all[i].second;
      sum -= miin;
      miin = *(--has.rend());
      maax = *has.rbegin();
      ans = max(ans, sum * all[i].first);
    } else if (has.size() == k) {
      ans = max(ans, (sum - miin + all[i].second) * all[i].first);
    }
  }
  cout << ans;
}
