Return sum of cubes for a given range of numbers