#include <bits/stdc++.h>
using namespace std;
inline long long int power(long long int a, long long int p) {
  long long int res = 1, x = a;
  while (p) {
    if (p & 1) res = (res * x);
    x = (x * x), p >>= 1;
  }
  return res;
}
inline long long int big_mod(long long int a, long long int p,
                             long long int m) {
  long long int res = 1 % m, x = a % m;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m, p >>= 1;
  }
  return res;
}
const long long int INF = 1e15;
const int nax = 3e5 + 5;
pair<long long int, long long int> ara[nax];
int n, k;
priority_queue<long long int, vector<long long int>, greater<long long int> >
    PQ;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> ara[i].second >> ara[i].first;
  }
  sort(ara, ara + n);
  long long int res = 0;
  long long int sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    PQ.push(ara[i].second);
    sum += ara[i].second;
    res = max(res, ara[i].first * sum);
    if (PQ.size() == k) {
      sum -= PQ.top();
      PQ.pop();
    }
  }
  cout << res << endl;
  return 0;
}
