Transforming cabbage into turnip: polynomial algorithm for sorting signed permutations by reversals