Write the function take_up_to(n), which tells Karel to take the maximum of n balls from the square which he stands on. More precisely, if there are n or more balls at the square, Karel takes n of them, and if there are fewer balls, Karel takes as many as he can.
Karel, who is on the first square, should take up to 4 balls from the second square, then up to 2 balls from the third square, and up to 3 balls from the fourth square, and then bring all the collected balls to the first square. Of course, the take_up_to(n) function, written in the first part of the task, should be used for this purpose.