D. A Simple String Problem
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

You are given a character grid with $$$2$$$ rows and $$$n$$$ columns, where each cell contains a lowercase letter. You can start at any position in the grid and move several steps, with each step either to the right or downward, stopping at any cell. Concatenating the characters from the cells visited in order forms a string.

A string $$$S$$$ is called a double string if and only if there exists a non-empty string $$$T$$$ such that $$$S = TT$$$. For example, $$$\texttt{aa}$$$ and $$$\texttt{xyzxyz}$$$ are double strings, while $$$\texttt{a}$$$ and $$$\texttt{xyzyz}$$$ are not.

Given the character grid, find the length of the longest double string you can obtain.

Input

The first line contains an integer $$$n$$$ ($$$1 \le n \le 2 \times 10^5$$$), representing the number of columns in the character grid.

The next two lines contain two strings of length $$$n$$$ consisting only of lowercase English letters, representing the character grid.

Output

Output a single integer, representing the length of the longest double string you can obtain.

Examples
Input
5
abcab
acabc
Output
6
Input
6
babbaa
babaaa
Output
6
Input
2
ne
fu
Output
0
Note

In the first example, the longest double string can be obtained as follows (not unique):

$$$$$$ \begin{aligned} \underline{\texttt{abc}}\texttt{ab}\\ \texttt{ac}\underline{\texttt{abc}} \end{aligned} $$$$$$