#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k, x, y;
  cin >> n >> k;
  pair<long long, long long> s[n];
  set<pair<long long, int> > r;
  for (int i = 0; i < n; i++) cin >> s[i].second >> s[i].first;
  sort(s, s + n);
  x = 0;
  y = 0;
  for (int i = n - 1; i >= 0; i--) {
    r.insert({s[i].second, i});
    x += s[i].second;
    if (r.size() > k) {
      auto j = r.begin();
      x -= j->first;
      if (j->second != i) y = max(y, x * s[i].first);
      r.erase(j);
    } else
      y = max(y, x * s[i].first);
  }
  cout << y;
  return 0;
}
