#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 20;
int n, i, j, k, f[N + 1], t, b, D[N], d;
vector<pair<int, int>> h;
vector<tuple<int, int, int>> l;
long long ans, s;
int findLeft(int index) {
  while (index >= 0 && D[index]) {
    index -= D[index];
  }
  return index;
}
int main() {
  scanf("%lld%lld", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d%d", &t, &b);
    h.push_back(make_pair(t, b));
  }
  sort(h.begin(), h.end());
  for (i = 0; i < n; i++) l.push_back(make_tuple(h[i].second, h[i].first, i));
  sort(l.begin(), l.end());
  for (i = n - k + 1; i < n; i++) s += h[i].first;
  d = k;
  for (i = 0; i < n; i++) {
    int pos = get<2>(l[i]);
    if (pos >= n - d + 1) {
      s -= h[pos].first;
      int idx = findLeft(n - d);
      if (idx >= 0) s += h[idx].first;
      d = n - idx + 1;
    }
    ans = max(ans, get<0>(l[i]) * (s + get<1>(l[i])));
    if (!pos)
      D[pos] = 1;
    else
      D[pos] = D[pos] + 1;
  }
  printf("%lld", ans);
}
