Polycarp find stre s permutation p their length turn equal na permutation n element array length n integer 1 n occur exactly for example 1 2 3 4 3 5 1 2 permutation 1 2 4 4 3 2 1 2 0 1 2 notin operation multiply s p replace s stre new 1 n true new_i s_p_i for example swmbe p 3 1 4 2 operation string turn ss_3 s_1 s_4 s_2bwempolycarp wonder operation string equal initial value time since long ask help matterit prove require number operation exist it large use 64bit integer type