N, p = 10, 0.3
q = 1 - p answer = sum((n+q) for n in range(N)) / (p * q) print(answer)
247.61904761904762