#include <bits/stdc++.h>
using namespace std;
long long dp[1005], mx, sum;
set<pair<long long, long long> > st;
long long ans[100005];
pair<long long, long long> a[555555];
int main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> a[i].second >> a[i].first;
  sort(a + 1, a + n + 1);
  for (long long i = n; i >= 1; i--) {
    sum += a[i].second;
    st.insert(make_pair(a[i].second, i));
    if (st.size() > m) {
      auto it = st.begin();
      sum -= it->first;
      st.erase(it);
    }
    mx = max(mx, sum * a[i].first);
  }
  cout << mx;
  return 0;
}
