#include <bits/stdc++.h>   using namespace std;   priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,                  less<pair<long long, long long>>>       q;   priority_queue<long long, vector<long long>, greater<long long>> p;   long long n, k, t, b, temp, res;   int main() {     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> t >> b;       q.push({b, t});     }     for (int i = 0; i < n; i++) {       pair<long long, long long> tt = q.top();       if (p.size() < k) {         p.push(tt.second);         temp += tt.second;       } else {         if (tt.second > p.top()) {           temp += (tt.second - p.top());           p.pop();           p.push(tt.second);         }       }       q.pop();       res = max(res, tt.first * temp);     }     cout << res << endl;     return 0;   }   