#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<pair<long long, long long>> v;
  for (int i = 0; i < n; i++) {
    long long t, b;
    cin >> t >> b;
    v.push_back({b, t});
  }
  sort(v.begin(), v.end(), greater<pair<long long, long long>>());
  long long temp = INT_MAX;
  long long ans = 0, sum = 0;
  priority_queue<long long, vector<long long>, greater<long long>> pq;
  for (int i = 0; i < n; i++) {
    if (i < k) {
      sum += v[i].second;
      ans = max(ans, sum * v[i].first);
      temp = min(temp, v[i].second);
      pq.push(v[i].second);
    } else {
      long long p = sum + v[i].second - pq.top();
      ans = max(ans, p * v[i].first);
      if (pq.top() < v[i].second) {
        sum = sum + v[i].second - pq.top();
        pq.pop();
        pq.push(v[i].second);
      }
    }
  }
  cout << ans << endl;
}
