finished Problem1 and Problem2