Find the combination of first of one type and Nth of another type of stones that generate the biggest value.