#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> v[300006];
int main() {
  long long n, m, ans = 0, res = 0;
  cin >> n >> m;
  set<long long> s;
  for (int i = 0; i < n; i++) {
    long long p, q;
    cin >> p >> q;
    v[i] = make_pair(q, p);
  }
  sort(v, v + n);
  for (int i = n - 1; i >= 0; i--) {
    res += v[i].second;
    s.insert(v[i].second);
    while (s.size() > m) {
      res -= *s.begin();
      s.erase(s.begin());
    }
    ans = max(ans, res * v[i].first);
  }
  cout << ans << endl;
  return 0;
}
