#include using namespace std; const int N=1e5+5; void FileIO(){ freopen("turnback.in","r",stdin); freopen("turnback.out","w",stdout); } namespace sunburstfan{ #define int long long int n,m; vector c; vector > f; vector > vis; int get(int pos,int step){ int next=pos+step; if(next>n){ next=2*n-next; } return max(1ll,next); } double dfs(int pos,int lst){ if(pos==n)return 0.0; if(vis[pos][lst])return f[pos][lst]; vis[pos][lst]=1; double res=1e18; double tmp=0.0; for(int i=1;i<=m;i++){ int next=get(pos,i); double cost=dfs(next,lst); if(next!=1&&next!=n){ cost+=c[next]; } tmp+=cost; } tmp/=m; res=min(res,tmp); if(lst==0){ for(int i=1;i<=m;i++){ int next=get(pos,i); double cost=dfs(next,1); if(next!=1&&next!=n){ cost+=c[next]; } res=min(res,cost); } } return f[pos][lst]=res; } void solve(){ cin>>n>>m; c.resize(n+1); for(int i=2;i>c[i]; } f.assign(n+1,vector(2,0.0)); vis.assign(n+1,vector(2,false)); double ans=dfs(1,0); cout<