#include <stdio.h>
#include <string.h>
int main()
{
	char str[20];
	char ss[100];
	int count=0;
	scanf("%s",str);
	int abc,de,x,y,z;
	for (abc=111;abc<=999;abc++)
	{
		for (de = 11; de <=99;de++)
		{
			x = abc*(de%10);
			y = abc*(de/10);
			z = abc*de;
			sprintf(ss,"%d%d%d%d%d",abc,de,x,y,z);
			bool flag = true;
			for (int i=0;i<strlen(ss);i++)
			{
				if(strchr(str,ss[i])==NULL) 
				{
					flag = false;
					break;
				}

			}
			if (flag)
			{
				printf("<%d>\n",++count);
				printf("%5d\nX%4d\n",abc,de);
				printf("-----\n%5d\n%4d\n%5d\n",x,y,z);
			}
		}
	}

}