// Arup Guha
// 1/30/2015
// Solution to 2014 MCPC Problem G: Reverse Rot

import java.util.*;

public class g {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int shift = stdin.nextInt();

		// Process each case.
		while (shift != 0) {

			// Read input.
			String plain = stdin.next();

			// Encrypt in reverse.
			for (int i=plain.length()-1; i>=0; i--)
				System.out.print(encrypt(plain.charAt(i), shift));
			System.out.println();

			// Get next case.
			shift = stdin.nextInt();
		}

	}

	public static char encrypt(char c, int shift) {

		// Set offset from 'A'.
		int val = 27;
		if (c >= 'A' && c <= 'Z') val = c - 'A';
		else if (c == '_') val = 26;

		// Do math.
		val = (val + shift)%28;

		// Convert back.
		if (val < 26) return (char)('A'+val);
		else if (val == 26) return '_';
		else return '.';
	}
}