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: Accepted)


import java.io.*;
import java.util.*;

/**
 * @author Tran Anh Tai
 * @template for CP codes
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{
        static int MOD = 1000000007;
        public long pow(long x, long y){
            if (y == 0){
                return 1;
            }
            else{
                long au = pow(x, y / 2);
                au = (au * au) % MOD;
                if (y % 2 == 0){
                    return au;
                }
                else{
                    return (au * x)% MOD;
                }
            }
        }
        public void solve(InputReader in, PrintWriter out){
            int k = in.nextInt();
            String s = in.nextToken();
            int n = s.length();
            long cur = pow(26, k);
            long total = cur;
            for (int last = n + 1; last <= n + k; last++){
                cur = (cur * 25) % MOD;
                cur = (cur * (last -  1)) % MOD;
                cur = (cur * pow(26, MOD - 2)) % MOD;
                cur = (cur * pow(last - n, MOD - 2)) % MOD;
                total = (total + cur) % MOD;
            }
            out.println(total);
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
}