#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
long long n, k;
struct name {
  long long t, b;
} a[1000000];
bool cmp(name i, name j) {
  if (i.b == j.b) return i.t > j.t;
  return i.b > j.b;
}
int main() {
  scanf("%lld %lld", &n, &k);
  for (long long i = 0; i < n; i++) {
    scanf("%lld %lld", &a[i].t, &a[i].b);
  }
  sort(a, a + n, cmp);
  long long res1 = 0, res2 = 0;
  multiset<long long> mul;
  for (int i = 0; i < n; i++) {
    if (mul.size() < k) {
      mul.insert(a[i].t);
      res1 += a[i].t;
    } else if (!mul.empty() && *mul.begin() < a[i].t) {
      res1 -= *mul.begin();
      mul.erase(mul.begin());
      mul.insert(a[i].t);
      res1 += a[i].t;
    }
    res2 = max(res2, res1 * a[i].b);
  }
  printf("%lld\n", res2);
  return 0;
}
