import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class playlist {

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() throws IOException
        {
            //br = new BufferedReader(new InputStreamReader(new FileInputStream("/home/swapnil/IdeaProjects/testing/src/inputf")));
            br = new BufferedReader(new InputStreamReader(System.in));

        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }



    public static void main(String[] args) throws IOException {
        FastReader sc = new FastReader();
        int n = sc.nextInt() ;
        int k = sc.nextInt() ;
        int a,b ,ans;
        int sum = 0 ;
        int max = -1 ;
        pair[] arr = new pair[n];
        for(int i=0;i<n;i++) {
            a = sc.nextInt() ;
            b = sc.nextInt() ;
            arr[i] = new pair(a,b) ;
        }

        Arrays.sort(arr);
        for(int i=n;i>0;i--) {
            sum += arr[i-1].len ;
            if( i <= n-k) {
                sum -= arr[i].len ;
            }
            ans = sum * arr[i-1].beu;
            max = Math.max(max,ans) ;
        }
        System.out.println(max);
    }
}


class pair implements  Comparable <pair> {
    int len ;
    int beu ;
    pair(int len,int beu) {
        this.len = len ;
        this.beu = beu ;
    }

    public int compareTo(pair x) {
        return beu - x.beu ;
    }

}