#include <bits/stdc++.h>
using namespace std;
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.second != b.second)
    return a.second > b.second;
  else
    return a.first > b.first;
}
int main() {
  ios_base ::sync_with_stdio(false);
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long> > arr(n + 1);
  for (int i = 0; i < n; i++) cin >> arr[i].first >> arr[i].second;
  sort(arr.begin(), arr.end(), comp);
  vector<long long> ans(k, 0);
  long long sum = arr[0].first;
  long long maxm = arr[0].first * arr[0].second;
  priority_queue<int, vector<int>, greater<int> > q;
  q.push(arr[0].first);
  for (int i = 1; i < n; i++) {
    if (q.size() == k && arr[i].first <= q.top()) continue;
    q.push(arr[i].first);
    sum += arr[i].first;
    while (q.size() > k) {
      sum -= q.top();
      q.pop();
    }
    maxm = max(maxm, sum * arr[i].second);
  }
  cout << maxm;
}
