{"problem":{"name":"Sugoroku2","description":{"content":"Takahashi is playing sugoroku. The board has $N+1$ squares numbered $0$ to $N$. Takahashi starts at Square $0$ and head to Square $N$. In this sugoroku, we use a wheel showing numbers from $1$ through","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc189_f"},"statements":[{"statement_type":"Markdown","content":"Takahashi is playing sugoroku.\nThe board has $N+1$ squares numbered $0$ to $N$. Takahashi starts at Square $0$ and head to Square $N$.\nIn this sugoroku, we use a wheel showing numbers from $1$ through $M$ with equal probability. In each turn, Takahashi spins the wheel and advances by the number shown by the wheel. When it makes him reach Square $N$ or go past it, he wins.\nSome of the squares send him to Square $0$ when he stops on them. There are $K$ such squares: Square $A_1, \\ldots, A_K$.\nFind the expected value of the number of times Takahashi spins the wheel before he wins. If it is impossible to win, print `-1` instead.\n\n## Constraints\n\n*   All values in input are integers.\n*   $1 \\leq N \\leq 10^5$\n*   $1 \\leq M \\leq 10^5$\n*   $0 \\leq K \\leq 10$\n*   $0 < A_1 < \\ldots < A_K < N$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $M$ $K$\n$A_1$ $\\ldots$ $A_K$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc189_f","tags":[],"sample_group":[["2 2 0","1.5000\n\nIf the wheel shows $1$ in the first spin, he will need two spins to win; if the wheel shows $2$ in the first spin, he will need one spin to win. Thus, the expected number of spins is $1.5$."],["2 2 1\n1","2.0000\n\nIf the wheel shows $1$, he advances to Square $1$, but it sends him back to Square $0$.  \nThus, he keeps spinning the wheel until he gets $2$ and wins.  \nThe probability that he gets $2$ for the first time in the $i$\\-th spin is $\\frac{1}{2^i}$, so the expected number of spins is $\\sum_{i = 1}^{\\infty} (i \\times \\frac{1}{2^i}) = 2$."],["100 6 10\n11 12 13 14 15 16 17 18 19 20","\\-1"],["100000 2 2\n2997 92458","201932.2222"]],"created_at":"2026-03-03 11:01:14"}}