while(0<1)println{var s=readLine:+' ' while(s>"!"){val i=s(1)%8*3 s=s.drop(76/s(0)*i+3)+(s drop Seq(2,s.size-i)(s(0)/82)take i)} s.tail}