#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define F first
#define S second
#define ll long long
#define ld long double
#define endl '\n'

#define pii pair <int, int>
#define ull unsigned long long
//#define int long long

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;


const int N = 1e4;
const ll P = 127;
const ll mod = 1e9 + 7;
const int rx[8] = {1, -1, 0, 0, 1, 1, -1, -1 };
const int ry[8] = {0, 0, 1, -1, 1, -1, 1, -1 };
const ld pi = acos(-1.0);
const int B = (int)sqrt(N);

const int kx[4] = {1, -1, 0, 0};
const int ky[4] = {0, 0, 1, -1};

mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());


int a[N];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //  srand(time(0));
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
   //freopen("substr.in", "r", stdin);
    //freopen("substr.out", "w", stdout);
#endif // LOCAL
    int n , k;
    cin >> n >> k;
    pair < ll , ll > m[n];
    for (int i = 0; i < n; i++) {
        cin >> m[i].S >> m[i].F;
    }
    sort(m , m + n);
    ll suff[n];
    suff[n - 1] = m[n - 1].S;
    for (int i = n - 2; i > -1; i--) {
        suff[i] = suff[i + 1] + m[i].S;
    }
    ll ans = -1e2 + 1;
    for (int i = 0; i < n; i++) {
        if (i + k >= n) {
            ans = max(ans , suff[i] * m[i].F);
            continue;
        }
        ans = max(ans , (suff[n - k + 1] + m[i].S) * m[i].F);
    }
    cout << ans << endl;
}
