#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
multiset<int> s;
multiset<int>::iterator it;
int n, k;
pair<int, int> a[N];
long long int sum, ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i].second >> a[i].first;
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    sum += a[i].second;
    s.insert(a[i].second);
    if (s.size() > k) {
      it = s.begin();
      sum -= *it;
      s.erase(it);
    }
    ans = max(ans, sum * a[i].first);
  }
  cout << ans << endl;
}
