#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
int n;
struct node {
  long long t, b;
} a[MAXN];
bool cmp(node a, node b) {
  if (a.b == b.b) return a.t < b.t;
  return a.b < b.b;
}
priority_queue<int, vector<int>, greater<int> > q;
int main() {
  int n, k;
  while (~scanf("%d%d", &n, &k)) {
    while (!q.empty()) q.pop();
    for (int i = 1; i <= n; i++) {
      scanf("%I64d%I64d", &a[i].t, &a[i].b);
    }
    sort(a + 1, a + n + 1, cmp);
    long long ans = 0, sum = 0;
    for (int i = n; i >= 1; i--) {
      if (i == n - k) break;
      sum += (long long)a[i].t;
      q.push(a[i].t);
      ans = max((long long)sum * a[i].b, ans);
    }
    if (n > k) {
      sum -= q.top();
      q.pop();
      for (int i = n - k; i >= 1; i--) {
        sum += (long long)a[i].t;
        q.push(a[i].t);
        ans = max((long long)sum * a[i].b, ans);
        sum -= q.top();
        q.pop();
      }
    }
    cout << ans << endl;
  }
  return 0;
}
