#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, a, b, ss = 0, ans = 0;
  multiset<long long> s;
  vector<pair<long long, long long>> x;
  cin >> n >> m;
  for (int i = 0; i < n; i += 1) {
    cin >> a >> b;
    x.push_back({b, a});
  }
  sort(x.begin(), x.end());
  for (int i = n - 1; i >= 0; i -= 1) {
    s.insert(x[i].second);
    ss += x[i].second;
    if (s.size() > m) {
      ss -= *s.begin();
      s.erase(s.begin());
    }
    ans = max(ans, ss * x[i].first);
  }
  cout << ans;
}
