assignment 4: solution