#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<long long int, long long int> > pq;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n, k;
  cin >> n >> k;
  for (long long int i = 1; i <= n; i++) {
    long long int t, b;
    cin >> t >> b;
    pq.push({b, t});
  }
  long long int fr = 0, se = 1e6 + 5;
  long long int cnt = 0, ans = -1, cur = 0;
  while (cnt <= k) {
    pair<long long int, long long int> go = pq.top();
    fr += go.second;
    se = min(se, go.first);
    pq.pop();
    cur = (fr * se);
    ans = max(ans, cur);
    cnt++;
  }
  cout << ans << "\n";
  return 0;
}
