// Arup Guha
// 12/14/2024
// Solution to Kattis Problem: Reverse Rot
// https://open.kattis.com/problems/reverserot
// Transcribed my Python solution...

import java.util.*;

public class reverserot {

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);

		// Will break out later.
		while (true) {
			
			int shift = stdin.nextInt();

			// Get out.
			if (shift == 0)
				break;
			
			String cipher = stdin.next();
			int[] msgNums = new int[cipher.length()];
			

			// Go backwards through the message, add numeric values to list.
			for (int i=cipher.length()-1; i>=0; i--)
				msgNums[cipher.length()-1-i] = getNum(cipher.charAt(i));

			// Do shift.
			for (int i=0; i<msgNums.length; i++)
				msgNums[i] = (msgNums[i] + shift)%28;

			// Print it.
			for (int i=0; i<msgNums.length; i++)
				System.out.print(getLet(msgNums[i]));
			System.out.println();
		}
	}

	// Returns the character equivalent of num.
    public static char getLet(int num) {

		if (num < 26) return (char)('A'+num);
		if (num == 26)return '_';
		return '.';
	}

	// Returns the numeric equivalent of let.
	public static int getNum(char let) {
		if (let >= 'A' && let <= 'Z')
			return let - 'A';
		if (let == '_')	return 26;
		return 27;
	}
}