import java.util.*;
public class A
{
      public static void main(String ar[])
      {
            Scanner s= new Scanner(System.in);
            int n=s.nextInt();
            int k=s.nextInt();
            long S=0;  long max=0;
            PriorityQueue<Long> ts=new PriorityQueue<Long>(new The_comp());
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            { a[i][0]=s.nextInt();  a[i][1]=s.nextInt(); }
            Arrays.sort(a,new Comparator<int[]>(){
                  public int compare(final int f1[],final int f2[])
                  {
                        if(f1[1]>f2[1])
                         return 1;
                        else if(f1[1]==f2[1])
                        {
                        if(f1[0]>f2[0])
                         return 1;
                        else if(f1[0]==f2[0])
                         return 0;
                        else
                         return -1;   
                        }
                        else
                         return -1;
                  }
            });
            
            for(int i=n-1;i>=n-k;i--)
            {
                  S+=(long)a[i][0];  ts.add((long)a[i][0]);
                  long curr=S*((long)a[i][1]);
                  max=Math.max(curr,max);
            }
            
            for(int i=n-k-1;i>=0;i--)
            {
                  long l=ts.poll();
                  S-=l;
                  S+=Math.max(l,(long)a[i][0]);
                  ts.add(Math.max(l,(long)a[i][0]));
                  long curr=S*((long)a[i][1]);
                  max=Math.max(curr,max);
            }
            
            System.out.println(max);
            
      }
      
}

class The_comp implements Comparator<Long>
{
      public int compare(Long x,Long y)
      {
            return x.compareTo(y);
      }
}