#include <stdio.h>
#include <cs50.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
  
int main(int argc,string argv[]){
 
if (argc != 2) {
    return 1;
}
 
int k = atoi(argv[1]) % 26;
string msg = GetString();
int msglen = strlen(msg);
 
 
for (int i = 0; i < msglen; i++) {
     
    if (isupper(msg[i]) && msg[i] + k > 90 ) {
        printf("%c", (msg[i] + k) % 90 + 65);
    }
    else if (islower(msg[i]) && msg[i] + k > 90) {
        printf("%c", (msg[i] + k) % 172 + 97);
    }
    else if (!isalpha(msg[i])){
        printf("%c", msg[i]);
    }
    else {
        printf("%c", (char) msg[i] + k);
    }
}
printf("\n");
return 0;
 
 
}