#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma target("sse", "sse1")
using namespace std;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
int n, k;
pair<long long, long long> a[300000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i].second >> a[i].first;
  sort(a, a + n);
  long long len = 0;
  multiset<long long> s;
  long long ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    s.insert(a[i].second);
    len += a[i].second;
    if (s.size() > k) {
      len -= *s.begin();
      s.erase(s.begin());
    }
    ans = max(ans, len * a[i].first);
  }
  cout << ans;
  return 0;
}
