Final submission for the ROTATION problem