Solution to first task