There are many cards, each showing one integer from $1$ to $1000$. Anna and Bruno play the following game with these cards.
Anna holds a pile of $A$ cards and Bruno holds a pile of $B$ cards. Anna discards any number of cards (possibly $0$) from her $A$ cards to form a new pile. Bruno discards some number of cards (possibly $0$) from the top of his pile of $B$ cards and some number of cards (possibly $0$) from the bottom to form a new pile. When discarding, the order of the remaining cards is never changed.
If the two piles formed this way are identical, the number of cards in one of the piles becomes the score of both players. Here, the two piles are identical if they contain the same number of cards $n$ and, for every position, the integer on the $i$-th card from the top ($1 \le i \le n$) is the same in both piles.
For example, suppose Anna holds 5 cards showing $1, 2, 3, 4, 5$ from top to bottom, and Bruno holds 4 cards showing $3, 1, 4, 1$ from top to bottom. If Anna discards the cards $2, 3, 5$ and Bruno discards the top $3$ and the bottom $1$, both piles become $1, 4$ from the top and are identical. The remaining pile has 2 cards, so both players score $2$.
We want to find the maximum possible score. Given the information about the piles held by Anna and Bruno, write a program that computes the maximum score.
Read the following data from standard input.
Constraints
Print the maximum score as a single integer on one line.