#include <bits/stdc++.h>
using namespace std;
long long i, j, n, m, k, l, ans, t;
struct node {
  long long t, d;
} a[300001];
priority_queue<long long> q;
bool cmp(node x, node y) { return x.d > y.d; }
signed main() {
  scanf("%lld%lld", &n, &k);
  for (register long long i = 1; i <= n; i++)
    scanf("%lld%lld", &a[i].t, &a[i].d);
  sort(a + 1, a + n + 1, cmp);
  for (register long long i = 1; i <= n; i++) {
    t += a[i].t;
    q.push(-a[i].t);
    if ((long long)q.size() > k) t += q.top(), q.pop();
    ans = max(ans, t * a[i].d);
  }
  cout << ans << endl;
}
