The midterm exam solution is attached.