
    Design a function to calculate the number of possible credit rating combinations that can be assigned across n risk assessment levels, where each level can be given one of k credit classifications, with the constraint that no more than 2 consecutive risk levels can be assigned the same credit classification. This constraint helps ensure diversified risk assessment and prevents over-concentration in any single credit classification.
    

    
def count_no_of_ways(n, k):
    """
    Design a function to calculate the number of possible credit rating combinations that can be assigned across n risk assessment levels, where each level can be given one of k credit classifications, with the constraint that no more than 2 consecutive risk levels can be assigned the same credit classification. This constraint helps ensure diversified risk assessment and prevents over-concentration in any single credit classification.
    

    """
def count_no_of_ways(n, k):
    """
    Design a function to calculate the number of possible credit rating combinations that can be assigned across n risk assessment levels, where each level can be given one of k credit classifications, with the constraint that no more than 2 consecutive risk levels can be assigned the same credit classification. This constraint helps ensure diversified risk assessment and prevents over-concentration in any single credit classification.
    

    """
    dp = [0] * (n + 1)
    total = k
    mod = 1000000007
    dp[1] = k
    dp[2] = k * k
    for i in range(3, n + 1):
        dp[i] = (k - 1) * (dp[i - 1] + dp[i - 2]) % mod
    return dp[n]