#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e18 + 7;
const long long N = 3e5 + 5;
struct node {
  long long t, b;
} a[N];
priority_queue<long long, vector<long long>, greater<long long> > q;
bool cmp(node a, node b) { return a.b > b.b; }
int main() {
  long long i, j, k, l = 0;
  long long n, m, t;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i].t >> a[i].b;
  sort(a, a + n, cmp);
  long long ans = a[0].t * a[0].b;
  q.push(a[0].t);
  long long s = a[0].t;
  for (i = 1; i < n; i++) {
    q.push(a[i].t);
    s += a[i].t;
    while (q.size() > k) s -= q.top(), q.pop();
    ans = max(ans, s * a[i].b);
  }
  cout << ans << endl;
  return 0;
}
