#include <bits/stdc++.h>
using namespace std;
priority_queue<long long, vector<long long>, greater<long long> > q;
struct poi {
  long long t, b;
} a[1000000];
long long cmp(const poi &aa, const poi &bb) {
  if (aa.b != bb.b) return aa.b > bb.b;
  return aa.t > bb.t;
}
long long n, k, ans, ans2;
int main() {
  scanf("%I64d%I64d", &n, &k);
  for (long long i = 1; i <= n; i++) scanf("%I64d%I64d", &a[i].t, &a[i].b);
  sort(a + 1, a + n + 1, cmp);
  for (long long i = 1; i <= k; i++) {
    q.push(a[i].t);
    ans2 += a[i].t;
    ans = max(ans, a[i].b * ans2);
  }
  for (long long i = k + 1; i <= n; i++) {
    long long kk = q.top();
    if (a[i].t > kk) {
      q.pop();
      q.push(a[i].t);
      ans2 += a[i].t - kk;
      ans = max(ans, a[i].b * ans2);
    }
  }
  cout << ans << endl;
  return 0;
}
