Solution by Bill Palmer.
