#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long rand_rand() {
  long long max_n = 1e18;
  long long max_cnt = rand();
  long long rand_num = 1;
  for (long long i = 1; i <= max_cnt; i++) {
    long long tmp = rand();
    if (max_n / tmp < rand_num) rand_num %= mod;
    rand_num *= tmp;
  }
  return rand_num;
}
priority_queue<long long> pq;
pair<long long, long long> s[300005];
bool cmp(pair<long long, long long> x, pair<long long, long long> y) {
  return x.second > y.second;
}
signed main() {
  srand(time(NULL));
  long long n, k;
  cin >> n >> k;
  if (rand_rand() % n == n) {
    cout << "RIP";
    return 0;
  }
  for (long long i = 1; i <= n; i++) {
    cin >> s[i].first >> s[i].second;
  }
  sort(s + 1, s + 1 + n, cmp);
  long long sum = 0;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (pq.size() < k) {
      pq.push(s[i].first);
      sum += s[i].first;
      ans = max(ans, sum * s[i].second);
    } else {
      long long t = pq.top();
      if (s[i].first > t) {
        sum += s[i].first - t;
        pq.pop();
      }
      ans = max(ans, sum * s[i].second);
    }
  }
  cout << ans;
}
