

import java.io.BufferedOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.TreeSet;


public class C2 {

    public static void solve() throws Exception {
	int n = nextInt();
	int k = nextInt();
	List<Song> list = new ArrayList<>(n);
	
	for(int i=0;i<n;i++) {
	    Song s = new Song();
	    list.add(s);
	    s.t = nextInt();
	    s.b = nextInt();
	}
	Collections.sort(list);
	TreeSet<Song> tree = new TreeSet<>((a, b) -> {
	    int ret = -Integer.valueOf(a.t).compareTo(b.t);
	    if(ret == 0) {
		ret = Integer.valueOf(a.nr).compareTo(b.nr);
	    }
	    return ret;
	});
	long sum = 0;
	long max = 0;
	for(int i=0;i<n;i++) {
	    Song s = list.get(i);
	    tree.add(s);
	    sum += s.t;
	    if(tree.size() > k) {
		Song last = tree.last();
		sum -= last.t;
		tree.remove(last);
	    }
	    //if(tree.size() == k)
	    {
		long v = sum * s.b;
		if(v > max) {
		    max = v;
		}
	    }
	}
	println(max);
	
	
    }
    
    private static class Song implements Comparable<Song> {
	private static int cnt = 0;
	int nr = 0;
	int t;
	int b;
	
	public Song() {
	    this.nr = cnt++;
	}
	
	@Override
	public int compareTo(Song s) {
	    int ret = -new Integer(b).compareTo(s.b);
	    return ret;
	}
	
	@Override
	public String toString() {
	    return t + "," + b;
	}
    }
    


    public static void main(String[] args) throws Exception {
	try {
	    fastReader = new FastReader(System.in);
	    systemOut = new BufferedOutputStream(System.out);
	    solve();
	} finally {
	    systemOut.close();
	}
    }

    private static FastReader fastReader = null;
    private static BufferedOutputStream systemOut = null;

    public static void print(Object obj) {
	print(obj.toString());
    }

    public static void print(String str) {
	try {
	    systemOut.write(str.getBytes("utf-8"));
	} catch (Exception ex) {
	    throw new RuntimeException(ex);
	}
    }

    public static void println(Object obj) {
	println(obj.toString());
    }

    public static void println(String str) {
	try {
	    print(str);
	    systemOut.write('\n');
	} catch (Exception ex) {
	    throw new RuntimeException(ex);
	}
    }

    public static String next() {
	return fastReader.readNextToken(false);
    }

    public static String nextLine() {
	return fastReader.readNextToken(true);
    }

    public static int nextInt() {
	return Integer.parseInt(fastReader.readNextToken(false));
    }

    public static long nextLong() {
	return Long.parseLong(fastReader.readNextToken(false));
    }

    public static double nextDouble() {
	return Double.parseDouble(fastReader.readNextToken(false));
    }

    static class FastReader {
	private byte[] buf = new byte[65536];
	private int ind = 0;
	private int maxInd = -1;
	private InputStream is = null;
	private boolean eof = false;
	private boolean lastCharRead = false;

	public FastReader(InputStream is) {
	    this.is = is;
	}

	public String readNextToken(boolean endOfLine) {
	    try {
		StringBuilder sb = new StringBuilder();
		boolean found = false;
		while (true) {
		    if (lastCharRead) {
			return null;
		    } else if (ind > maxInd) {
			if (eof) {
			    lastCharRead = true;
			} else {
			    fillBuffer();
			}
		    }
		    byte b = '\n';
		    if (!lastCharRead) {
			b = buf[ind++];
		    }

		    if (b == '\r') {
			// ignore
		    } else if ((b == '\n' && endOfLine) || (Character.isWhitespace(b) && !endOfLine)) {
			if (found) {
			    break;
			}
		    } else {
			sb.append((char) b);
			found = true;
		    }
		}
		return sb.toString();
	    } catch (Exception ex) {
		throw new RuntimeException(ex);
	    }
	}

	private void fillBuffer() {
	    try {
		int read = is.read(buf, 0, buf.length);
		if (read < buf.length) {
		    eof = true;
		}
		ind = 0;
		maxInd = read - 1;
	    } catch (Exception ex) {
		throw new RuntimeException(ex);
	    }
	}
    }
}