#include <bits/stdc++.h>
using namespace std;
struct Info {
  long long t, b;
  bool operator<(const Info &o) const { return t == o.t ? b > o.b : t > o.t; }
};
bool cmp(const Info &a, const Info &b) {
  return a.b == b.b ? a.t > b.t : a.b > b.b;
}
Info info[300001];
int main() {
  int N, K;
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) scanf("%lld %lld", &info[i].t, &info[i].b);
  sort(info, info + N, cmp);
  priority_queue<Info> q;
  long long ans = 0, suml = 0;
  for (int i = 0; i < N; i++) {
    suml += info[i].t;
    q.push({info[i].t, info[i].b});
    while (q.size() > K) {
      suml -= q.top().t;
      q.pop();
    }
    ans = max(ans, suml * info[i].b);
  }
  printf("%lld\n", ans);
  return 0;
}
