Python Medium
\nclass Solution:\n    def stringCount(self, n: int) -> int:\n        MOD = 10 ** 9 + 7\n\n        if n < 4:\n            return 0\n\n        @cache\n        de
```\nclass Solution:\n    def stringCount(self, n: int) -> int:\n        MOD = 10 ** 9 + 7\n\n        if n < 4:\n            return 0\n\n        @cache\n        def calc(n, c_l, c_e, c_t):\n            if n == 0:\n                if c_l + c_e + c_t == 0:\n                    return 1\n                return 0\n\n            total = 23 * calc(n - 1, c_l, c_e, c_t) % MOD\n\n            if c_l:\n                total += calc(n - 1, c_l - 1, c_e, c_t) % MOD\n\n            else:\n                total += calc(n - 1, c_l, c_e, c_t) % MOD\n\n            if c_e:\n                total += calc(n - 1, c_l, c_e - 1, c_t) % MOD\n\n            else:\n                total += calc(n - 1, c_l, c_e, c_t) % MOD\n\n            if c_t:\n                total += calc(n - 1, c_l, c_e, c_t - 1) % MOD\n\n            else:\n                total += calc(n - 1, c_l, c_e, c_t) % MOD\n\n\n            return total % MOD\n        \n\n\n\n        return calc(n, 1, 1, 2) % MOD\n```
['Python3']