Solution to #4-10