q([],[]). q([H|T],[X|Y]):- X is H + 1, q(T,Y).
..., q(X,Y) & r(X), ...
..., length(X, LX), Cost_q is LX * 2 + 1, (Cost_q > 15 -> q(X,Y) & r(X) ; q(X,Y), r(X)), ...