musical pillow aka josephus problem