#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m, ans = 0, res = 0;     cin >> n >> m;     vector<pair<long long, long long>> v;     set<pair<long long, long long>> s;     for (int i = 0; i < n; i++) {       long long p, q;       cin >> p >> q;       v.push_back(make_pair(q, p));     }     sort(v.begin(), v.end(), greater<pair<long long, long long>>());     for (int i = 0; i < n; i++) {       res += v[i].second;       s.insert(make_pair(v[i].second, i));       while (s.size() > m) {         auto it = s.begin();         res -= it->first;         s.erase(it);       }       ans = max(ans, res * v[i].first);     }     cout << ans << endl;     return 0;   }   