#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  pair<int, int> a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i].second >> a[i].first;
  }
  sort(a, a + n, greater<pair<int, int>>());
  multiset<int> s;
  long long ans = 0, Total_length = 0;
  for (int i = 0; i < n; i++) {
    Total_length += a[i].second;
    s.insert(a[i].second);
    if (s.size() > k) {
      Total_length -= *s.begin();
      s.erase(s.begin());
    }
    ans = max(ans, Total_length * a[i].first);
  }
  cout << ans << endl;
}
