Jzzhu and Sequences

CodeForces - 450B