#include <bits/stdc++.h>
using namespace std;
struct music {
  int length;
  int be;
  bool operator<(const music &h) const { return length > h.length; }
};
music G[300030];
bool cmp(music a, music b) {
  if (a.be > b.be)
    return true;
  else
    return false;
}
int main() {
  long long m, n, sum = 0, tim = 0, ma = 0;
  long long out = 0;
  cin >> m >> n;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &G[i].length, &G[i].be);
  }
  sort(G + 1, G + m + 1, cmp);
  priority_queue<music> q;
  for (int i = 1; i <= m; i++) {
    if (tim < n) {
      q.push(G[i]);
      tim++;
      ma += G[i].length;
      out = max(out, ma * (G[i].be));
    } else if (tim >= n) {
      music a = q.top();
      q.pop();
      ma -= a.length;
      long long s = (ma + G[i].length) * G[i].be;
      out = max(out, s);
      if (a.length >= G[i].length) {
        q.push(a);
        ma += a.length;
      } else {
        q.push(G[i]);
        ma += G[i].length;
      }
    }
  }
  cout << out << endl;
  return 0;
}
