#include <bits/stdc++.h>
using namespace std;
struct o {
  int x, y;
};
bool ss(o a, o b) { return (a.y > b.y); }
struct ssheap {
  bool operator()(o a, o b) { return (a.x > b.x); }
};
priority_queue<o, vector<o>, ssheap> q;
const int maxn = 3e5 + 100;
int n, k;
o a[maxn];
void push(int i) {
  o u;
  u.x = a[i].x;
  u.y = a[i].y;
  q.push(u);
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
  }
  sort(a + 1, a + 1 + n, ss);
  long long s = 0;
  long long res = 0;
  int sl = 0;
  for (int i = 1; i <= n; i++) {
    push(i);
    s = s + a[i].x;
    sl++;
    while (sl > k) {
      s -= q.top().x;
      q.pop();
      sl--;
    }
    res = max(res, s * a[i].y);
  }
  cout << res;
}
