#P1409. 骰子

骰子

Description

nn people stand in a line, and you are the mm-th.

In each round, the person at the front of the queue rolls a die once.

  • If they roll 11, the person at the front wins.
  • If they roll 2,4,62, 4, 6, the person at the front moves to the end of the queue.
  • If they roll 3,53, 5, the person at the front leaves the queue.

If only one person remains in the queue, that person wins. Find the probability that you win.

Input Format

One line containing two integers n,mn, m.

Output Format

A real number representing the winning probability, to 99 digits after the decimal point.

2 1

0.444444444

Hint

  • For 30%30\% of the testdata, 0<mn100 < m \le n \le 10.
  • For 100%100\% of the testdata, 0<mn10000 < m \le n \le 1000.

Translated by ChatGPT 5