import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    int n, k;
    Scanner scan = new Scanner(System.in);
    n = scan.nextInt();
    k = scan.nextInt();
    long[][] songs = new long[n][2];
    for (int i = 0; i < n; i++){
      songs[i][0] = scan.nextInt();
      songs[i][1] = scan.nextInt();
    }

      mergeSort(songs);
      for (long[] x: songs){
        System.out.println(x[0] + " " + x[1]);
      }
      long sum =  songs[0][0], coe =  songs[0][1];
      long finalCount = sum * coe;
      for (int i = 1; i < k; i++){
        long curSum = sum +  songs[i][0];
        long curCoe = min( songs[i][1], coe);
        if (curCoe * curSum > finalCount){
          finalCount = curCoe * curSum;
          sum = curSum;
          coe = curCoe;
        } 
        else{
          break;
        }
      }

      System.out.println(finalCount);

  }
  public static long min(long a, long b){
    if (a < b) return a;
    return b;
  }
  public static long max(long a, long b ){
    if (a < b) return b;
    return a;
  }

  public static void mergeSort(long[][] A){
    int n = A.length;
    if (n < 2) return;
    int mid = n/2;
    long[][] L = new long[mid][2];
    long[][] R = new long[n - mid][2];
    for (int i = 0; i < mid; i++){
      L[i] = A[i];
    }
    for (int i = mid; i < n; i++){
      R[i-mid] = A[i];
    }

    mergeSort(L);
    mergeSort(R);
    merge(A, L, R);
  }

  public static void merge(long[][] A, long[][] L, long[][] R){
    int i, j, k;
    i = j = k = 0;
    int nL = L.length, nR = R.length;

    while (i < nL && j < nR){
      if (L[i][1] > R[j][1]){
        A[k] = L[i];
        i++;
      }
      else if (L[i][1] < R[j][1]){
        A[k] = R[j];
        j++;
      }
      else{
        if (L[i][0] > R[i][0]){
          A[k] = L[i];
          i++;
        }
        else{
          A[k] = R[j];
          j++;
        }
      }
      k++;
    }

    while ( i < nL){
      A[k] = L[i];
      i++;
      k++;
    }
    while (j < nR){
      A[k] = R[j];
      j++;
      k++;
    }
  }
}