#include <stdio.h>
#include <ctype.h>

int main() {
	
	char text[1000];
	int key,i;
	char offset;
	printf("Enter The text\n");
	scanf("%s",text);
	printf("Enter the key (positive to encrypt negative to decypt zero to exit)\n");
	scanf("%i",&key);
	
	if(!key)
		return 0;
	for(i=0;text[i];i++)
	{
		offset='a';
		if(isupper(text[i]))
			offset='A';
		text[i]-=offset;
		text[i]=(26+text[i]+key)%26;
		text[i]+=offset;
	}
	printf("%s\n",text);
	return 0;
}
