Function to calculate maximum product by taking only one element from each array present in the list
static ArrayList < Integer > calculateProduct ( ArrayList < ArrayList < Integer > > List , int index ) {