Two lines#4246

Two lines

1 second
64 megabytes
Medium

Given two strings, and , determine the minimum number of characters that must be removed from the end of string so that it appears in string at least times. The substrings found must not overlap. Note that an empty string is considered to appear infinitely many times in any string, including an empty one.

Input

The first line of the input contains a natural number . The following two lines contain the strings and , each with a length not exceeding characters. The strings are composed of characters with ASCII codes ranging from to , inclusive.

Output

Output the number of characters that need to be removed.

Examples

Example 1

Loading
Loading