#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int mod = (int)1e9 + 7;
const int N = 1e5 + 10;
const long long inf = -1e17;
struct event {
  long long a, b, c, d;
};
void solve() {
  int n, k;
  cin >> n >> k;
  multiset<int> s1;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a[i] = make_pair(y, x);
  }
  long long set_sum = 0;
  sort(a.begin(), a.end(), greater<pair<int, int>>());
  long long res = 0;
  for (int i = 0; i < n; i++) {
    long long b = a[i].first;
    long long val = a[i].second;
    long long temp = 0;
    if (i + 1 <= k) {
      set_sum += val;
      s1.insert(val);
      temp = set_sum;
    } else {
      long long val2 = *s1.begin();
      if (val > val2) {
        s1.erase(s1.begin());
        s1.insert(val);
        set_sum -= val2;
        set_sum += val;
      } else
        temp = set_sum + val - val2;
    }
    temp = temp * b;
    res = max(res, temp);
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
