Alice plays the following game, loosely based on the card game "21".
Alice starts with 0 points, and draws numbers while she has less than K points.  During each draw, she gains an integer number of points randomly from the range [1, W], where W is an integer.  Each draw is independent and the outcomes have equal probabilities.
Alice stops drawing numbers when she gets K or more points.  What is the probability that she has N or less points?
Example 1:
Input: N = 10, K = 1, W = 10
Output: 1.00000
Explanation:  Alice gets a single card, then stops.

Example 2:
Input: N = 6, K = 1, W = 10
Output: 0.60000
Explanation:  Alice gets a single card, then stops.
In 6 out of W = 10 possibilities, she is at or below N = 6 points.

Example 3:
Input: N = 21, K = 17, W = 10
Output: 0.73278
Note:

0 <= K <= N <= 10000
1 <= W <= 10000
Answers will be accepted as correct if they are within 10^-5 of the correct answer.
The judging time limit has been reduced for this question.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

def _disabled_input(*args, **kwargs):
    raise RuntimeError("input() is disabled in callable mode")
builtins.input = _disabled_input

ns = {"__name__": "__judge__"}  # prevent if __name__ == "__main__" blocks
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'class Solution:\n    def new21Game(self, N: int, K: int, W: int) -> float:\n        #probability of falling into [K, K + 1, ..., N]\n        #P[i] = 1/W*(P[i - 1] + ... + P[i - W])\n        #running_sum: P[i - 1] + ... + P[i - W]\n        if K == 0:\n            return 1\n        running_sum = 1\n        P = [1]\n        for i in range(1, W):\n            P.append(1/W * running_sum)\n            running_sum += P[-1]\n        # print(P)\n        for i in range(W, K):\n            P.append(1/W * running_sum)\n            running_sum += (P[-1] - P[i-W])\n        # print(P)\n        res = 0\n        #17: = 1/W*(P[7] + ... + P[16])\n        #18: = 1/W*(P[8] + ... + P[16])\n        #19: = 1/W*(P[9] + ... + P[16])\n        \n        #At 7: 1/W chance (7 + 10)\n        #8: 2/W chance (8 + 9, 8 + 10)\n        #9: 3/W (9 + 8, 9 + 9, 9 + 10)\n        #15: 5/W (15 + 2, ..., 15 + 6)\n        #16: 5/W   (16 + 1, ..., 16 + 5)\n        running_sum = sum(P[max(0, K - W): K])\n        # print(sum(P[0:1]))\n        # print(\\"running_sum = {0}\\".format(running_sum))\n        # print(sum(P[7:17]) + sum(P[8:17]) + sum(P[9:17]) + sum(P[10:17]) + sum(P[11:17]))\n        # print(1*P[7] + 2*P[8] + 3*P[9] + 4*P[10] + 5*sum(P[11:17]))\n        \n        #12: (P[2] + ... + P[11])*1/W\n        #13: (P[3] + ... + P[11])*1/W\n        #14: (P[4] + ... + P[11])*1/W\n        print(sum(P[2:12]) + sum(P[3:12]) + sum(P[4:12])+  sum(P[5:12]) + sum(P[6:12]) + sum(P[7:12]) + sum(P[8:12]) + sum(P[9:12]) + sum(P[10:12]) + sum(P[11:12]))\n        #From 2: 2 + 10\n        #From 3: 3 + 9, 3 + 10\n        #From 4: 4 + 8, 4 + 9, 4 + 10\n        #From 11: 11 + 1, ..., 11 + 10\n        \n        \n        #Last number candidates: From max(0, K - W) to K - 1\n        #From candidate i, we can go from max(i + 1, K) to min(i + W, N) \n        #so there are min(i + W, N) - max(i + 1, K) + 1 options\n        for i in range(max(0, K - W), K):\n            #from i: can go from max(i + 1, K) to min(i + 10, N)\n            res += P[i]/W * max((min(i + W, N) - max(i + 1, K) + 1), 0)\n            # print(res)\n        # for i in range(K, min(N + 1, K + W)):\n        #     res += (1/W * running_sum)\n        #     if i >= W:\n        #         running_sum -= P[i - W]\n        # # print(sum(P[1:11]))\n        return res'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

_target = None
_fn_name = 'new21Game'
if _fn_name:
    if "Solution" in ns:
        try:
            _obj = ns["Solution"]()
            if hasattr(_obj, _fn_name):
                _target = getattr(_obj, _fn_name)
        except Exception:
            _target = None
    if _target is None and _fn_name in ns and callable(ns[_fn_name]):
        _target = ns[_fn_name]
# Fallback: if there's exactly one user-defined function, use it
if _target is None:
    _cands = [v for k, v in ns.items() if callable(v) and getattr(v, "__module__", "") in ("__judge__", "__main__")]
    _user_funcs = [c for c in _cands if getattr(c, "__name__", "").startswith("_") is False]
    if len(_user_funcs) == 1:
        _target = _user_funcs[0]
if _target is None:
    raise RuntimeError(f"Could not resolve callable '{_fn_name}'")

_raw = sys.stdin.read().strip()
if _raw:
    _parsed = json.loads(_raw)
    if isinstance(_parsed, dict):
        _kwargs = _parsed.get("kwargs", {})
        _args = _parsed.get("args", [])
    else:
        _args, _kwargs = _parsed, {}
else:
    _args, _kwargs = [], {}
if not isinstance(_args, (list, tuple)):
    _args = [_args]
_res = _target(*_args, **_kwargs)
try:
    sys.stdout.write(repr(_res) + "\n")
except Exception:
    pass

```

Measured memory_bytes: 6925