//package codeforces549;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class PlayList {
	
	public static class Song{
		int time;
		int beauty;
		Song(int time,int beauty){
			this.time = time;
			this.beauty = beauty;
		}
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n,k;
		n = in.nextInt(); k = in.nextInt();
		Song[] songs = new Song[n];
		for(int i=0;i<n;i++)
			songs[i] = new Song(in.nextInt(),in.nextInt());
		Arrays.sort(songs, (a,b) -> b.beauty - a.beauty);
		PriorityQueue<Integer> pq = new PriorityQueue<>();
		long maxPleasure = 0;
		long timeDuration = 0;
		for(int i=0;i<n;i++) {
			timeDuration += songs[i].time;
			pq.add(songs[i].time);
			while(pq.size() > k) timeDuration -= pq.poll();
			maxPleasure = Math.max(maxPleasure, timeDuration * songs[i].beauty);
		}
		System.out.println(maxPleasure);
		in.close();
	}
}
