update problem4 by using break