#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 100100;
ll n, k, ans = 0;
bool srt(pair<ll, ll> p1, pair<ll, ll> p2) {
  if (p1.first == p2.first) return p1.second < p2.second;
  return p1.first < p2.first;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  vector<pair<ll, ll>> p(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> p[i].second >> p[i].first;
  }
  p[0].first = 0, p[0].second = 0;
  sort(p.begin(), p.end(), srt);
  priority_queue<ll, vector<ll>, greater<ll>> q;
  ll sum = 0;
  for (int i = n; i >= 1; i--) {
    if (i > n - k + 1) {
      sum += p[i].second;
      q.push(p[i].second);
      ans = max(ans, sum * p[i].first);
    } else {
      ans = max(ans, (sum + p[i].second) * p[i].first);
      if (!q.empty() && q.top() < p[i].second) {
        sum -= q.top();
        sum += p[i].second;
        q.pop();
        q.push(p[i].second);
      }
    }
  }
  cout << ans;
  return 0;
}
