BFS bruteforce that beats 99%
\n\n\n# Code\n\nclass Solution:\n    def findLexSmallestString(self, s: str, a: int, b: int) -> str:\n        def shift_right(x, y):\n            l = len(x)\n  
![380px-Viktor_Vasnetsov_-_\u0411\u043E\u0433\u0430\u0442\u044B\u0440\u0438_-_Google_Art_Project.jpg](https://assets.leetcode.com/users/images/202933a7-d358-47f5-8789-bc6a61762cd9_1713995415.0013185.jpeg)\n\n\n# Code\n```\nclass Solution:\n    def findLexSmallestString(self, s: str, a: int, b: int) -> str:\n        def shift_right(x, y):\n            l = len(x)\n            k = l - y\n            return x[k:] + x[:k]\n        def add_to_all_odd(x, y):\n            z = list(x)\n            for i in range(1, len(x), 2):\n                z[i] = (z[i] + y) % 10\n            return tuple(z)\n        \n        c = tuple(map(int, s))\n\n        v = set([])\n        q = deque([c])\n        while q:\n            n = q.popleft()\n            if n not in v:\n                v.add(n)\n                q.append(shift_right(n, b))\n                q.append(add_to_all_odd(n, a))\n        return \'\'.join(map(str, min(v)))\n```
['Python3']