#include <bits/stdc++.h>
using namespace std;
int n, m;
struct Node {
  long long x, y;
} Edge[300005];
long long pre[300005];
bool cmp(Node a, Node b) { return a.y > b.y; }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &Edge[i].x, &Edge[i].y);
  }
  sort(Edge + 1, Edge + n + 1, cmp);
  priority_queue<int, vector<int>, greater<int>> q;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (q.size() < m) {
      q.push(Edge[i].x);
      pre[i] = pre[i - 1] + Edge[i].x;
      ans = max(ans, Edge[i].y * pre[i]);
    } else {
      if (Edge[i].x <= q.top()) {
        pre[i] = pre[i - 1];
      } else {
        pre[i] = pre[i - 1] - q.top() + Edge[i].x;
        q.pop();
        q.push(Edge[i].x);
        ans = max(ans, Edge[i].y * pre[i]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
