#include <bits/stdc++.h>
using namespace std;
bool fun(pair<long long, long long> x, pair<long long, long long> y) {
  if (x.second != y.second) return x.second > y.second;
  return x.first > y.first;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T, i, j;
  long long n, k;
  cin >> n >> k;
  pair<long long, long long> a[n];
  for (i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;
  sort(a, a + n + 2, fun);
  long long sum = 0, m = 0, mi = INT_MAX, c = 0;
  for (i = 1; i <= n; i++) {
    if (c == k) break;
    if (((sum + a[i].first) * min(mi, a[i].second)) >= m) {
      m = ((sum + a[i].first) * min(mi, a[i].second));
      sum += a[i].first;
      mi = min(a[i].second, mi);
      c++;
    }
  }
  cout << m << "\n";
  return 0;
}
