import java.util.Scanner; public class Main { private static char[] array = new char[] { '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '.' }; public static void main(String[] args) { Scanner input = new Scanner(System.in); String str; int key; String ciphertext; Integer[] plaincode; while (input.hasNext()) { str = input.nextLine(); if(str.equals("0")) { input.close(); break; } key = Integer.valueOf(str.split(" ")[0]); ciphertext = str.split(" ")[1]; plaincode = new Integer[ciphertext.length()]; for (int i = 0; i < ciphertext.length(); i++) { int y = (key * i) % ciphertext.length(); int ciphercode = getciphercode(ciphertext.charAt(i)); if(ciphercode != 27) { plaincode[y] = ciphercode + i; } else { plaincode[y] = -1 + i; } } for(int i = 0; i < plaincode.length; i++) { System.out.print(array[plaincode[i]%28]); } System.out.println(); } } private static int getciphercode(char character) { for(int i = 0; i < array.length; i++) { if(array[i] == character) { return i; } } return 0; } }