#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
struct Song {
  long long t, b;
} a[N];
int n, k;
long long sum, ans;
priority_queue<long long, vector<long long>, greater<long long> > q;
bool CMP(Song a, Song b) { return a.b > b.b; }
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld%lld", &a[i].t, &a[i].b);
  sort(a + 1, a + n + 1, CMP);
  for (int i = 1; i <= n; i++) {
    if (i <= k)
      q.push(a[i].t), sum += a[i].t;
    else if (q.top() < a[i].t)
      sum -= q.top(), q.pop(), q.push(a[i].t), sum += a[i].t;
    ans = max(ans, sum * a[i].b);
  }
  printf("%lld", ans);
}
