import java.util.*;
import java.math.*;
class Main
{
public static void main
(String[] args
) {
Scanner in
= new Scanner
(System.
in); in.useDelimiter(""); //Чтение по одному символу.
//String a = new String();
int a = (int)in.next().charAt(0); //Первый ключ
int c1 = (int)in.next().charAt(0); //Пробел
int b = (int)in.next().charAt(0); //Второй ключ
int c2 = (int)in.next().charAt(0); //Пробел
while(in.hasNext()){
c1 = (int)in.next().charAt(0);
c2 = (int)in.next().charAt(0);
System.
out.
print((char) Math.
round((c1
-b
+256*c2
)*1.0/a
)); }
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5tYXRoLio7CiAKY2xhc3MgTWFpbgp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykKCXsKCQlTY2FubmVyIGluID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlpbi51c2VEZWxpbWl0ZXIoIiIpOyAvL9Cn0YLQtdC90LjQtSDQv9C+INC+0LTQvdC+0LzRgyDRgdC40LzQstC+0LvRgy4KCQkKCQkvL1N0cmluZyBhID0gbmV3IFN0cmluZygpOwoJCWludCBhID0gKGludClpbi5uZXh0KCkuY2hhckF0KDApOyAgLy/Qn9C10YDQstGL0Lkg0LrQu9GO0YcKCQlpbnQgYzEgPSAoaW50KWluLm5leHQoKS5jaGFyQXQoMCk7IC8v0J/RgNC+0LHQtdC7CgkJaW50IGIgPSAoaW50KWluLm5leHQoKS5jaGFyQXQoMCk7ICAvL9CS0YLQvtGA0L7QuSDQutC70Y7RhwoJCWludCBjMiA9IChpbnQpaW4ubmV4dCgpLmNoYXJBdCgwKTsgLy/Qn9GA0L7QsdC10LsKCQkKCQl3aGlsZShpbi5oYXNOZXh0KCkpewoJCQljMSA9IChpbnQpaW4ubmV4dCgpLmNoYXJBdCgwKTsKCQkJYzIgPSAoaW50KWluLm5leHQoKS5jaGFyQXQoMCk7CgkJCVN5c3RlbS5vdXQucHJpbnQoKGNoYXIpIE1hdGgucm91bmQoKGMxLWIrMjU2KmMyKSoxLjAvYSkpOwoJCX0KCX0KfQ==