A wizard has a magic word of length
The wizard performs
This spell rotates every character from position
After
Your task is to print the final magic word after all spells are applied.
The first line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the length of the magic word and the number of spells.
The second line contains a string KaTeX can only parse string typed expression of length KaTeX can only parse string typed expression.
Each of the next KaTeX can only parse string typed expression lines contains three integers KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and KaTeX can only parse string typed expression.
Print the final magic word after applying all spells.
Input
5 3
abcde
1 3 1
2 5 2
4 4 26OutputbeffgExplanationThe total rotations are KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and KaTeX can only parse string typed expression. Taking rotations modulo KaTeX can only parse string typed expression, the final word becomes KaTeX can only parse string typed expression.