|Author:||A. Baranov||Time limit:||1 sec|
|Input file:||Standard input||Memory limit:||512 Mb|
|Output file:||Standard output|
Vasya found out that his grandfather has been fond of solving crossword puzzles for a very long time.
On his anniversary, Vasya decided to present him a game, which is a generalized version of the crossword puzzle — "graphword".
A playing field in it is an undirected graph the vertices of which are assigned lowercase letters of the Latin alphabet.
In the process of solving the "graphword" the player needs to compose words by moving along the edges of such a graph.
According to the rules of the game, each edge can be visited more than once.
However, it is forbidden for the current edge to coincide with the previous one.
When developing levels for his game, Vasya was faced with the task of determining the number of all possible paths,
forming some given word in a given graph.
Since the resulting number may be too large, the answer should be the remainder of its division by 109.
Input starts with the number of vertices N, followed by the set of characters assigned to each of the vertices.
Next, the number of edges M is given, followed by the edges themselves,
each of which is given by the indices of its vertices: ai, bi. Vertices are numbered starting from zero.
Input is finished with the string W, for which calculation should be done.
Output must contain a single integer.
1 ≤ N ≤ 104, 0 ≤ M ≤ 104, ai ≠ bi, 1 ≤ |W| ≤ 10
|No.||Standard input||Standard output|