private static ArrayList<Long> progression(long[] cards, long dif, boolean isprog) {
        int N = cards.length;
        ArrayList<Long> res = new ArrayList<Long>();

        for (int i = 1; i < N; i++) {
            long cmp = cards[i] - cards[i-1] - dif;
            //println(cards[i-1] + " " + cards[i] + " " + dif + " " + isprog);
            if ((cmp != 0) && (!isprog)) return new ArrayList<Long>();
            
            if (cmp > 0) {
                if (isprog) {
                    isprog = false;
                    cards[i-1] += dif;
                    res.add(cards[i-1]); //println("added " + cards[i-1]);
                    i--;
                }
                else {
                    return new ArrayList<Long>();
                }
            }
            else if (cmp < 0) {
                return new ArrayList<Long>();
            }                
        }

        
        if (isprog) {
            res.add(cards[0] - dif);
            if (dif > 0) res.add(cards[N-1] + dif);
        }
        else if (res.size() < 1) {
            res.add(cards[0]);
        }
        
        return res;
    }