#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const long long inf = 0x3f3f3f3f3f3f3f3fLL;
using namespace std;
const int maxn = int(3e5 + 10);
struct node {
  int t, b;
  bool operator<(const node& cmp) const { return t > cmp.t; }
} song[maxn];
bool cmp(const node& a, const node& b) { return a.b > b.b; }
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &song[i].t, &song[i].b);
  sort(song + 1, song + n + 1, cmp);
  priority_queue<node> q;
  long long ans = 0;
  long long tott = 0, totb = inf;
  for (int i = 1; i <= n; ++i) {
    tott += song[i].t;
    totb = song[i].b;
    q.push(song[i]);
    if (q.size() > k) {
      tott -= q.top().t;
      q.pop();
    }
    ans = max(ans, tott * totb);
  }
  printf("%I64d\n", ans);
}
