KIT - Krypt in Time

no tags 

In a land far away people can travel back in time in person or send messages to them in the past. Sending messages that can change ones future is forbidden. The messages that are sent are intercepted by the time police. Jim wants to send a message to himself in the past to prevent his death. He decides to encrypt using a "number-pad". All the numbers in number-pad are between 0 and 25. The message he wants to send can be encrypted if each character in the string is encoded by a number from the pad provided each number from the number- pad is only used once. The encryption is done by shifting each letter in the message by k positions, where k is determined by the number-pad. Shift occurs between the alphabets "a" and "z". If a letter in the message is shifted past "z" then it starts back at "a" and continues to shift.

For example: If the number-pad contains 2, the message abc is transformed to cde and xyz to zab.

Input

The first line will contain the size of the number-pad N, followed by a sequence of numbers for the pad. The remaining input consists of a series of words to be encrypted using the number-pad. You may assume that the maximum size of the pad (N) is 100 numbers, all numbers in the pad are between 0 and 25, and that all input will be lowercase letters. The end of input is indicated by -1.

Output

For each word to be encrypted, output a line containing the encrypted word.

Example

Input:
10
1 2 3 4 5 4 3 2 1 0
aa aaa
zzzzz
-1

Output:
bc
def
dcbaz

hide comments
Francky: 2014-04-16 15:30:02

Submit is now allowed, and psetter didn't let new comment :(
Now the problem is visible.

Francky: 2014-04-16 15:28:43

Problem hidden waiting for an answer from psetter. Please enable submissions in "edit problem" section.

Jacob Plachta: 2014-04-17 11:41:26

Please leave problems as "Hidden" rather than "Classical" until they can be submitted for.


Added by:Arjun Krishnan
Date:2014-03-13
Time limit:3s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C CSHARP C++ 4.3.2 CPP JAVA PHP PYTHON