#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
struct song {
  long long t, b;
} ss[maxn];
bool cmp(song a, song b) {
  if (a.b == b.b) return a.t > b.t;
  return a.b > b.b;
}
long long sums[maxn];
priority_queue<long long, vector<long long>, greater<long long> > q;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &ss[i].t, &ss[i].b);
  }
  sort(ss + 1, ss + 1 + n, cmp);
  long long su = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i <= k) {
      q.push(ss[i].t);
      su += ss[i].t;
      sums[i] = su;
    } else {
      long long minnow = q.top();
      su -= minnow;
      su += ss[i].t;
      q.pop();
      q.push(ss[i].t);
      sums[i] = su;
    }
    ans = max(ans, su * ss[i].b);
  }
  cout << ans << endl;
}
