#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<long long int, long long int>& a,
         pair<long long int, long long int>& b) {
  return a.second > b.second;
}
bool cmp1(pair<long long int, long long int>& a,
          pair<long long int, long long int>& b) {
  return a.first > b.first;
}
int solution() {
  long long int n, m, y = 0, z = 0, x = 0, x1 = 0, temp = 0, temp1 = 0, i = 0,
                      j = 0, md = 1000000007, ans = 0, a, b, k;
  char ch;
  cin >> n >> k;
  vector<pair<long long int, long long int>> v;
  vector<long long int> v2;
  for (i = 0; i < n; i++) {
    cin >> temp;
    cin >> temp1;
    v.push_back(make_pair(temp, temp1));
  }
  sort(v.begin(), v.end(), cmp);
  long long int s = 0;
  x = 0;
  a = 0;
  priority_queue<int, vector<int>, greater<int>> gquiz;
  for (int i = 0; i < n; i++) {
    s += v[i].first;
    gquiz.push(v[i].first);
    if (i >= k) {
      a = gquiz.top();
      gquiz.pop();
      s -= a;
    }
    m = v[i].second;
    x = max(x, s * m);
  }
  cout << x;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t, qwe = 0;
  t = 1;
  while (t--) {
    solution();
    cout << "\n";
  }
  return 0;
}
