finished implemented HW3_prob1