You are given a string S which consists of digits from 0 to 9 and two integer R and A. There are two operations which you can do on a string.
You can use Rotate operation to rotate a string clockwise by R positions. For example if R=1 , string "581" will become "158" . Also you can use Add operation to add number A to all odd indexes of string ( 0 based indexing). For example if A=3 , then string "781" will become "711". Digits post 9 are cycled back to zero.
You can use any of the two operation any number of times in any order to return the lexicographical smallest string.
0<N<10 length of string
rotate it by 1, it becomes 13 and 4 two times to 3 it will be 11.
How to solve.