L, R, n = map(int, input().split()) y = (R - L + 1) // n l = L % n r = R % n if n == 1: print(R - L + 1) else: for i in range(n): z = y if r - l + 2 > 0: z = y - 1 if i <= r: z += 1 if l <= i: z += 1 print(z)