#include <bits/stdc++.h>
using namespace std;
struct node {
  int t, b;
} a[1000010];
priority_queue<int> q;
template <typename _T>
void rd(_T &x) {
  int f = 1;
  x = 0;
  char s = getchar();
  while (s > '9' || s < '0') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9')
    x = (x << 3) + (x << 1) + (s - '0'), s = getchar();
  x *= f;
}
inline bool cmp(const node &x, const node &y) { return x.b > y.b; }
int main() {
  int n, k;
  rd(n), rd(k);
  for (int i = 1; i <= n; i++) rd(a[i].t), rd(a[i].b);
  sort(a + 1, a + 1 + n, cmp);
  long long ans = 0, now = 0;
  for (int i = 1; i <= n; i++) {
    now += a[i].t;
    q.push(-a[i].t);
    if ((int)(q.size()) > k) now += q.top(), q.pop();
    ans = max(ans, now * a[i].b);
  }
  printf("%lld", ans);
  return 0;
}
