Rotating every character of an alphabet by a fixed number of places and rewriting the text is a very simple way to hide it. ROT13, which rotates the letters A to Z by 13 places, works that way, and programs used it to hide data from the late 1990s into the early 2000s.
This problem adds one step to that idea. Reverse the whole string first, then rotate every character forward. For example, reversing ABCD gives DCBA, and rotating that by 1 gives EDCB.
A message consists of capital letters, underscores and periods only. Rotation follows this order.
ABCDEFGHIJKLMNOPQRSTUVWXYZ_.
The underscore comes after Z, and the period comes after the underscore. A forward rotation of 1 turns A into B and B into C, and in the same way Z into _, _ into ., and . into A. A rotation of 3 turns A into D and B into E, and in the same way . into C.
Each line holds an integer N and a string, separated by one space. N is the amount of forward rotation, and 1≤N≤27. The string is the message to encrypt. Its length is 1 to 40, and it uses capital letters, underscores and periods only. A line holding only the number 0 marks the end of the input.
For each message, print the result of reversing it and then rotating it, one message per line.