#include <bits/stdc++.h>
using namespace std;
struct str {
  long long ts;
  long long bs;
  long long tot;
};
bool compare(str x, str y) {
  if (x.tot == y.tot) {
    return (x.bs > y.bs);
  }
  return (x.tot > y.tot);
}
vector<str> v;
int main() {
  long long n, k;
  scanf("%lld %lld", &n, &k);
  long long maxi = 0;
  for (int i = 0; i < n; i++) {
    long long t, b;
    scanf("%lld %lld", &t, &b);
    v.push_back({t, b, (abs(t * b))});
  }
  sort(v.begin(), v.end(), compare);
  long long mini = 1e18 + 1, tt = 0, sum = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    long long tt = v[i].ts;
    long long tt1 = sum + tt;
    long long mini1 = min(mini, v[i].bs);
    long long tot1 = tt1 * mini1;
    if (tot1 > maxi) {
      mini = min(mini, v[i].bs);
      maxi = tot1;
      sum = tt1;
      cnt++;
    }
    if (cnt == k) break;
  }
  cout << maxi << endl;
  return 0;
}
