Strivore

AtCoder
IDabc171_f
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
5
oof
Output #1
575111451

For example, we can obtain `proofend`, `moonwolf`, and `onionpuf`, while we cannot obtain `oofsix`, `oofelevennn`, `voxafolt`, or `fooooooo`.
Input #2
37564
whydidyoudesertme
Output #2
318008117
API Response (JSON)
{
  "problem": {
    "name": "Strivore",
    "description": {
      "content": "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 pr",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc171_f"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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\"?\nThe answer can be enormous, so pr...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments