#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<array<long long, 2>> A(n);
  for (auto& a : A) cin >> a[1] >> a[0];
  sort(A.begin(), A.end());
  long long ats = 0;
  for (long long i = n - 1, pf = 0; i >= n - k; i--)
    pf += A[i][1], ats = max(ats, pf * A[i][0]);
  cout << ats;
}
