#include <bits/stdc++.h>
using namespace std;
priority_queue<long long, vector<long long>, greater<long long>> q;
long long cmp(pair<long long, long long> f1, pair<long long, long long> f2) {
  return f1.second >= f2.second;
}
int main() {
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long>> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
  sort((v).begin(), (v).end(), cmp);
  long long sum = 0, ans = 0;
  for (long long i = 0; i < n; i++) {
    if (q.size() == k) {
      sum -= q.top();
      q.pop();
    }
    q.push(v[i].first);
    sum += v[i].first;
    ans = max(sum * v[i].second, ans);
  }
  cout << ans << '\n';
}
