#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  priority_queue<int, vector<int>, greater<int> > pq;
  pair<int, int> a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i].second >> a[i].first;
  }
  sort(a, a + n);
  long long int sum1 = 0;
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i < k) {
      sum1 += a[n - i - 1].second;
      pq.push(a[n - i - 1].second);
      ans = max(ans, sum1 * a[n - i - 1].first);
    } else {
      if (pq.top() < a[n - i - 1].second) {
        int a1 = pq.top();
        pq.pop();
        pq.push(a[n - i - 1].second);
        sum1 -= a1;
        sum1 += a[n - i - 1].second;
        ans = max(ans, sum1 * a[n - i - 1].first);
      }
    }
  }
  cout << ans;
}
