###name String

###descirption Tom has a string containing only lowercase letters. He wants to choose a subsequence of the string whose length is k and lexicographical order is the smallest. It's simple and he solved it with ease. But Jerry, who likes to play with Tom, tells him that if he is able to find a lexicographically smallest subsequence satisfying following 26 constraints, he will not cause Tom trouble any more. The constraints are: the number of occurrences of the ith letter from a to z (indexed from 1 to 26) must in $$[L_i,R_i]$$. Tom gets dizzy, so he asks you for help.

###input The input contains multiple test cases. Process until the end of file. Each test case starts with a single line containing a string $$S(|S|≤10^5)$$and an integer k(1≤k≤|S|). Then 26 lines follow, each line two numbers$L_i,R_i(0≤L_i≤R_i≤|S|)$. It's guaranteed that S consists of only lowercase letters, and $$∑|S|≤3×10^5$$.

###output Output the answer string. If it doesn't exist, output −1.

###sample input aaabbb 3 0 3 2 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ###sample output abb

###toturial 遇到这种题一般要想到一位一位去构造，贪心的选择小的字母，从而构造出最小字典序，而这一步我们需要的是验证此字母是否合法。因为是在选子序列，所以我们只需要统计后缀是否满足要求即可，后缀中的字母都满足数量足够即可

###code

-----------------------本文结束感谢您的阅读-----------------------