Let the number to be added be \( x \).
The new numbers are:
\[
8 + x, \quad 21 + x, \quad 13 + x, \quad 31 + x
\]
The required condition:
\[
\frac{8 + x}{21 + x} = \frac{13 + x}{31 + x}
\]
Cross multiplying:
\[
(8 + x)(31 + x) = (13 + x)(21 + x)
\]
Expanding:
\[
248 + 8x + 31x + x^2 = 273 + 13x + 21x + x^2
\]
\[
248 + 39x = 273 + 34x
\]
\[
39x - 34x = 273 - 248
\]
\[
5x = 25
\]
\[
x = 5
\]
Thus, the correct number to be added is 5.