K. The Encrypted Parchment
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Deep inside the ancient Medina of Tunis, among the narrow alleys and whitewashed walls, a respected calligrapher and scholar left behind a mysterious parchment before disappearing during troubled times.

The parchment was discovered in a small shop near the souks. It contains an encrypted message written in lowercase English characters. The message was protected using a Caesar cipher, yet the shift number used to encrypt it is unknown.

Luckily, an old hakim (wise man) from the Medina provides a clue: he is certain that the original message contained at least one word from a given list of important Tunisian words — words such as "carthage", "zitouna", "jasmine", "kasba", or "medina".

A Caesar cipher shifts each letter in the alphabet forward by a fixed number of positions $$$k$$$ ($$$0 \le k \le 25$$$). The shift wraps around at the end of the alphabet. For example, with a shift of $$$1$$$, 'a' becomes 'b', 'b' becomes 'c', and 'z' becomes 'a'.

Your task is to determine the shift number $$$k$$$ that was used to encrypt the message.

In the first example, shifting the original words "treasure" and "madina" forward by $$$k=5$$$ results in the encrypted words "ywjfxzwj" and "rfinsf".

Input

The first line contains a single integer $$$N$$$ ($$$1 \le N \le 1000$$$) — the number of words in the encrypted text.

The second line contains a string $$$S$$$ — the encrypted text. The string contains only lowercase letters and spaces. The length of $$$S$$$ is at most $$$100,000$$$ characters and contains exactly $$$N$$$ words.

The third line contains a single integer $$$M$$$ ($$$1 \le M \le 1000$$$) — the number of words in the known list.

The next $$$M$$$ lines each contain a string — the words that could appear in the decrypted text. Each word contains only lowercase letters and has a length of at most $$$50$$$.

Output

Print a single integer: the shift number($$$0 \le \text{shift} \le 25$$$), or '-1' if it cannot be determined for certain.

Examples
Input
6
ymj ywjfxzwj nx ns ymj rfinsf
2
madina
treasure
Output
5
Input
5
o ziovx u bcxxyh nlyumoly
3
a
gold
treasure
Output
-1