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 11.0.6) (judge verdict: Runtime Error)

import java.util.*;

public class Main {

	// global
	static int mod = 1_000_000_007;
	static long fact[];
	static long inverse[];

	static long pow(long a,int n) {
	    long res=1;
	    while (n>0) {
	        if ((n-n/2*2)==1) {
	            res=res*a%mod;
	        }
	        a=a*a%mod;
	        n>>=1;
	    }
	    return res;
	}

	static long modinv(long n) {
	    return pow(n, mod-2);
	}

	static long comb(int n,int k){
    	if(n<0 || k<0 || n<k)return 0;
    	return fact[n]*(inverse[k]*inverse[n-k]%mod) %mod;
	}


	public static void main(String[] args) {
		// main method
		fact=new long[300000];
		fact[0]=1;
		inverse=new long[300000];
		inverse[0]=1;
		for(int i=1;i<300000;i++){
		    fact[i]=(fact[i-1]*(long)i)%mod;
		    inverse[i]=modinv(fact[i]);
		}
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		String S = sc.next();

		int N = S.length();
		long ans = 0L;
		for (int i=N;i<=K+N;i++) {
			ans = (ans + comb(i-1, N-1)*pow(25, i-N)%mod*pow(26, K+N-i)%mod)%mod;
		}
		System.out.println(ans);
	}
}