#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  long long t = 1;
  while (t--) {
    long long n, k, ans = 0, sum = 0;
    cin >> n >> k;
    vector<pair<long long, long long>> v;
    for (long long i = 0; i < n; i++) {
      long long a, b;
      cin >> a >> b;
      v.push_back({b, a});
    }
    sort(v.begin(), v.end());
    set<pair<long long, long long>> s;
    for (long long i = n - 1; i >= 0; i--) {
      sum += v[i].second;
      s.insert({v[i].second, i});
      while (s.size() > k) {
        auto it = s.begin();
        sum -= it->first;
        s.erase(*it);
      }
      ans = max(ans, sum * v[i].first);
    }
    cout << ans;
  }
  return 0;
}
