#include <bits/stdc++.h>
using namespace std;
const int MAX = 3e5 + 10;
struct node {
  int t;
  int b;
} nod[MAX];
long long sum[MAX];
bool cmp(node aa, node bb) { return aa.b > bb.b; }
priority_queue<int, vector<int>, greater<int> > q;
int main() {
  int k, n, K;
  long long ans = 0, sum = 0, tmp;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d %d", &nod[i].t, &nod[i].b);
  sort(nod + 1, nod + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    if (q.size() < k) {
      sum += nod[i].t;
      q.push(nod[i].t);
    } else {
      sum -= q.top();
      q.pop();
      q.push(nod[i].t);
      sum += nod[i].t;
    }
    tmp = sum * nod[i].b;
    if (tmp > ans) ans = tmp;
  }
  printf("%lld\n", ans);
  return 0;
}
