#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
using LL = long long;
struct Node {
  LL t, d;
} node[maxn];
bool cmp(Node a, Node b) { return a.d > b.d; }
priority_queue<LL, vector<LL>, greater<LL>> Q;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  LL n, k, ans = 0, sum = 0;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> node[i].t >> node[i].d;
  sort(node + 1, node + 1 + n, cmp);
  sum = node[1].t * node[1].d;
  ans = node[1].t;
  Q.push(node[1].t);
  for (int i = 2; i <= n; i++) {
    if (Q.size() >= k) {
      ans -= Q.top();
      Q.pop();
    }
    ans += node[i].t;
    sum = max(sum, ans * node[i].d);
    Q.push(node[i].t);
  }
  cout << sum;
  return 0;
}
