Selecting consecutive terms in A.P