#include <bits/stdc++.h>
const int maxn = 300050;
using namespace std;
struct pp {
  int t, b;
} x[maxn];
bool operator<(pp a, pp b) { return a.b < b.b; }
int n, k;
priority_queue<long long, vector<long long>, greater<long long> > rec;
int main() {
  cin >> n >> k;
  int i, j;
  for (i = 1; i <= n; i++) scanf("%d%d", &x[i].t, &x[i].b);
  sort(x + 1, x + 1 + n);
  long long t = 0;
  long long ans = 0;
  for (i = n; i >= 1; i--) {
    if (n - i + 1 <= k) {
      rec.push(x[i].t);
      t += (long long)x[i].t;
      ans = (ans > t * (long long)x[i].b ? ans : t * (long long)x[i].b);
    } else {
      t += (long long)x[i].t;
      t -= (long long)rec.top();
      ans = (ans > t * (long long)x[i].b ? ans : t * (long long)x[i].b);
      t += (long long)rec.top();
      rec.push(x[i].t);
      t -= (long long)rec.top();
      rec.pop();
    }
  }
  cout << ans << endl;
  return 0;
}
