#include <bits/stdc++.h>
using namespace std;
int k, n;
struct play {
  long long len, bty;
  bool operator<(play a) const { return bty > a.bty; }
} song[300010];
priority_queue<long long, vector<long long>, greater<long long> > pq;
long long res = 0, nowlen = 0;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld%lld", &song[i].len, &song[i].bty);
  sort(song + 1, song + 1 + n);
  for (int i = 1; i <= n; i++) {
    if (pq.size() == k) {
      nowlen -= pq.top();
      pq.pop();
    }
    pq.push(song[i].len);
    nowlen += song[i].len;
    res = max(res, song[i].bty * nowlen);
  }
  printf("%lld\n", res);
  return 0;
}
