Mingle
시간 제한1초메모리 제한2048 MB
고리 모양으로 놓인 방들에서 각 플레이어가 자기 번호에서 k 이내의 방을 균등하게 무작위로 고를 때, 정확히 한 명만 들어간 방의 기댓값을 구한다.
문제
You and your friends are playing the popular childhood game, Mingle.
In the game of Mingle, players start by standing on a spinning circular platform in the middle of a circular arena. Each player has a unique number ranging from to , and there are rooms also with unique numbers from to arranged on the perimeter of the arena. The rooms are in numerical order, with room also being adjacent to room .

Cheerful music plays for a few seconds, and then the music stops, the circular platform stops spinning, and everyone has to run into a room. Initially, each player tries to target the room with the same number as their number, but because of the spinning, everyone is disoriented. As a result, player might enter a different room. Notably, the players have a disorientation factor of , which is the same for all players, and player might enter a room that is up to rooms away from their target room. All candidate rooms are equally likely for each player and all players select their rooms independently. Every player who ends up alone in a room is a winner in that round of Mingle, even if the room’s number is not the same as the player’s number.
Compute the expected number of winners in a single round of Mingle.
입력
The first and only line of input contains two integers, , and , where is the number of players playing, and is the disorientation factor of the players.
출력
Let be the expected number of winners in a single round of Mingle. It can be shown that can be written as for relatively prime positive integers and . Output .