#include <bits/stdc++.h>
using namespace std;
int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }
int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; }
bool cmp(pair<long long int, long long int> a,
         pair<long long int, long long int> b) {
  if (a.second == b.second) return a.first > b.first;
  return a.second > b.second;
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  pair<long long int, long long int> ran[n + 1];
  for (int i = (1); i <= (n); ++i) {
    cin >> ran[i].first >> ran[i].second;
  }
  sort(ran + 1, ran + 1 + n, cmp);
  for (int i = (1); i <= (n); ++i) {
  }
  long long int sum = 0, beaut = 1e10;
  long long int ans = 0;
  long long int siz = 0;
  priority_queue<long long int, vector<long long int>, greater<long long int>>
      q;
  for (int i = (1); i <= (k); ++i) {
    q.push(ran[i].first);
    sum += ran[i].first;
    beaut = min(ran[i].second, beaut);
    ans = max(ans, sum * beaut);
  }
  for (int i = (k + 1); i <= (n); ++i) {
    long long int x = q.top();
    beaut = min(ran[i].second, beaut);
    if (x < ran[i].first) {
      q.pop();
      sum -= x;
      q.push(ran[i].first);
      sum += ran[i].first;
    }
    ans = max(ans, sum * beaut);
  }
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  t = 1;
  while (t--) solve();
}
