Problem Statement  
You work in a large library. It is the end of the day and you have to replace a number of returned books back on the shelves. The shelves are located at integer positions (positive and negative) along a long corridor and the pile of books is located at position 0. You start off standing at the pile of books (position 0). You can carry at most N books at a time and want to know the minimum total distance that you will have to walk in order to replace all the books.
You are given a int[] books, where each element describes the position of the shelf where a single book must be returned. Return the minimum total distance that you have to walk to replace all the books. You do not need to return to the pile of books after you have finished.  
Definition  
 
Constraints  
  books will contain between 1 and 50 elements, inclusive.  
  Each element of books will be between 10,000 and 10,000, inclusive.  
  The elements of books will be distinct.  
  No element of books will be 0.  
  N will be between 1 and 50, inclusive.  
Examples  
0)  
 
1)  
 
2)  
 
3)  
 
4)  
