#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long int LINF = 0x3f3f3f3f3f3f3f3fll;
int n, k;
multiset<int> second;
long long int sum = 0;
void poe(int x) {
  if (second.size() < k) {
    second.insert(x);
    sum += x;
    return;
  }
  if (x < *second.begin()) return;
  sum -= *second.begin();
  second.erase(second.begin());
  second.insert(x);
  sum += x;
}
int main() {
  scanf("%d%d", &n, &k);
  vector<pair<int, int> > v(n);
  for (auto& i : v) scanf("%d%d", &i.first, &i.second);
  sort(v.begin(), v.end(),
       [](pair<int, int> a, pair<int, int> b) { return a.second < b.second; });
  long long int ans = -INF;
  for (int i = n - 1; i + 1; i--) {
    poe(v[i].first);
    while (i and v[i - 1].second == v[i].second) {
      i--;
      poe(v[i].first);
    }
    ans = max(ans, sum * v[i].second);
  }
  printf("%lld\n", ans);
  return 0;
}
