#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const double Pi = 3.1415926535897932;
const int dir[4][2] = {-1, 0, 0, -1, 1, 0, 0, 1};
const int maxn = 3e5 + 5;
struct node {
  int t;
  int len;
  bool operator<(const node &oth) const { return len > oth.len; }
} w[maxn];
int n, k;
bool cmp(node &a, node &b) { return a.t > b.t; }
priority_queue<node> pq;
long long sum = 0;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d%d", &w[i].len, &w[i].t);
  sort(w + 1, w + 1 + n, cmp);
  long long ans = -1;
  for (int i = 1; i <= n; i++) {
    long long t;
    t = (sum + w[i].len) * w[i].t;
    ans = max(ans, t);
    pq.push(w[i]);
    sum += w[i].len;
    if (pq.size() == k) {
      sum -= pq.top().len;
      pq.pop();
    }
  }
  printf("%lld\n", ans);
  return 0;
}
