Little Petya loves his job as a night shift guard, where he is responsible for protecting towers. Each tower is equipped with a light bulb that can either be functioning or broken, and each tower contains a certain amount of treasure. Petya is aware that thieves might attempt to steal the treasures each night. However, the thieves are afraid of the dark and will only target towers with a working light bulb.
Every night, some bulbs are repaired while others may break. Specifically, according to the Unknown Universal Law, the state of the bulb in tower P_i on a given night becomes the same as the state of the bulb in tower on the previous night. In addition, all P_i are distinct.
Petya wants to know the maximum amount of treasure that could be stolen on the first night, second night, ..., up to the -th night. The thieves are purely hypothetical, so we assume that no treasure is actually stolen at the start of each night. During any night, the thieves may rob from any tower with a working bulb, possibly stealing from multiple towers in the same night.
The first line contains one integer (1 \leq N \leq 10^5) — the number of towers. The second line contains distinct integers between and : P_1, P_2, \ldots, P_N. The third line contains integers a_1, a_2, \ldots, a_N (0 \leq a_i \leq 10^6), where a_i is the amount of treasure in the -th tower. The fourth line contains a string of characters, each either or . The -th character is if the bulb in the -th tower is broken, and if it is working. The fifth line contains one integer (1 \leq M \leq 10^5) — the number of nights Petya wants to check.
Output exactly lines. The -th line should contain the amount of treasure that could be hypothetically stolen on the -th night, modulo 10^9+7.
Example 1