#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535897932;
const int mod = 1e9 + 7;
int max(int a, int b) {
  if (a > b) return a;
  return b;
}
int min(int a, int b) {
  if (a < b) return a;
  return b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  pair<long long, long long> p[n];
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    p[i].first = b;
    p[i].second = a;
  }
  sort(p, p + n);
  multiset<long long> s;
  long long ans = 0, sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    sum += p[i].second;
    s.insert(p[i].second);
    if ((int)s.size() > k) {
      sum = sum - (*s.begin());
      s.erase(s.begin());
    }
    ans = max(ans, (long long)sum * p[i].first);
  }
  cout << ans << "\n";
}
