Grigory n magic stone conveniently number 1 n the charge ith stone equal c_isometime Grigory get bored select inner stone stone index 2 le le n 1 synchronize neighboring stone after choose stone lose charge acquire charge neighboring stone in word charge c_i change c_i c_i 1 c_i 1 c_iandrew grigorys friend n stone charge t_i Grigory curious exist sequence zero synchronization operation transform charge grigorys stone charge correspond Andrews stone change c_i t_i