#include <bits/stdc++.h>
#pragma GCC optimize("-Ofast", "-funroll-all-loops")
using namespace std;
const long long N = 3e5 + 10;
long long n, k, res, sum;
struct node {
  long long l, v;
} t[N];
long long cmp(node a, node b) { return a.v == b.v ? a.l > b.l : a.v > b.v; }
priority_queue<long long, vector<long long>, greater<long long> > q;
signed main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) scanf("%lld %lld", &t[i].l, &t[i].v);
  sort(t + 1, t + 1 + n, cmp);
  for (long long i = 1; i <= n; i++) {
    if (q.size() < k)
      q.push(t[i].l), sum += t[i].l;
    else if (q.top() < t[i].l)
      sum += t[i].l - q.top(), q.pop(), q.push(t[i].l);
    res = max(res, sum * t[i].v);
  }
  cout << res;
  return 0;
}
