solve 009-020 by Ruby