#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000 + 100;
const int INF = 0x3f3f3f3f;
const double inf = 1e15;
const unsigned long long mod = 1000000007;
const double eps = 1e-8;
int n, k;
pair<int, int> a[maxn];
unsigned long long sum[maxn];
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  return a.second > b.second;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  priority_queue<int, vector<int>, greater<int>> que;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a + 1, a + n + 1, cmp);
  unsigned long long sum = 0;
  unsigned long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (que.size() < k) {
      que.push(a[i].first);
      sum += a[i].first;
    } else {
      if (a[i].first > que.top()) {
        sum -= que.top();
        que.pop();
        sum += a[i].first;
        que.push(a[i].first);
      }
    }
    ans = ((ans) < (sum * a[i].second) ? (sum * a[i].second) : (ans));
  }
  cout << ans << endl;
  return 0;
}
