N = 2
M = 1
K = 3
maxValue = M*K

count = [0] * (maxValue+1)
prev = [0] * (maxValue+1)

count[0] = 1 # empty set

for i in range(K):
	# move count to prev
	for index in range(maxValue+1):
		prev[index] = count[index]
		count[index] = 0
	
	rollingSum = 0
	
	# calculate new counts
	for Sum in range(maxValue+1):
		rollingSum += prev[Sum]
		if (Sum > M):
			rollingSum -= prev[Sum - (M + 1)]
		count[Sum] = rollingSum
			

# add all counts of sets whose sum is >= N
ans = sum(count[N:]) / pow(M+1,K)
print(ans)
