#include <bits/stdc++.h>
using namespace std;
struct node {
  long long x, y;
} a[300005];
priority_queue<int, vector<int>, greater<int> > q;
bool cmp(node o, node p) { return o.y > p.y; }
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  long long maxn = 0, s = 0;
  for (int i = 0; i < n; i++) scanf("%lld %lld", &a[i].x, &a[i].y);
  sort(a, a + n, cmp);
  for (int i = 0; i < n; i++) {
    s += a[i].x;
    q.push(a[i].x);
    if (q.size() > k) {
      s -= q.top();
      q.pop();
    }
    maxn = max(maxn, s * a[i].y);
  }
  printf("%lld\n", maxn);
  return 0;
}
