Solve problem 119 using Python/Ruby.