Fortune Wheel
시간 제한1초메모리 제한2048 MB
n개 칸의 바퀴에서 x번 칸에서 시작해 K개의 고정 점프와 무작위 칸으로 이동하는 수단을 써서 0번 칸에 도달하는 최소 기대 횟수를 구한다.
문제
A Fortune Wheel has sectors numbered from to in clockwise order. It also has an arrow pointing at one of the sectors. Right now, it is pointing at sector .
You are very good at spinning the Wheel. More specifically, you have learned distinct power spins, characterized by their power . A power spin with power means that you spin the Wheel with such power that the arrow would turn exactly sectors clockwise: formally, from sector , it would turn to sector . Also, you can do a common spin: spin the Wheel so that the arrow would be pointing at a uniformly random sector. Your skills allow you to do any number of spins any number of times in any order.
You want the arrow to be pointing at sector as soon as possible. Find the expected value of the number of spins required to do so in an optimal strategy. A strategy is considered optimal if it minimizes the said expected value.
입력
The first line contains three integers: the number of sectors , the starting sector of the arrow , and the number of power spins (; ; ).
The second line contains distinct integers ().
출력
Print a line containing two integers and (; ): numerator and denominator of an irreducible fraction which is the expected value of the number of spins. It can be proved that the answer can be represented in this way.