//package que_c;

import java.io.*;
import java.util.*;

public class utkarsh {
    
    BufferedReader br;
    PrintWriter out;
    
    long mod = (long) (1e9 + 7), inf = (long) (3e18);
    
    class pair {
        long F, S;
        pair(long f, long s) {
            F = f;  S = s;
        }
    }
    
    void solve() {
        int n = ni(), k = ni();
        pair a[] = new pair[n];
        for(int i = 0; i < n; i++)  a[i] = new pair(nl(), nl());
        Arrays.sort(a, (pair u, pair v) -> (int)((v.S != u.S) ? (v.S - u.S) : (v.F - u.F)));
        long ans = 0, s = 0;
        PriorityQueue <Long> pq = new PriorityQueue<>();
        for(pair p : a) {
            s += p.F;
            pq.add(p.F);
            if(pq.size() > k) {
                s -= pq.poll();
            }
            ans = Math.max(ans, s * p.S);
        }
        out.println(ans);
    }
    
    long mp(long b, long e) {
        long r = 1;
        while(e > 0) {
            if( (e&1) == 1 )    r = (r * b) % mod;
            b = (b * b) % mod;
            e >>= 1;
        }
        return r;
    }
    
    // -------- I/O Template -------------
    
    char nc() {
        return ns().charAt(0);
    }
    
    String nLine() {
        try {
            return br.readLine();
        } catch(IOException e) {
            return "-1";
        }
    }
    
    double nd() {
        return Double.parseDouble(ns());
    }
    
    long nl() {
        return Long.parseLong(ns());
    }
    
    int ni() {
        return Integer.parseInt(ns());
    }
    
    StringTokenizer ip;
    
    String ns() {
        if(ip == null || !ip.hasMoreTokens()) {
            try {
                ip = new StringTokenizer(br.readLine());
            } catch(IOException e) {
                throw new InputMismatchException();
            }
        }
        return ip.nextToken();
    }
    
    void run() {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.flush();
    }
    
    public static void main(String[] args) {
        new utkarsh().run();
    }
}