#include <bits/stdc++.h>
using namespace std;
pair<int, int> nums[300300];
long long sum[300300];
bool cmp(pair<int, int> &a, pair<int, int> &b) {
  if (a.second != b.second) return a.second > b.second;
  return a.first < b.first;
}
int main(int argc, char **argv) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    sum[i] = 0LL;
    cin >> nums[i].first >> nums[i].second;
  }
  sort(nums, nums + N, cmp);
  long long r = 0LL, soma = 0LL;
  priority_queue<int, vector<int>, greater<int> > pq;
  for (int i = 0; i < N; i++) {
    soma += nums[i].first;
    if (i >= K) {
      soma -= pq.top();
      pq.pop();
    }
    pq.push(nums[i].first);
    r = max(r, soma * nums[i].second);
  }
  cout << r << endl;
  return 0;
}
