#include <bits/stdc++.h>
using namespace std;
struct inf {
  long long v;
  long long b;
};
bool cmp(struct inf a, struct inf c) { return a.b > c.b; }
int main() {
  struct inf a[300005];
  long long n, k, i, j, sum = 0, ans = -1, temp;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i].v >> a[i].b;
  }
  sort(a, a + n, cmp);
  priority_queue<long long, vector<long long>, greater<long long>> q;
  for (i = 0; i < n; i++) {
    if (i < k) {
      sum += a[i].v;
      q.push(a[i].v);
      ans = max(ans, sum * a[i].b);
    } else {
      temp = q.top();
      if (temp < a[i].v) {
        sum -= temp;
        q.pop();
        q.push(a[i].v);
        sum += a[i].v;
        ans = max(ans, sum * a[i].b);
      }
    }
  }
  cout << ans;
  return 0;
}
