Let $S(N)$ be the number of 1's in the binary representation of an integer $N$, and let $D(N) = S(N + 1) - S(N)$. Compute the sum of $D(N)$ over all $N$ such that $1 \le N \le 2017$ and $D(N) < 0$.

Let's think step by step and output the final answer within \boxed{}.
user