#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<pair<int, int> > v;
multiset<int> myset;
long long sum[300005];
int main() {
  int i, j;
  scanf("%d", &n);
  scanf("%d", &k);
  for (i = 1; i <= n; i++) {
    int t, b;
    scanf("%d", &t);
    scanf("%d", &b);
    v.push_back({b, t});
  }
  sort(v.begin(), v.end());
  for (i = n - 1, j = 1; j <= k; i--, j++) {
    sum[i] = sum[i + 1] + v[i].second;
    myset.insert(v[i].second);
  }
  for (; i >= 0; i--) {
    sum[i] = sum[i + 1];
    int val = *myset.begin();
    if (v[i].second > val) {
      sum[i] -= val;
      sum[i] += v[i].second;
      myset.erase(myset.find(val));
      myset.insert(v[i].second);
    }
  }
  long long ans = 0;
  for (i = 0; i < n; i++) {
    ans = max(ans, v[i].first * sum[i]);
  }
  cout << ans << endl;
  return 0;
}
