#include <bits/stdc++.h>
using namespace std;
struct str {
  long long ts;
  long long bs;
};
bool compare(str x, str y) { return x.bs > y.bs; }
vector<str> v;
int main() {
  long long n, k;
  scanf("%lld %lld", &n, &k);
  for (int i = 0; i < n; i++) {
    long long t, b;
    scanf("%lld %lld", &t, &b);
    v.push_back({t, b});
  }
  sort(v.begin(), v.end(), compare);
  long long maxi = 0, sum = 0;
  priority_queue<long long, vector<long long>, greater<long long> > q;
  for (int i = 0; i < n; i++) {
    sum += v[i].ts;
    q.push(v[i].ts);
    if (q.size() > k) {
      sum -= q.top();
      q.pop();
    }
    maxi = max(maxi, v[i].bs * sum);
  }
  cout << maxi << endl;
  return 0;
}
