#include <bits/stdc++.h>
using namespace std;
template <class T>
void Max(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
void Min(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
const int N = (int)3e5 + 5;
int len[N], val[N];
int id[N];
priority_queue<int, vector<int>, greater<int> > pque;
bool cmp(int a, int b) { return val[a] > val[b]; }
int main() {
  ios::sync_with_stdio(false);
  int n, K;
  cin >> n >> K;
  for (int i = (0), _t = (n); i < _t; ++i) {
    cin >> len[i] >> val[i];
    id[i] = i;
  }
  sort(id, id + n, cmp);
  long long ans = 0;
  long long sum = 0;
  for (int i = (0), _t = (n); i < _t; ++i) {
    int tar = id[i];
    sum += len[tar];
    pque.push(len[tar]);
    if (pque.size() > K) {
      sum -= pque.top();
      pque.pop();
    }
    Max(ans, sum * val[tar]);
  }
  cout << ans << endl;
  return 0;
}
