Semifinal Exercise 2 resolved