#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > q;
struct data {
  int x, y;
  inline bool operator<(const data& a) const { return y > a.y; }
} a[300005];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y);
  sort(a + 1, a + n + 1);
  long long sum = 0, ans = 0;
  for (int i = 1; i <= n; i++) {
    sum += a[i].x;
    q.push(a[i].x);
    if (i > k) {
      sum -= q.top();
      q.pop();
    }
    ans = max(ans, sum * a[i].y);
  }
  printf("%I64d\n", ans);
  return 0;
}
