static double[] f(int p,int ant,boolean ws){
		if(p==N)return new double[]{1.0,ws?1.0:0.0};
		if(mem[p][ant+1][ws?1:0]!=null)return mem[p][ant+1][ws?1:0]; 
		double a=0,b=0;
		for(int i=0;i<=K;i++) {
			double[] s=f(p+1,i,ws&&(ant==-1||abs(ant-i)<=1));
			a+=s[0];
			b+=s[1];
		}
		return mem[p][ant+1][ws?1:0]=new double[]{a,b};
	}