simplify the code of unique-paths