Solution to #4-5