this easy version problem in version 1 le n m le 100 you hack problem solve lock problemsyou give sequence integer aa_1a_2dotsa_n length n its subsequence obtain remove zero element sequence necessarily consecutively for example sequence a11201133112011 11201133112011 112011331120 11111111 20 3320 subsequence long list 40 3333 332020 20201111 subsequence suppose additional nonnegative integer k 1 le k le n give subsequence call optimal length k sum element maximum possible subsequence length k subsequence length k satisfy previous item lexicographically minimal Recall sequence bb_1 b_2 dots b_k lexicographically small sequence cc_1 c_2 dots c_k element left differ sequence b c formally exist t 1 le t le k b_1c_1 b_2c_2 b_t1c_t1 time b_tc_t for example 10 20 20 lexicographically 10 21 1 7 99 99 lexicographically 10 21 1 10 21 0 lexicographically 10 21 1 you give sequence aa_1a_2dotsa_n m request consist number k_j pos_j 1 le k le n 1 le pos_j le k_j for query print value index pos_j optimal subsequence give sequence kk_jFor example n4 a10203020 k_j2 optimal subsequence 2030 minimum lexicographically subsequence length 2 maximum total sum item thus answer request k_j2 pos_j1 number 20 answer request k_j2 pos_j2 number 30