#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<pair<long long, long long>> v;
long long ans, x, y, a[300005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back({y, x});
  }
  sort(v.begin(), v.end());
  for (int i = 1; i <= n; i++) a[i] = v[i - 1].second + a[i - 1];
  for (int i = 0; i < n; i++) {
    if (n - k > i)
      ans = max(ans, (a[n] - a[n - k + 2] + v[i].second) * v[i].first);
    else
      ans = max(ans, (a[n] - a[i]) * v[i].first);
  }
  cout << ans;
  return 0;
}
