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 C++ (GCC 9.2.1) (judge verdict: Accepted)

#ifdef DEBUG
#include "../../lib/utils.cpp"
#endif
#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;
#define int int64_t
#define INF 10e9

 
/* ==== declarations ====== */
// functions
void solve();
void getInput();
 
// global variables
int K;
string S;
int N;
vector<vector<int>> dp;

template <std::uint_fast64_t Modulus> class modint {
    using u64 = std::uint_fast64_t;
public:
    u64 value;

    constexpr modint(const u64 x = 0) noexcept : value(x % Modulus) {
        // cout<<"constructor is called"<<endl;
    }
    constexpr modint operator+(const modint rhs) const noexcept {
        return modint(*this) += rhs;
    }
    constexpr modint operator-(const modint rhs) const noexcept {
        return modint(*this) -= rhs;
    }
    constexpr modint operator*(const modint rhs) const noexcept {
        return modint(*this) *= rhs;
    }
    constexpr modint operator/(const modint rhs) const noexcept {
        return modint(*this) /= rhs;
    }
    constexpr modint &operator+=(const modint rhs) noexcept {
        value += rhs.value;
        if (value >= Modulus) {
            value -= Modulus;
        }
        return *this;
    }
    constexpr modint &operator-=(const modint rhs) noexcept {
        if (value < rhs.value) {
            value += Modulus;
        }
        value -= rhs.value;
        return *this;
    }
    constexpr modint &operator*=(const modint rhs) noexcept {
        value = value * rhs.value % Modulus;
        return *this;
    }
    constexpr modint &operator/=(modint rhs) noexcept {
        if(value%rhs.value!=0) {
            cout<<"modint error!: cannnot divide value ("<<value<<") by ("<<rhs.value<<")"<<endl;
            exit(1);
        }
        value = value/rhs.value;
        return *this;
    }

    constexpr modint pow(int64_t t) noexcept {
        if(t==0) return 1;
        modint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    constexpr modint inv() noexcept {
        return pow(Modulus-2);
    }
    friend std::istream &operator>>(std::istream &is, modint &x) { u64 t; is >> t; x = modint(t); return is; }
    friend std::ostream &operator<<(std::ostream &os, const modint &x) { os << x.value;  return os; }

    static modint calcPermutation(int64_t n, int64_t r){
        modint res = 1;
        for(int64_t i = 0; i < r; ++i){
            res *= (n - i);
        }
        return res;
    }

    static modint calcCombination(int64_t n, int64_t r) {
        assert(n<Modulus);
        static vector<modint> factorial, factorial_inv;
        if (factorial.size() == 0) {
            int maxsize = 2000000;
            factorial.resize(maxsize);
            factorial_inv.resize(maxsize);
            factorial[0] = 1;
            for(int i=1; i<=maxsize; ++i) factorial[i] = factorial[i-1] * i;
            factorial_inv[maxsize] = factorial[maxsize].inv();
            for(int i=maxsize; i>=1; --i) factorial_inv[i-1] = factorial_inv[i] * i;
        }
        return factorial[n]*factorial_inv[r]*factorial_inv[n-r];
    }
};


void getInput() {
    cin>>K;
    cin>>S;
    N = K + S.size();
}
 

void solve() {
    using mi = modint<1000000007>;
    mi total;
    for(int i=S.size(); i<N+1; ++i) {
        auto numCombs = mi::calcCombination(i-1, S.size()-1);
        int fp = i - S.size();
        int lp = N - i;
        auto score = mi(25).pow(fp) * numCombs * mi(26).pow(lp);
        total += score;
    }
    cout<<total<<endl;
}
 
 
signed main(){
    getInput();
    solve();
    
    return 0;
}