#include <bits/stdc++.h>
using namespace std;
long long int f[500005] = {0};
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int i;
  vector<pair<long long int, long long int>> v;
  for (i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    v.push_back(make_pair(y, x));
  }
  long long int ans, answer = INT_MIN;
  set<long long int> s;
  long long int z, sum = 0;
  sort(v.begin(), v.end(), sortinrev);
  for (i = 0; i < n; i++) {
    if (i < k) {
      sum = sum + v[i].second;
      ans = v[i].first * sum;
      s.insert(v[i].second);
      answer = max(answer, ans);
    } else {
      z = *s.begin();
      s.erase(s.begin());
      ans = (sum - z + v[i].second) * v[i].first;
      answer = max(ans, answer);
      s.insert(max(v[i].second, z));
    }
  }
  cout << answer << endl;
}
