Let p,q,np, q, n be three positive integers with p+q<np + q < n. Let (x0,x1,…,xn)(x_0, x_1, \ldots, x_n) be an (n+1)(n + 1)-tuple of integers satisfying the following conditions:

(a) x0=xn=0x_0 = x_n = 0.

(b) For each ii with 1≤i≤n1 \leq i \leq n, either xi−xi−1=px_i - x_{i-1} = p or xi−xi−1=−qx_i - x_{i-1} = -q.

Show that there exist indices i<ji < j with (i,j)≠(0,n)(i, j) \neq (0, n), such that xi=xjx_i = x_j.