/*   @JUDGE_ID:   1705PZ   619   C */
#include <ctype.h>
#include <stdio.h>

int main()
{
	int i,j,k,count;
	int data[20][32],temp[32],temp1[32];
	char string[100],output[100];

	data[0][0] = 1;
	for(i = 1;i < 32;i++) data[0][i] = 0;
	for(i = 1;i < 20;i++)
	{
		for(j = 0;j < 32;j++)
			data[i][j] = data[i - 1][j] * 26;
		for(j = 0;j < 31;j++)
			if(data[i][j] >= 10) {
				data[i][j + 1] += data[i][j] / 10;
				data[i][j] %= 10;
			}
	}
	while(1)
	{
		scanf("%s",string);
		if(string[0] == '*'){ break;
		}else if(isdigit(string[0])){
			for(i = 0;i < 32;i++) temp1[i] = 0;
			for(i = 0;string[i];i++);
			for(j = 0;j < i;j++) temp1[j] = string[i - j - 1] - '0';
			count = 0;
			while(1)
			{
				for(i = 0;i < 32;i++)
					temp[i] = temp1[i];
				temp[0]--;
				for(i = 0;i < 32;i++)
					if(temp[i] < 0){
						temp[i] += 10; temp[i + 1]--;
					}
				for(i = 0;i < 32;i++) temp1[i] = 0;
				for(i = 31;!temp[i];i--);
				for(;i > 0;i--)
				{
					if(temp[i] >= 26){
						temp1[i] = temp[i] / 26;
						temp[i] %= 26;
					}
					if(temp[i])
						temp[i - 1] += temp[i] * 10;
				}
				temp1[0] = temp[0] / 26; temp[0] %= 26;
				output[count++] = temp[0] + 'a';
				for(i = 0,j = 0;i < 32;i++) j += temp1[i];
				if(!j) break;
			} 
			for(i = count - 1;i >= 0;i--) printf("%c",output[i]);
			for(i = 0;i < 22 - count;i++) printf(" ");
			for(i = 0;string[i];i++);
			for(j = 0;j < i;j++)
			{
				printf("%c",string[j]);
				if((i - j - 1) % 3 == 0 && j != i - 1)
					printf(",");
			}
			printf("\n");
		}else{
			for(i = 0;i < 32;i++) temp[i] = 0;
			for(i = 0;string[i];i++);
			for(j = 0;j < i;j++)
				for(k = 0;k < 32;k++)
					temp[k] += (string[j] - 'a' + 1) * data[i - j - 1][k];
			for(i = 0;i < 31;i++)
				if(temp[i] >= 10) {
					temp[i + 1] += temp[i] / 10;
					temp[i] %= 10;
				}
			printf("%s",string);
			for(i = 0;string[i];i++);
			for(;i < 22;i++) printf(" ");
			for(i = 31;!temp[i];i--);
			for(j = i;i >=0;i--)
			{
				printf("%d",temp[i]);
				if(i % 3 == 0 && i != 0) printf(",");
			}
			printf("\n");
		}
	}
	return 0;
}
@END_OF_SOURCE_CODE
