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 Haskell (GHC 8.8.3) (judge verdict: Wrong Answer)

{-# LANGUAGE BangPatterns #-}

import qualified Data.ByteString.Char8 as C
import Data.Vector.Unboxed
  (foldl1', generate, prescanl', prescanr', replicate, reverse, zipWith4)
import Prelude hiding (replicate, reverse)

main = print =<< sol <$> readLn <*> (C.length <$> C.getLine)

sol k n = foldl1' (.+.) $ zipWith4 (\a b c d -> a .*. b .*. c .*. d) c1 c2 p1 p2
  where
  c1 = prescanl' (.*.) (fac (n-1)) $ generate (k+1) (n+)
  c2 = prescanr' (.*.) (inv $ fac (n-1)*fac k) $ generate (k+1) id
  p1 = prescanl' (.*.) 1 $ replicate (k+1) 25
  p2 = reverse . prescanl' (.*.) 1 $ replicate (k+1) 26

(.*.) = ((`mod` p) .) . (*)
(.+.) = ((`mod` p) .) . (+)

p = 10^9+7 :: Int

inv 1 = 1
inv !a = pwr a (p-2)

pwr !a !n
  | n == 0    = 1
  | odd n     = a .*. r
  | otherwise = r
  where
  q = pwr a (n `div` 2)
  r = q .*. q

fac 0 = 1
fac !n = n .*. fac (n-1)