#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 10;
pair<int, int> p[MAXN];
long long sum[MAXN];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &p[i].second, &p[i].first);
  }
  sort(p + 1, p + 1 + n);
  multiset<int> st;
  long long now = 0;
  long long ans = 0;
  for (int i = n; i >= 1; i--) {
    now += p[i].second;
    st.insert(p[i].second);
    if (st.size() >= k) {
      now -= *st.begin();
      st.erase(st.begin());
    }
    sum[i] = now;
  }
  for (int i = 1; i <= n; i++) {
    ans = max(ans, 1LL * p[i].first * (1LL * p[i].second + sum[i + 1]));
  }
  printf("%lld", ans);
  return 0;
}
