Java | Easy to understand
\nclass Solution {\n    public String findLexSmallestString(String s, int a, int b) {\n        Set<String> hs = new HashSet();\n        rec(s, a, b, hs);\n     
```\nclass Solution {\n    public String findLexSmallestString(String s, int a, int b) {\n        Set<String> hs = new HashSet();\n        rec(s, a, b, hs);\n        List<String> al = new ArrayList(hs);\n        Collections.sort(al);\n        return al.get(0);\n    }\n    \n    private void rec(String s, int a, int b, Set<String> hs){\n        if(hs.contains(s)){\n            return ;\n        }\n        hs.add(s);\n        rec(s.substring(s.length()-b) + s.substring(0, s.length()-b), a, b, hs);\n        char []c = s.toCharArray();\n        for(int i=1;i<s.length();i+=2){\n            int val = c[i]-48;\n            val = (val+a)%10;\n            c[i] = (char)(val+48);\n        }\n        rec(new String(c), a, b, hs);\n    }\n}\n```
[]