------
## 最终结论
```python
def count_good_strings(n, s1, s2, evil):
    MOD = 10**9 + 7
    evil_len = len(evil)
    
    # dp[pos][is_prefix_s1][is_prefix_s2][evil_count]
    dp = [[[[-1 for _ in range(evil_len + 1)] for _ in range(2)] for _ in range(2)] for _ in range(n + 1)]
    
    def dfs(pos, is_prefix_s1, is_prefix_s2, evil_count):
        if evil_count == evil_len:
            return 0
        if pos == n:
            return 1
        
        if dp[pos][is_prefix_s1][is_prefix_s2][evil_count] != -1:
            return dp[pos][is_prefix_s1][is_prefix_s2][evil_count]
        
        total = 0
        lower_bound = s1[pos] if is_prefix_s1 else 'a'
        upper_bound = s2[pos] if is_prefix_s2 else 'z'
        
        for char in range(ord(lower_bound), ord(upper_bound) + 1):
            next_is_prefix_s1 = is_prefix_s1 and (char == ord(lower_bound))
            next_is_prefix_s2 = is_prefix_s2 and (char == ord(upper_bound))
            
            # Check for the next evil_count
            next_evil_count = evil_count
            while next_evil_count > 0 and chr(char) != evil[next_evil_count]:
                next_evil_count -= 1
            
            if chr(char) == evil[next_evil_count]:
                next_evil_count += 1
            
            total += dfs(pos + 1, next_is_prefix_s1, next_is_prefix_s2, next_evil_count)
            total %= MOD
        
        dp[pos][is_prefix_s1][is_prefix_s2][evil_count] = total
        return total
    
    # Handle edge cases
    if s1 == s2:
        if evil in s1:
            return 0
        else:
            return 1

    if not evil:
        total = 1
        for i in range(n):
            total *= (ord(s2[i]) - ord(s1[i]) + 1)
            total %= MOD
        return total

    return dfs(0, True, True, 0)

# Example usage:
print(count_good_strings(2, "aa", "da", "b"))   # Output: 51
print(count_good_strings(8, "leetcode", "leetgoes", "leet"))   # Output: 0
print(count_good_strings(2, "gx", "gz", "x"))   # Output: 2
```