#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
int k, n;
struct gg {
  int t, b;
  bool operator<(const gg &g) const { return b < g.b; }
} g[300015];
priority_queue<int, vector<int>, greater<int> > que;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &g[i].t, &g[i].b);
  }
  sort(g + 1, g + n + 1);
  long long ans = 0, cur = 0;
  for (int i = n; i; --i) {
    if (que.size() < k || que.top() < g[i].t) {
      if (que.size() == k) {
        cur -= que.top();
        que.pop();
      }
      cur += g[i].t;
      que.push(g[i].t);
    }
    ans = max(ans, cur * g[i].b);
  }
  printf("%lld\n", ans);
  return 0;
}
