In how many ways can a, b, c, d be formed based on the rule in this problem? 
There are $4$ integers. $$a, b, c, d$$ We
  know that  $$a + 3 \leq b$$$$b \leq c$$ $$c + 5 \leq d$$ $$1 \leq a, b, c, d \leq 40$$  In how many ways can $a, b, c, d$ be formed?

I am stuck to this equation
$$1 \leq a + 3 \leq b \leq c + 5 \leq d ≤ 40$$
Can you help me solving this problem? Thank you very much!
 A: Let $x_1 = a$, $x_2 = b - a$, $x_3 = c - b$, $x_4 = d - c$, $x_5 = 40 - d$.  Then 
$$x_1 + x_2 + x_3 + x_4 + x_5 = 40 \tag{1}$$
Since $a, b, c, d \in \{1, 2, 3, \ldots, 40\}$, $a + 3 \leq b$, $b \leq c$, and $c + 5 \leq d$, 
\begin{align*}
x_1 & \geq 1\\ 
x_2 & \geq 3\\
x_3 & \geq 0\\ 
x_4 & \geq 5\\
x_5 & \geq 0
\end{align*}
Let $x_1' = x_1 - 1$, $x_2' = x_2 - 3$, and $x_4' = x_4 - 5$.  Then $x_1'$, $x_2'$, and $x_4'$ are nonnegative integers.  Substituting $x_1' + 1$ for $x_1$, $x_2' + 3$ for $x_2$, and $x_4' + 5$ for $x_4$ in equation 1 yields
\begin{align*}
x_1' + 1 + x_2' + 3 + x_3 + x_4' + 5 + x_5 & = 40\\
x_1' + x_2' + x_3 + x_4' + x_5 & = 31 \tag{2}
\end{align*}
Equation 2 is an equation in the nonnegative integers.  A particular solution of equation 2 corresponds to the insertion of four addition signs in a row of $31$ ones.  For instance, 
$$+ 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1$$
corresponds to the solution $x_1' = 0$, $x_2' = 7$, $x_3 = 8$, $x_4' = 9$, and $x_5 = 7$.  The number of solutions of equation 2 is 
$$\binom{31 + 4}{4} = \binom{35}{4}$$
since we must select which $4$ of the $35$ positions required for $4$ addition signs and $31$ ones will be filled with addition signs.
A: $1\le a\le a+3\le b\le b+1\le c\le c+5\le d\le 40$
I see a stars and bars problem with $30$ stars and 4 bars.
${34\choose 4}$
A: Let us think of us first having $5$ boxes that we will distribute $40$ balls between. Each of these balls will represent a number, so for example if we put $10$ balls in our first box that means that $a = 10$ and if we have a further $6$ balls in the second box then $b = 10 + 6 = 16$, and so on. The last box is there so that we can put the remaining balls somewhere after $d$ assumes a value, for example if $d=36$ then our last box will have $4$ balls.
We know a few things about where some of these balls go. First of all the second box must have at least $3$ balls (because $b \ge a + 3$). We also know that the fourth box mus have at least $5$ balls (because $d \ge c + 5$). This then has already insisted on where $8$ balls in every configuration, so we may consider these balls already placed and continue on with the remaining $32$ balls.
Now we want to again think of this problem in a slightly different way. Each ball will be thought of as a dot and we will draw up all $32$ of our remaining balls this way. We now want to put them into boxes, and to represent this we will draw a line after however many balls are in each box. This means if there are $6$ balls (not included the already placed ones) in the first box we will draw our first line after $6$ dots, and if there are no balls in the next box (again excluding the balls that were already insisted upon) we would draw the next line right after the last with no dots in-between and then we would draw in the next line so many dots down as we want balls in the next box and so on. The last line will then always be at the very end of the dots so we will just ignore it as it must always go in the same place (this is because we must place every ball in a box).
Now we want to know how many ways we can do this, we have a string now $32 + 4$ in length composed of $32$ dots for balls and $4$ lines for where the boxes start and end and we have . All we have to do now is take the set of numbers $\{1,2,3,\ldots, 32 + 4\}$ and choose which of those numbers will be indicies where a line goes and all the others will be indicies with dots. This can be done in $$\binom{32+4}4 = \binom{32+4}{32}$$ ways.
This then is the number of ways we can assign $a,b,c,\text{and } d$ in your problem.
