#include <bits/stdc++.h>
using namespace std;
int t[300000];
int b[300000];
int idx[300000];
int n, k;
bool comp(int i, int j) { return b[i] > b[j]; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> t[i] >> b[i];
    idx[i] = i;
  }
  sort(idx, idx + n, comp);
  priority_queue<int, vector<int>, greater<int>> pq;
  long long sum = 0;
  long long res = 0;
  for (int i_ = 0; i_ < n; i_++) {
    int i = idx[i_];
    res = max(res, (sum + t[i]) * b[i]);
    if (pq.size() == k - 1) {
      if (!pq.empty() && pq.top() < t[i]) {
        sum -= pq.top();
        pq.pop();
      }
    }
    if (pq.size() < k - 1) {
      pq.push(t[i]);
      sum += t[i];
    }
  }
  cout << res << '\n';
}
