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 Rust (1.42.0) (judge verdict: Accepted)

//use std::convert::TryInto;
#![allow(dead_code)]

const MD: u64 = 1_000_000_007;

fn main(){
    let k: u64 = input();
    let s: String = input();
    // end input

    
    let s_len = s.len() as u64;
    let mut fact: Vec<u64> = Vec::new();
    fact.push(1);
    for i in 1..(k+s_len+1) {
        let t: u64 = fact[(i-1) as usize]*i%MD;
        fact.push(t as u64);
    }
    
    let mut ans: u64 = 0;
    for i in (0..=k).rev() {
        let t = comb(s_len+i-1, i, &fact)*pow(25, i)%MD *pow(26,k-i)%MD;
        ans = (ans+t)%MD;
    }
    println!("{}", ans);
}

fn comb(n: u64, r: u64, fact: &Vec<u64>) -> u64{
    fact[n as usize]*inv(fact[r as usize])%MD *inv(fact[(n-r) as usize])%MD
}

fn inv(n: u64) -> u64{
    pow(n, MD-2)
}

fn pow(mut x: u64, mut y: u64) -> u64{
    let mut res = 1;
    while y>0 {
        if y&1==1 { res = res*x%MD; }
        x = x*x%MD;
        y >>= 1;
    }
    res
}


/*
 * input function
 */
fn input<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


fn input_vec<T: std::str::FromStr>() -> Vec<T> {
    input::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap()).collect()
}