#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.second >= b.second; }
bool cmp1(pair<int, int> a, pair<int, int> b) { return a.first >= b.first; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, k;
  cin >> n >> k;
  vector<pair<int, int> > v;
  int t, b;
  for (int i = 0; i < n; ++i) {
    cin >> t >> b;
    v.push_back(make_pair(t, b));
  }
  sort(v.begin(), v.end(), cmp);
  long long int ans = 0;
  long long int l = 0;
  for (int i = 0; i < k; ++i) {
    l += v[i].first;
    ans = max(ans, l * (v[i].second));
  }
  sort(v.begin(), v.end(), cmp1);
  l = 0;
  int mini = v[0].second;
  for (int i = 0; i < k; ++i) {
    l += v[i].first;
    mini = min(mini, v[i].second);
    ans = max(ans, l * mini);
  }
  cout << ans << endl;
  return 0;
}
