#include <bits/stdc++.h>
using namespace std;
bool operator<(pair<unsigned long long, unsigned long long> a,
               pair<unsigned long long, unsigned long long> b) {
  return a.first > b.first;
}
bool operator>(pair<unsigned long long, unsigned long long> a,
               pair<unsigned long long, unsigned long long> b) {
  return a.first < b.first;
}
priority_queue<pair<unsigned long long, unsigned long long> > pq;
bool cmp(pair<unsigned long long, unsigned long long> a,
         pair<unsigned long long, unsigned long long> b) {
  return a.second < b.second;
}
pair<unsigned long long, unsigned long long> mas[400000];
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> mas[i].first >> mas[i].second;
  unsigned long long res = 0;
  sort(mas, mas + n, cmp);
  unsigned long long sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    sum += mas[i].first;
    pq.push(mas[i]);
    if (pq.size() == k + 1) {
      sum -= pq.top().first;
      pq.pop();
    }
    unsigned long long temp = mas[i].second * (sum);
    res = max(res, temp);
  }
  cout << res << "\n";
  return 0;
}
