#include <bits/stdc++.h>
using namespace std;
const int M = 3e5 + 5;
long long n, m, k, sum, ans;
struct node {
  long long t, b;
} t[M];
inline void read(long long &x) {
  char ch = getchar();
  long long u = 0, f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    u = (u << 1) + (u << 3) + (ch ^ 48);
    ch = getchar();
  }
  x = u * f;
}
bool cmp(node x, node y) { return x.b > y.b; }
priority_queue<long long, vector<long long>, greater<long long> > q;
int main() {
  read(n), read(k);
  for (int i = 1; i <= n; i++) read(t[i].t), read(t[i].b);
  sort(t + 1, t + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    if (i <= k)
      q.push(t[i].t), sum += t[i].t;
    else if (t[i].t > q.top())
      sum -= q.top(), q.pop(), q.push(t[i].t), sum += t[i].t;
    ans = max(ans, sum * t[i].b);
  }
  cout << ans;
  return 0;
}
