#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.second > b.second;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long>> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i].first >> vec[i].second;
  }
  sort(vec.begin(), vec.end(), cmp);
  long long ans = 0;
  long long sum = 0;
  long long sz = 0;
  priority_queue<int, vector<int>, greater<int>> mpq;
  for (int i = 0; i < n; i++) {
    long long tans = 0;
    mpq.push(vec[i].first);
    if (i == 0) {
      tans = vec[i].first * vec[i].second;
      mpq.push(vec[i].first);
      sz++;
      sum = vec[i].first;
    } else {
      if (sz < k) {
        sum += vec[i].first;
        tans = sum * vec[i].second;
        mpq.push(vec[i].first);
        sz++;
      } else {
        if (mpq.top() < vec[i].first) {
          sum = sum - mpq.top();
          mpq.pop();
          sum += vec[i].first;
          mpq.push(vec[i].first);
          tans = sum * vec[i].second;
        } else {
          sum = sum - mpq.top();
          sum += vec[i].first;
          tans = sum * vec[i].second;
          sum = sum - vec[i].first + mpq.top();
        }
      }
    }
    if (tans > ans) {
      ans = tans;
    }
  }
  cout << ans << endl;
  return 0;
}
