#include <bits/stdc++.h>
using namespace std;
priority_queue<long long int, vector<long long int>, greater<long long int>> q1;
long long int sum;
long long int n, k;
struct node {
  long long int x, y;
} mmap[400100];
int cmp(node x, node y) { return x.y > y.y; }
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> mmap[i].x >> mmap[i].y;
  }
  sort(mmap + 1, mmap + 1 + n, cmp);
  long long int maxx = 0;
  for (int i = 1; i <= n; i++) {
    maxx = max(maxx, (sum + mmap[i].x) * mmap[i].y);
    q1.push(mmap[i].x);
    sum += mmap[i].x;
    if (q1.size() >= k) {
      sum -= q1.top();
      q1.pop();
    }
  }
  cout << maxx << endl;
  return 0;
}
