#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<long long, long long> x, pair<long long, long long> y) {
  if (x.second != y.second)
    return x.second > y.second;
  else
    return x.first > y.first;
}
void solve() {
  long long n, k, _max = 0;
  cin >> n >> k;
  pair<long long, long long> songs[n + 5];
  for (int i = 0; i < n; ++i) cin >> songs[i].first >> songs[i].second;
  sort(songs, songs + n, cmp);
  long long pre[n + 5], _sum = 0;
  priority_queue<long long, vector<long long>, greater<long long> > pq;
  for (int i = 0; i < n; ++i) {
    pq.push(songs[i].first);
    _sum += songs[i].first;
    if (i >= k) {
      _sum -= pq.top();
      pq.pop();
    }
    pre[i] = _sum;
  }
  for (int i = 0; i < n; ++i) _max = max(_max, pre[i] * songs[i].second);
  cout << _max << '\n';
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
