#include <bits/stdc++.h>
using namespace std;
const long long mxn = 1e6 + 7;
pair<long long, long long> p[mxn];
long long cnt;
int main() {
  long long n, m, mx = -100, mn = 10000000;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> p[i].second >> p[i].first;
    mx = max(mx, (p[i].first * p[i].second));
  }
  sort(p + 1, p + n + 1);
  reverse(p + 1, p + n + 1);
  for (int i = 1; i <= m; i++) {
    cnt += p[i].second;
    mn = min(p[i].first, mn);
  }
  cout << max((cnt * mn), mx);
  return 0;
}
