#include <bits/stdc++.h>
using namespace std;
struct node {
  long long v, t;
  bool operator<(node x) const { return v < x.v; }
} a[300010];
priority_queue<long long, vector<long long>, greater<long long>> q;
long long n, k, sum, ans;
signed main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i].t >> a[i].v;
  }
  sort(a + 1, a + n + 1);
  for (long long i = n; i >= 1; i--) {
    long long f = q.size();
    if (f < k) {
      q.push(a[i].t);
      sum += a[i].t;
    }
    if (f >= k && a[i].t > q.top()) {
      sum -= q.top();
      q.pop();
      sum += a[i].t;
      q.push(a[i].t);
    }
    ans = max(ans, a[i].v * sum);
  }
  cout << ans;
}
