#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> ara[300005];
set<pair<long long, long long> > s;
int main() {
  long long n, k;
  scanf("%lld", &n);
  scanf("%lld", &k);
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &ara[i].second);
    scanf("%lld", &ara[i].first);
  }
  sort(ara, ara + n);
  long long tot = 0, ans = 0;
  for (long long i = n - 1; i >= 0; i--) {
    s.insert(make_pair(ara[i].second, i));
    tot += ara[i].second;
    while (s.size() > k) {
      auto it = s.begin();
      tot -= it->first;
      s.erase(it);
    }
    long long h = tot * ara[i].first;
    if (h > ans) ans = h;
  }
  printf("%lld\n", ans);
}
