Monkey at the Keyboard#5887

Monkey at the Keyboard

5 seconds
64 megabytes
Very easy

"Entertaining Math" show hosts decided to demonstrate to their audience the well-known fact that, according to probability theory, a monkey randomly pressing keyboard buttons will eventually type any given word.

The monkey invited for filming from the city zoo is already trained: every second, it types one of the first letters of the English alphabet, each with equal probability. Fortunately, the word prepared by the hosts also uses only these first letters.

Before letting the monkey start typing, the hosts would like to know how long the process will take. More precisely, after how many seconds is the given word expected to appear for the first time in the sequence typed by the monkey?

Input

The first line contains an integer (1 \leq N \leq 26), the number of letters the monkey can type. The second line contains the word prepared by the hosts. This word contains only the first lowercase Latin letters. Its length is positive and does not exceed .

Output

Output the expected time the monkey will need to type the word, rounded down to the nearest integer.

Examples

Example 1

Loading
Loading