Problem:
Score: 600 points

Problem Statement

How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"?

The answer can be enormous, so print it modulo (10^9+7).

Constraints

K is an integer between 1 and 10^6 (inclusive).

S is a string of length between 1 and 10^6 (inclusive) consisting of lowercase English letters.

Input

Input is given from Standard Input in the following format:

K
S

Output

Print the number of strings satisfying the condition, modulo (10^9+7).

Sample Input 1

5
oof

Sample Output 1

575111451

For example, we can obtain proofend, moonwolf, and onionpuf, while we cannot obtain oofsix, oofelevennn, voxafolt, or fooooooo.

Sample Input 2

37564
whydidyoudesertme

Sample Output 2

318008117

Solution in Java (OpenJDK 1.8.0) (judge verdict: Runtime Error)

import java.util.Scanner;

public class Main {
static long[] nCrModp(int n, int r, long p) { 
        if (r > n - r) 
            r = n - r; 
  
        long C[] = new long[r + 1]; 
  
        C[0] = 1;  
        for (int i = 1; i <= n; i++) { 
   
            for (int j = Math.min(i, r); j > 0; j--) 
  
                C[j] = (C[j] + C[j - 1]) % p; 
        } 
        return C; 
    } 
    
    public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int add = scanner.nextInt();
		String temp = scanner.next();
		int length = temp.length();
		long mod = (long) (Math.pow(10, 9) + 7l);
		int amount = length + add;
		long[] powers = new long[amount + 1];
		powers[0] = 1l;
		for (int i = 0; i < powers.length - 1; i++) 
		    powers[i + 1] = powers[i] * 25 % mod;
		
		long[] combinations = nCrModp(amount, length, mod);
		long result = 1l;
		for(int i = 0; i < amount; i++) 
			result = result * 26 % mod;
		for(int i = 0; i < length; i++) {
			long temporal = powers[amount - i] * combinations[combinations.length - length + i - 1] % mod;
			result -= temporal;
			while(result < 0)
				result += mod;
			result %= mod;
		}
		System.out.print(result);
	}  
}