Improved the formatting of the answer. Swapped the input for W and S