The code for problem 1 is completely finished