#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

int n, p, q, ans = 0;
string s;
bool b = false;
int main()
{
	cin >> n >> p >> q >> s;
	int k = 0, l = 0;
	for (int i = 0; i < 101; ++i)
	{
		for (int j = 0; j < 101; ++j)
		{
			if (i* p + j * q == n)
			{
				ans = i + j;
				k = i; l = j;
				b = true;
				break;
			}
		}
		if (b) break;
	}
	if (b)
	{
		cout << ans << endl;
		int j = 0;
		for (int i = 0; i < k * p; ++i)
		{
			if (j == p) { j = 0; cout << endl; }
			if (j < p) {
				 cout<<s[i];
			}
			j++;
		}
		j = 0;
		if (k != 0)	cout << endl;
		for (int i = k * p; i < l * q + k * p; ++i)
		{
			if (j == q) { j = 0; cout << endl; }
			if (j < q) {
				cout << s[i];
			}
			j++;
		}
	}
	else
	{
		cout << -1;
	}
	return 0;
}


#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <iostream>
using namespace std;

char tm[1005];
int n;
int main()
{
    int q,p;
    int tmp;
scanf("%d%d%d",&n,&p,&q);
scanf("%s",tm+1);

    int i;
int flag=0;
int mark=-1;
for (i=0;i<=n/p;i++)
{
    if( ((n-i*p)%q)==0)
    {
        flag=1;
        mark=i;
            break;
    }
}
    if (flag==0)
    {printf("-1\n");return 0;}
    int j=1;

    int timess=(n-(p*mark))/q;

    printf("%d\n",mark+timess);
    for (i=1;i<=mark;i++)
    {
        int tmp=p;
        while(tmp--)
        {
            printf("%c",tm[j++]);
        }
        printf("\n");
    }
    for (i=1;i<=timess;i++)
    {
        int tmp=q;
        while(tmp--)
        {
            printf("%c",tm[j++]);
        }
        printf("\n");

    }

    return 0;

}


#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <iostream>
using namespace std;

char tm[1005];
int n;
int main()
{
    int q,p;
    int tmp;
scanf("%d%d%d",&n,&p,&q);
scanf("%s",tm+1);

    int i;
int flag=0;
int mark=-1;
for (i=0;i<=n/p;i++)
{
    if( ((n-i*p)%q)==0)
    {
        flag=1;
        mark=i;
            break;
    }
}
    if (flag==0)
    {printf("-1\n");return 0;}
    int j=1;
    for (i=1;i<=mark;i++)
    {
        int tmp=p;
        while(tmp--)
        {
            printf("%c",tm[j++]);
        }
        printf("\n");
    }
    int timess=(n-j+1)/q;
    for (i=1;i<=timess;i++)
    {
        int tmp=q;
        while(tmp--)
        {
            printf("%c",tm[j++]);
        }
        printf("\n");

    }

    return 0;

}


#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int len=0;
	int len1=0;
	int len2=0;
	int k=0;
	int i=0;
	int j=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
			printf("-1\n");
		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
				printf("\n");
			}
		}
		else
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
				printf("\n");
			}
		}
	}
	else
	{
		k=2;
		printf("%d\n",k);
		for(;i<p;i++)
		{
			printf("%c",str[i]);
			if(i==(p-1))
			printf("\n");
		}
		for(i=0;i<q;i++)
		{
			printf("%c",str[i+2]);
			if(i==(q-1))
			printf("\n");
		}
	}

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int max(int a,int b)
{
	int temp=0;
	if(a>b)
		temp=a;
	else
		temp=b;
	return temp;
}

int min(int a,int b)
{
	int temp=0;
	if(a>b)
		temp=b;
	else
		temp=a;
	return temp;
}

int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int k=0;
	int len1=0;
	int len2=0;
	int i=0;
	int j=0;
	int tempmax=0;
	int tempmin=0;
	int temp1=0;
	int temp2=0;
	int flag=0;
	int len=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
		{
			tempmax=max(p,q);
			for(i=n/tempmax;i>=1;i--)
			{
				temp1=n-tempmax*i;
				if(temp1%q==0)
				{
					flag=1;
					break;
				}
			}
			if(flag==0)
				printf("-1\n");
			else
			{
				tempmin=min(p,q);
				temp2=i;
				k=temp2+temp1/tempmin;
				printf("%d\n",k);
				for(i=0;i<temp2;i++)
				{
					for(j=0;j<tempmax;j++)
					{
						printf("%c",str[j+i*tempmax]);
						if(j==(tempmax-1))
							printf("\n");
					}
				}
				for(;i<k;i++)
				{
					for(j=0;j<tempmin;j++)
					{
						printf("%c",str[j+temp2*tempmax+(i-temp2)*tempmin]);
						if(j==(tempmin-1))
							printf("\n");
					}
				}

			}
		}
		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
					printf("\n");
			}
		}
		else if(len1!=0&&len2==0)
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
					printf("\n");
			}
		}
		else
		{
			tempmax=max(p,q);
			k=n/tempmax;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%tempmax==0)
					printf("\n");
			}
		}
	}

	else
	{
		k=2;
		printf("%d\n",k);
		tempmax=max(p,q);
		//tempmin=min(p,q);
		for(;i<tempmax;i++)
		{
			printf("%c",str[i]);
			if(i==(tempmax-1))
			printf("\n");
		}
		for(i=tempmax;i<n;i++)
		{
			printf("%c",str[i]);
			if(i==(n-1))
			printf("\n");
		}
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int len=0;
	int len1=0;
	int len2=0;
	int k=0;
	int ktmp=0;
	int i=0;
	int j=0;
	int temp=0;
	int remainer=0;
	int quotient=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
		{
			if(p>q)
			{
				remainer=n%p;
				quotient=n/p;
				len1=quotient%q;
				len2=remainer%q;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				else if((len1==0)&&(len2!=0))
				{
					ktmp=remainer;
					k=ktmp+(n-ktmp*p)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else if((len1!=0)&&(len2==0))
				{
					ktmp=quotient;
					k=ktmp+(n-ktmp*p)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else //if((quotient/q)==0)&&(remainer/q)==0))
				{
					k=n/q;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[j+i*q]);
						j=i+1;
						if(j%q==0)
							printf("\n");
					}
				}
			}

			else
			{
				remainer=n/q;
				quotient=n%q;
				len1=quotient%p;
				len2=remainer%p;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				else if((len1==0)&&(len2!=0))
				{
					ktmp=remainer;
					k=ktmp+(n-ktmp*q)/p;
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else if((len1!=0)&&(len2==0))
				{
					ktmp=quotient;
					k=ktmp+(n-ktmp*q)/p;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else
				{
					k=n/p;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[i]);
						j=i+1;
						if(j%p==0)
							printf("\n");
					}
				}
			}
		}

		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
					printf("\n");
			}
		}
		else if(len1!=0&&len2==0)
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
					printf("\n");
			}
		}
		else
		{
			if(p>q)
				temp=q;
			else
				temp=q;
			k=n/temp;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%temp==0)
					printf("\n");
			}
		}
	}

	else
	{
		k=2;
		printf("%d\n",k);
		if(p>q)
			temp=q;
		else
			temp=q;
		for(;i<temp;i++)
		{
			printf("%c",str[i]);
			if(i==(temp-1))
			printf("\n");
		}
		for(i=temp;i<n;i++)
		{
			printf("%c",str[i]);
			if(i==(n-1))
			printf("\n");
		}
	}

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int len=0;
	int len1=0;
	int len2=0;
	int k=0;
	int ktmp=0;
	int i=0;
	int j=0;
	int temp=0;
	int remainer=0;
	int quotient=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
		{
			if(p>q)
			{
				remainer=n%p;
				quotient=n/p;
				len1=quotient%q;
				len2=remainer%q;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				else if((len1==0)&&(len2!=0))
				{
					ktmp=remainer;
					k=ktmp+(n-ktmp*p)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else if((len1!=0)&&(len2==0))
				{
					ktmp=quotient;
					k=ktmp+(n-ktmp*p)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else //if((quotient/q)==0)&&(remainer/q)==0))
				{
					k=n/q;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[j+i*q]);
						j=i+1;
						if(j%q==0)
							printf("\n");
					}
				}
			}

			else
			{
				remainer=n/q;
				quotient=n%q;
				len1=quotient%p;
				len2=remainer%p;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				else if((len1==0)&&(len2!=0))
				{
					ktmp=remainer;
					k=ktmp+(n-ktmp*q)/p;
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else if((len1!=0)&&(len2==0))
				{
					ktmp=quotient;
					k=ktmp+(n-ktmp*q)/p;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else
				{
					k=n/p;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[j+i*p]);
						j=i+1;
						if(j%p==0)
							printf("\n");
					}
				}
			}
		}

		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
					printf("\n");
			}
		}
		else if(len1!=0&&len2==0)
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
					printf("\n");
			}
		}
		else
		{
			if(p>q)
				temp=q;
			else
				temp=q;
			k=n/temp;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%temp==0)
					printf("\n");
			}
		}
	}

	else
	{
		k=2;
		printf("%d\n",k);
		for(;i<p;i++)
		{
			printf("%c",str[i]);
			if(i==(p-1))
			printf("\n");
		}
		for(i=0;i<q;i++)
		{
			printf("%c",str[i+2]);
			if(i==(q-1))
			printf("\n");
		}
	}

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int max(int a,int b)
{
	int temp=0;
	if(a>b)
		temp=a;
	else
		temp=b;
	return temp;
}

int min(int a,int b)
{
	int temp=0;
	if(a>b)
		temp=b;
	else
		temp=a;
	return temp;
}

int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int k=0;
	int len1=0;
	int len2=0;
	int i=0;
	int j=0;
	int tempmax=0;
	int tempmin=0;
	int temp1=0;
	int temp2=0;
	int flag=0;
	int len=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
		{
			tempmax=max(p,q);
			for(i=n/tempmax;i>=1;i--)
			{
				temp1=n-tempmax*i;
				if(temp1%q==0)
				{
					flag=1;
					break;
				}
			}
			if(flag==0)
				printf("-1\n");
			else
			{
				tempmin=min(p,q);
				temp2=i;
				k=temp2+temp1/tempmin;
				printf("%d\n",k);
				for(i=0;i<temp2;i++)
				{
					for(j=0;j<tempmax;j++)
					{
						printf("%c",str[j]);
						if(j==(tempmax-1))
							printf("\n");
					}
				}
				for(;i<k;i++)
				{
					for(j=0;j<tempmin;j++)
					{
						printf("%c",str[j]);
						if(j==(tempmin-1))
							printf("\n");
					}
				}

			}
		}
		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
					printf("\n");
			}
		}
		else if(len1!=0&&len2==0)
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
					printf("\n");
			}
		}
		else
		{
			tempmax=max(p,q);
			k=n/tempmax;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%tempmax==0)
					printf("\n");
			}
		}
	}

	else
	{
		k=2;
		printf("%d\n",k);
		tempmax=max(p,q);
		//tempmin=min(p,q);
		for(;i<tempmax;i++)
		{
			printf("%c",str[i]);
			if(i==(tempmax-1))
			printf("\n");
		}
		for(i=tempmax;i<n;i++)
		{
			printf("%c",str[i]);
			if(i==(n-1))
			printf("\n");
		}
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int len=0;
	int len1=0;
	int len2=0;
	int lentmp=0;
	int k=0;
	int ktmp;
	int i=0;
	int j=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
		{
			if(p>q)
			{
				ktmp=n/p;
				lentmp=len1;
				if(lentmp%q==0)
				{
					k=ktmp+lentmp/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else
					printf("-1\n");
			}
			else
			{
				ktmp=n/q;
				lentmp=len2;
				if(lentmp%p==0)
				{
					k=ktmp+lentmp/p;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else
					printf("-1\n");
			}

		}
		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
				printf("\n");
			}
		}
		else
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
				printf("\n");
			}
		}
	}
	else
	{
		k=2;
		printf("%d\n",k);
		for(;i<p;i++)
		{
			printf("%c",str[i]);
			if(i==(p-1))
			printf("\n");
		}
		for(i=0;i<q;i++)
		{
			printf("%c",str[i+2]);
			if(i==(q-1))
			printf("\n");
		}
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int len=0;
	int len1=0;
	int len2=0;
	int k=0;
	int ktmp=0;
	int i=0;
	int j=0;
	int temp=0;
	int remainer=0;
	int quotient=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
		{
			if(p>q)
			{
				remainer=n%p;
				quotient=n/p;
				len1=quotient%q;
				len2=remainer%q;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				else if((len1==0)&&(len2!=0))
				{
					ktmp=remainer;
					k=ktmp+(n-ktmp*p)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else if((len1!=0)&&(len2==0))
				{
					ktmp=quotient;
					k=ktmp+(n-ktmp*p)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else //if((quotient/q)==0)&&(remainer/q)==0))
				{
					k=n/q;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[j+i*q]);
						j=i+1;
						if(j%q==0)
							printf("\n");
					}
				}
			}

			else
			{
				remainer=n/q;
				quotient=n%q;
				len1=quotient%p;
				len2=remainer%p;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				else if((len1==0)&&(len2!=0))
				{
					ktmp=remainer;
					k=ktmp+(n-ktmp*q)/p;
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else if((len1!=0)&&(len2==0))
				{
					ktmp=quotient;
					k=ktmp+(n-ktmp*q)/p;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else
				{
					k=n/p;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[j+i*p]);
						j=i+1;
						if(j%p==0)
							printf("\n");
					}
				}
			}
		}

		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
					printf("\n");
			}
		}
		else if(len1!=0&&len2==0)
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
					printf("\n");
			}
		}
		else
		{
			if(p>q)
				temp=q;
			else
				temp=q;
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%temp==0)
					printf("\n");
			}
		}
	}

	else
	{
		k=2;
		printf("%d\n",k);
		for(;i<p;i++)
		{
			printf("%c",str[i]);
			if(i==(p-1))
			printf("\n");
		}
		for(i=0;i<q;i++)
		{
			printf("%c",str[i+2]);
			if(i==(q-1))
			printf("\n");
		}
	}

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int len=0;
	int len1=0;
	int len2=0;
	int k=0;
	int ktmp=0;
	int i=0;
	int j=0;
	int temp=0;
	int remainer=0;
	int quotient=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
		{
			if(p>q)
			{
				remainer=n%p;
				quotient=n/p;
				len1=quotient%q;
				len2=remainer%q;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				//else if((len1==0)&&(len2!=0))
				else
				{
					for(ktmp=0;ktmp<=quotient;ktmp++)
					{
						temp=n-ktmp*p;
						if(temp%q==0)
							break;
					}
					k=ktmp+(n-ktmp*p)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}

				/*else if((len1!=0)&&(len2==0))
				{
					for(ktmp=0;ktmp<=quotient;ktmp++)
					{
						temp=n-ktmp*q;
						if(temp%q==0)
							break;
					}
					k=ktmp+(n-ktmp*q)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else //if((quotient/q)==0)&&(remainer/q)==0))
				{
					k=n/q;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[j+i*q]);
						j=i+1;
						if(j%q==0)
							printf("\n");
					}
				}*/
			}

			else
			{
				remainer=n/q;
				quotient=n%q;
				len1=quotient%p;
				len2=remainer%p;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				//else if((len1==0)&&(len2!=0))
				else
				{
					for(ktmp=0;ktmp<=quotient;ktmp++)
					{
						temp=n-ktmp*p;
						if(temp%q==0)
							break;
					}
					k=ktmp+(n-ktmp*q)/p;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				/*else if((len1!=0)&&(len2==0))
				{
					ktmp=quotient;
					k=ktmp+(n-ktmp*q)/p;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else
				{
					k=n/p;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[i]);
						j=i+1;
						if(j%p==0)
							printf("\n");
					}
				}*/
			}
		}

		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
					printf("\n");
			}
		}
		else if(len1!=0&&len2==0)
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
					printf("\n");
			}
		}
		else
		{
			if(p>q)
				temp=q;
			else
				temp=q;
			k=n/temp;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%temp==0)
					printf("\n");
			}
		}
	}

	else
	{
		k=2;
		printf("%d\n",k);
		if(p>q)
			temp=q;
		else
			temp=q;
		for(;i<temp;i++)
		{
			printf("%c",str[i]);
			if(i==(temp-1))
			printf("\n");
		}
		for(i=temp;i<n;i++)
		{
			printf("%c",str[i]);
			if(i==(n-1))
			printf("\n");
		}
	}

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int max(int a,int b)
{
	int temp=0;
	if(a>b)
		temp=a;
	else
		temp=b;
	return temp;
}

int min(int a,int b)
{
	int temp=0;
	if(a>b)
		temp=b;
	else
		temp=a;
	return temp;
}

int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int k=0;
	int len1=0;
	int len2=0;
	int i=0;
	int j=0;
	int tempmax=0;
	int tempmin=0;
	int temp1=0;
	int temp2=0;
	int flag=0;
	int len=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
		{
			tempmax=max(p,q);
			tempmin=min(p,q);
			for(i=n/tempmax;i>=1;i--)
			{
				temp1=n-tempmax*i;
				if(temp1%tempmin==0)
				{
					flag=1;
					break;
				}
			}
			if(flag==0)
				printf("-1\n");
			else
			{
				temp2=i;
				k=temp2+temp1/tempmin;
				printf("%d\n",k);
				for(i=0;i<temp2;i++)
				{
					for(j=0;j<tempmax;j++)
					{
						printf("%c",str[j+i*tempmax]);
						if(j==(tempmax-1))
							printf("\n");
					}
				}
				for(;i<k;i++)
				{
					for(j=0;j<tempmin;j++)
					{
						printf("%c",str[j+temp2*tempmax+(i-temp2)*tempmin]);
						if(j==(tempmin-1))
							printf("\n");
					}
				}

			}
		}
		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
					printf("\n");
			}
		}
		else if(len1!=0&&len2==0)
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
					printf("\n");
			}
		}
		else
		{
			tempmax=max(p,q);
			k=n/tempmax;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%tempmax==0)
					printf("\n");
			}
		}
	}

	else
	{
		k=2;
		printf("%d\n",k);
		tempmax=max(p,q);
		//tempmin=min(p,q);
		for(;i<tempmax;i++)
		{
			printf("%c",str[i]);
			if(i==(tempmax-1))
			printf("\n");
		}
		for(i=tempmax;i<n;i++)
		{
			printf("%c",str[i]);
			if(i==(n-1))
			printf("\n");
		}
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	char str[101];
	int p=0;
	int q=0;
	int n=0;
	int len=0;
	int len1=0;
	int len2=0;
	int k=0;
	int ktmp=0;
	int i=0;
	int j=0;
	int temp=0;
	int remainer=0;
	int quotient=0;
	scanf("%d%d%d",&n,&p,&q);
	scanf("%s",str);
	len=p+q;
	if(len!=n)
	{
		len1=n%p;
		len2=n%q;
		if(len1!=0&&len2!=0)
		{
			if(p>q)
			{
				remainer=n%p;
				quotient=n/p;
				len1=quotient%q;
				len2=remainer%q;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				else if((len1==0)&&(len2!=0))
				{
					ktmp=remainer;
					k=ktmp+(n-ktmp*p)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else if((len1!=0)&&(len2==0))
				{
					ktmp=quotient;
					k=ktmp+(n-ktmp*p)/q;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+i*p]);
								if(j==(p-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+(i-ktmp)*q+ktmp*p]);
								if(j==(q-1))
									printf("\n");
							}
						}
					}
				}
				else //if((quotient/q)==0)&&(remainer/q)==0))
				{
					k=n/q;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[j+i*q]);
						j=i+1;
						if(j%q==0)
							printf("\n");
					}
				}
			}

			else
			{
				remainer=n/q;
				quotient=n%q;
				len1=quotient%p;
				len2=remainer%p;
				if((len1!=0)&&(len2!=0))
					printf("-1\n");
				else if((len1==0)&&(len2!=0))
				{
					ktmp=remainer;
					k=ktmp+(n-ktmp*q)/p;
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else if((len1!=0)&&(len2==0))
				{
					ktmp=quotient;
					k=ktmp+(n-ktmp*q)/p;
					printf("%d\n",k);
					for(;i<k;i++)
					{
						if(i<ktmp)
						{
							for(j=0;j<q;j++)
							{
								printf("%c",str[j+i*q]);
								if(j==(q-1))
									printf("\n");
							}
						}
						else
						{
							for(j=0;j<p;j++)
							{
								printf("%c",str[j+(i-ktmp)*p+ktmp*q]);
								if(j==(p-1))
									printf("\n");
							}
						}
					}
				}
				else
				{
					k=n/p;
					printf("%d\n",k);
					for(;i<n;i++)
					{
						printf("%c",str[i]);
						j=i+1;
						if(j%p==0)
							printf("\n");
					}
				}
			}
		}

		else if(len1==0&&len2!=0)
		{
			k=n/p;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%p==0)
					printf("\n");
			}
		}
		else if(len1!=0&&len2==0)
		{
			k=n/q;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%q==0)
					printf("\n");
			}
		}
		else
		{
			if(p>q)
				temp=q;
			else
				temp=q;
			k=n/temp;
			printf("%d\n",k);
			for(;i<n;i++)
			{
				printf("%c",str[i]);
				j=i+1;
				if(j%temp==0)
					printf("\n");
			}
		}
	}

	else
	{
		k=2;
		printf("%d\n",k);
		for(;i<p;i++)
		{
			printf("%c",str[i]);
			if(i==(p-1))
			printf("\n");
		}
		for(i=0;i<q;i++)
		{
			printf("%c",str[i+2]);
			if(i==(q-1))
			printf("\n");
		}
	}

	return 0;
}


#include<iostream>
#include<string>
using namespace std;

int main()
{
    string s;
    int n, p, q, count=0;
    string *arr;
    int k = 0, index = 0, temp;

    string s1, s2;

    cin >> n >> p >> q >> s;
    arr = new string[n];
    temp = n;

    while (temp > 0)
    {
        s1 = s.substr(index, p);
        temp -= p;
        if ((temp < q && temp < p && temp !=0) || temp < 0)
        {
            temp += p;
            s1 = s.substr(index, q);
            temp -= q;

            if ((temp < q && temp < p && temp!=0) || temp < 0)
            {
                count = -1;
                break;
            }

            else
            {
                index += q;
                arr[k++] = s1;
                count++;
            }

        }
        else
        {
            index += p;
            arr[k++] = s1;
            count++;
        }
    }

    cout << count << endl;

    for (int i = 0; i < k; i++)
        cout << arr[i] << endl;

    return 0;

}


#include<iostream>
#include<string>
using namespace std;

int main()
{
    string s;
    int n, p, q, count=0;
    string *arr;
    int k = 0, index = 0, temp;

    string s1, s2;

    cin >> n >> p >> q >> s;
    arr = new string[n];
    temp = n;

    while (temp > 0)
    {
        s1 = s.substr(index, p);
        temp -= p;
        if (temp < q && temp  < p && temp > 0)
        {
            temp += p;
            s1 = s.substr(index, q);
            temp -= q;

            if (temp < q && temp < p && temp > 0)
            {
                count = -1;
                break;
            }

            else
            {
                index += q;
                arr[k++] = s1;
                count++;
            }

        }
        else
        {
            index += p;
            arr[k++] = s1;
            count++;
        }
    }

    cout << count << endl;

    for (int i = 0; i < k; i++)
        cout << arr[i] << endl;

    return 0;

}


#include<iostream>
#include<string>
using namespace std;

int main()
{
    string s;
    int n, p, q, count=0;
    int *arr;
    int k = 0, index = 0, temp;

    cin >> n >> p >> q >> s;
    arr = new int[n];
    temp = n;

    while (n % p == 0 && n> 0)
    {
        arr[k++] = p;
        n -= p;
        count++;
    }

    while (n % q == 0 && n>0 )
    {
        arr[k++] = q;
        n -= q;
        count++;
    }

    while ((n - p) >= 0 )
    {
        arr[k++] = p;
        n -= p;
        count++;

        if (n % q == 0)
            break;
    }

    while ((n - q) >= 0)
    {
        arr[k++] = q;
        n -= q;
        count++;

    }

    if (n != 0) count = -1;

    cout << count << endl;

    if (count != -1)
    {
        for (int i = 0; i < k; i++)
        {
            cout << s.substr(index, arr[i]) << endl;
            index += arr[i];

        }

    }

    return 0;

}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <bitset>
using namespace std;

const int maxn = 1e5 + 5;
const int MOD = 998244353;
const long long e[11] = {1,10,100,1000,10000LL,100000LL,1000000LL,10000000LL,100000000LL,1000000000LL,10000000000LL};

unsigned long long tr1(unsigned long long x, int k){
    long long d = 1; while(d <= x)d*=10; d/=10;
    unsigned long long ans = 0;
    while(d > 0){
        ans += x/d;
        if(d != 1)
            ans *= x < e[k] ? 100 : 10;
        x -= (x/d)*d;
        d/=10;
    }
    return ans*10;
}

unsigned long long tr2(unsigned long long x, int k){
    long long d = 1; while(d <= x)d*=10; d/=10;
    unsigned long long ans = 0;k++;
    while(d > 0){
        ans += x/d;
        if(d != 1)
            ans *= x < e[k] ? 100 : 10;
        x -= (x/d)*d;
        d/=10;
    }
    return ans;
}

long long a[maxn];
int b[11];

int main(){
    int n; scanf("%d", &n);
    unsigned long long ans = 0;
    for(int i = 0; i < n; ++i){
        scanf("%I64d", &a[i]);
        for(int j = 10; j >= 0; j--){
            if(a[i] >= e[j]){
                b[j+1]++;
                break;
            }
        }
    }
    for(int i = 0; i < n; ++i){
        for(int k = 1; k < 11; ++k)
            if(b[k] == 0)continue;
            else{
                ans += (tr1(a[i],k)%MOD)*(b[k]%MOD) + (tr2(a[i],k)%MOD)*(b[k]%MOD);
                ans %= MOD;
            }
    }
    cout<<ans;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <bitset>
using namespace std;

const int maxn = 1e5 + 5;
const int MOD = 998244353;

long long tr(long long x){
    long long d = 1; while(d <= x)d*=10; d/=10;
    long long ans = 0;
    while(d > 0){
        ans *= 100;
        ans += x/d;
        x -= (x/d)*d;
        d/=10;
    }
    return ans;
}

int main(){
    int n; scanf("%d", &n);
    long long ans = 0;
    for(int i = 0; i < n; ++i){
        long long x; scanf("%I64d", &x);
        ans += (tr(x)%MOD)*n%MOD + (tr(x)%MOD)*(10*n%MOD);
        ans %= MOD;
    }
    return 0 * printf("%I64d\n", ans);
}


#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<algorithm>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<queue>
using namespace std;
typedef long long ll;
int  n;
const int N=1e5+5;
string aa[N];
const int mod=998244353;
string cb(string a,string b){
	string c="";
	int len=a.size();
	for(int i=len-1;i>=0;i--){
		c+=b[len-i-1];
		c+=a[len-i-1];
		//cout<<" a[["<<a[len-i-1]<<endl;
	}
	//cout<<" c ic "<<c<<endl;
	return c;
}
ll f(string a){
	ll ans=0;
	int len=a.size();
	for(int i=0;i<len;i++){
		ans*=10;
		ans+=a[i]-'0';
	}
	return ans;
}
ll mo(string num){

           int len = num.size();
           ll ans = 0;
           for(int i = 0; i < len; ++i)
           {
               ans = ans*10 + (num[i]-'0');
               ans %= mod;
           }
      return ans;
}
int main(){
	int n;
	while(cin>>n){
		for(int i=1;i<=n;i++){
			cin>>aa[i];
		}
		int ans=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){

				//cout<<cb(aa[i],aa[j])<<endl;
				ans+=mo(cb(aa[i],aa[j]));
				ans%=mod;
			}
		}
		cout<<ans<<endl;

	}
}


#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<algorithm>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<queue>
using namespace std;
typedef long long ll;
int  n;
const int N=1e5+5;
char aa[N][100];
const int mod=998244353;
char c[2*N];
void  cb(char a[],char b[]){
	strcpy(c,"");
	int len=strlen(a);
	int temp=0;
	for(int i=len-1;i>=0;i--){
		c[temp++]=b[len-i-1];
		c[temp++]=a[len-i-1];
		//cout<<" a[["<<a[len-i-1]<<endl;
	}
	//cout<<" c ic "<<c<<endl;

}

ll mo(char num[]){

           int len = strlen(num);
           ll ans = 0;
           for(int i = 0; i < len; ++i)
           {
               ans = ans*10 + (num[i]-'0');
               ans %= mod;
           }
      return ans;
}
int main(){
	int n;
	while(cin>>n){
		for(int i=1;i<=n;i++){
			scanf("%s",aa[i]);
		}
		int ans=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){

				//cout<<cb(aa[i],aa[j])<<endl;

				cb(aa[i],aa[j]);
				//cout<<"c is "<<c<<endl;
				ans+=mo(c);
				ans%=mod;
			}
		}
		cout<<ans<<endl;

	}
}


#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<algorithm>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<queue>
using namespace std;
typedef long long ll;
int  n;
const int N=1e5+5;
char aa[N][100];
const int mod=998244353;
char c[2*N];

inline ll mo1(char num[]){

           int len = strlen(num);
           ll ans = 0;
           for(int i = 0; i < len; ++i)
           {
               ans = ans*100 + (num[i]-'0');
               ans %= mod;
           }
      return ans;
}
inline ll mo2(char num[]){

           int len = strlen(num);
		    ll ans=0;
           //cout<<"this num is"<<num<<endl;
           for(int i = 0; i < len; ++i)
           {
               ans = ans*100 + (num[i]-'0')*10;

               ans %= mod;
           }
      return ans;
}
int main(){
	int n;
	while(cin>>n){
		ll ans=0;
		for(int i=1;i<=n;i++){
			scanf("%s",aa[i]);
			ans+=((mo1(aa[i])%mod)*(n%mod))%mod;
			ans%=mod;
			ans+=((mo2(aa[i])%mod)*(n%mod))%mod;
			ans%=mod;
		}

		cout<<ans<<endl;

	}
}


#include<bits/stdc++.h>
#define LL long long

using namespace std;
const int maxn=1e5+100;
const LL mod=998244353;
LL a[maxn];
stack<LL>st;
LL qpow(LL x,LL y)
{
    LL sum=1;
    while(y)
    {
        if(y&1) sum=sum*x%mod;
        x=x*x%mod;
        y>>=1;

    }
    return sum;
}
int main()
{
    LL n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    LL ans=0;
    for(int i=1;i<=n;i++)
    {
        LL v=a[i];
        while(v)
        {
            st.push(v%10);
            v/=10;
        }
        LL cnt=st.size();
        cnt*=2;
        //cout<<cnt<<endl;
        while(!st.empty())
        {
            LL gg=st.top();
            st.pop();
            //cout<<gg<<" "<<cnt<<endl;
            ans=(ans+((qpow(10,cnt-1)*gg)%mod*(n)%mod))%mod;
            cnt--;
            ans=(ans+((qpow(10,cnt-1)*gg)%mod*(n)%mod))%mod;
            cnt--;
        }
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
using namespace std;

const int maxn=1e5+100;
const LL mod=998244353;
LL a[maxn];
stack<LL>st;
vector<LL>mp[20];
vector<LL>last;
LL qpow(LL x,LL y)
{
    LL sum=1;
    while(y)
    {
        if(y&1) sum=sum*x%mod;
        x=x*x%mod;
        y>>=1;
    }
    return sum;
}
void get_fen(LL v)
{
    while(v)
    {
        st.push(v%10);
        v/=10;
    }
    return ;
}
int main()
{
    LL n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
    {
        LL v=a[i];
        int cnt=0;
        //cout<<v<<endl;
        while(v)
        {
            v/=10;
            cnt++;
        }
        mp[cnt].push_back(a[i]);
    }
    LL pp=0;
    LL ans=0;
    for(int i=1;i<=10;i++)
    {
        if(mp[i].size()==0)
        {
            continue;
        }
        for(int j=0;j<mp[i].size();j++)
        {
            LL v=mp[i][j];
            //cout<<v<<" "<<st.size()<<endl;
            get_fen(v);
            LL hh=st.size();
            hh*=2;
            while(!st.empty())
            {
                LL gg=st.top();
                //cout<<gg<<" "<<mp[i][j]<<" "<<hh<<" "<<(n-pp)<<endl;
                st.pop();
                ans=(ans+((qpow(10,hh-1)*gg%mod)*(n-pp)%mod))%mod;
                hh--;
                ans=(ans+((qpow(10,hh-1)*gg%mod)*(n-pp)%mod))%mod;
                hh--;
            }
        }
        //cout<<ans<<endl;
        for(int j=0;j<mp[i].size();j++)
        {
            last.clear();
            LL v=mp[i][j];
            get_fen(v);
            for(int k=i-1;k>0;k--)
            {

                LL sz=mp[k].size();
                while(st.size()>k)
                {
                    LL gg=st.top();
                    last.push_back(gg);
                    st.pop();
                }
                LL hh=2*k;

                //cout<<sz<<" "<<k<<" "<<mp[i][j]<<" "<<"dx666"<<endl;
                while(!st.empty())
                {
                    LL gg=st.top();
                    last.push_back(gg);
                    //cout<<gg<<" "<<mp[i][j]<<" "<<hh<<" "<<sz<<" "<<"dx666"<<endl;
                    st.pop();
                    ans=(ans+((qpow(10,hh-1)*gg%mod)*(sz)%mod))%mod;
                    hh--;
                    ans=(ans+((qpow(10,hh-1)*gg%mod)*(sz)%mod))%mod;
                    hh--;
                }
            }
            while(!st.empty())
            {
                LL gg=st.top();
                last.push_back(gg);
                st.pop();
            }
            for(int k=1;k<i;k++)
            {
                if(mp[k].size()==0)
                {
                    continue;
                }
                LL hh=i+k;
                LL sz=mp[k].size();
                for(int l=0;l<i-k;l++)
                {
                    hh-=l;
                    //cout<<hh<<" "<<last[l]<<" "<<i<<" "<<k<<endl;
                    ans=(ans+((qpow(10,hh-1)*last[l]%mod)*(sz)%mod*2LL%mod))%mod;
                }
            }

        }
        //cout<<ans<<endl;
        pp+=mp[i].size();
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
using namespace std;

const int maxn=1e5+100;
const LL mod=998244353;
LL a[maxn];
stack<LL>st;
vector<LL>mp[20];
vector<LL>last;
LL qpow(LL x,LL y)
{
    LL sum=1;
    while(y)
    {
        if(y&1) sum=sum*x%mod;
        x=x*x%mod;
        y>>=1;
    }
    return sum;
}
void get_fen(LL v)
{
    while(v)
    {
        st.push(v%10);
        v/=10;
    }
    return ;
}
int main()
{
    LL n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
    {
        LL v=a[i];
        int cnt=0;
        //cout<<v<<endl;
        while(v)
        {
            v/=10;
            cnt++;
        }
        mp[cnt].push_back(a[i]);
    }
    LL pp=0;
    LL ans=0;
    for(int i=1;i<=10;i++)
    {
        if(mp[i].size()==0)
        {
            continue;
        }
        for(int j=0;j<mp[i].size();j++)
        {
            LL v=mp[i][j];
            //cout<<v<<" "<<st.size()<<endl;
            get_fen(v);
            LL hh=st.size();
            hh*=2;
            while(!st.empty())
            {
                LL gg=st.top();
                //cout<<gg<<" "<<mp[i][j]<<" "<<hh<<" "<<(n-pp)<<endl;
                st.pop();
                ans=(ans+((qpow(10,hh-1)*gg%mod)*(n-pp)%mod))%mod;
                hh--;
                ans=(ans+((qpow(10,hh-1)*gg%mod)*(n-pp)%mod))%mod;
                hh--;
            }
        }
        //cout<<ans<<endl;
        for(int j=0;j<mp[i].size();j++)
        {
            last.clear();
            LL v=mp[i][j];
            get_fen(v);
            for(int k=i-1;k>0;k--)
            {

                LL sz=mp[k].size();
                while(st.size()>k)
                {
                    LL gg=st.top();
                    last.push_back(gg);
                    st.pop();
                }
                LL hh=2*k;

                //cout<<sz<<" "<<k<<" "<<mp[i][j]<<" "<<"dx666"<<endl;
                while(!st.empty())
                {
                    LL gg=st.top();
                    last.push_back(gg);
                    //cout<<gg<<" "<<mp[i][j]<<" "<<hh<<" "<<sz<<" "<<"dx666"<<endl;
                    st.pop();
                    ans=(ans+((qpow(10,hh-1)*gg%mod)*(sz)%mod))%mod;
                    hh--;
                    ans=(ans+((qpow(10,hh-1)*gg%mod)*(sz)%mod))%mod;
                    hh--;
                }
            }
            while(!st.empty())
            {
                st.pop();
            }
            for(int k=1;k<i;k++)
            {
                if(mp[k].size()==0)
                {
                    continue;
                }
                LL hh=i+k;
                LL sz=mp[k].size();
                for(int l=0;l<i-k;l++)
                {
                    hh-=l;
                    //cout<<hh<<" "<<last[l]<<" "<<i<<" "<<k<<endl;
                    ans=(ans+((qpow(10,hh-1)*last[l]%mod)*(sz)%mod*2LL%mod))%mod;
                }
            }

        }
        //cout<<ans<<endl;
        pp+=mp[i].size();
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for(int i = (a);i < (b);++i)
#define dep(i,a,b) for(int i = (a);i > (b);--i)
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define lowbit(x) (x&-x)
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define MAXN 100010
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int mod = 998244353;
inline ll read(){
	int r=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){r=r*10+ch-'0';ch=getchar();}
	return r*f;
}
void print(ll x){
	if(x<0){putchar('-');x=-x;}
	if(x>9)print(x/10);
	putchar(x%10+'0');
}
string str[100010];
ll tot;
int a[11];
int b[11];
int main(){
	ios::sync_with_stdio(false);
	int n=read();
	rep(i,1,n+1)cin>>str[i];
	int len=str[1].size();
	ll ans=0;
	rep(i,1,n+1){
		ll k=1;
		dep(j,len-1,-1){
			ans=(ans+n*(str[i][j]-'0')%mod*k*11)%mod;
			k=k*100%mod;
		}
	}
	print(ans);
	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for(int i = (a);i < (b);++i)
#define dep(i,a,b) for(int i = (a);i > (b);--i)
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define lowbit(x) (x&-x)
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define MAXN 100010
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int mod = 998244353;
inline ll read(){
	int r=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){r=r*10+ch-'0';ch=getchar();}
	return r*f;
}
void print(ll x){
	if(x<0){putchar('-');x=-x;}
	if(x>9)print(x/10);
	putchar(x%10+'0');
}
string str[100010];
ll tot;
int a[11];
int b[11];
int main(){
	ios::sync_with_stdio(false);
	int n=read();
	rep(i,1,n+1)cin>>str[i];
	int len=str[1].size();
	ll ans=0;
	rep(i,1,n+1){
		int k=1;
		dep(j,len-1,-1){
			ans=(ans+n*(str[i][j]-'0')*k*11)%mod;
			k*=100;
		}
	}
	print(ans);
	return 0;
}


#include<bits/stdc++.h>
#define rep(i,a,b) for(int i = (a);i < (b);++i)
#define dep(i,a,b) for(int i = (a);i > (b);--i)
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define lowbit(x) (x&-x)
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define MAXN 100010
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int mod = 998244353;
inline ll read(){
	int r=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){r=r*10+ch-'0';ch=getchar();}
	return r*f;
}
void print(ll x){
	if(x<0){putchar('-');x=-x;}
	if(x>9)print(x/10);
	putchar(x%10+'0');
}
string str[100010];
ll tot;
int a[11];
int b[11];
int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	rep(i,1,n+1)cin>>str[i];
	int len=str[1].size();
	ll ans=0;
	rep(i,1,n+1){
		ll k=1;
		dep(j,len-1,-1){
			ans=(ans+n*(str[i][j]-'0')%mod*k*11)%mod;
			k=k*100%mod;
		}
	}
	cout<<ans;
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
typedef long long LL;
const int N = int(1e5) + 10;
const int mod = 998244353;
string a[N];
int main(){
    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    LL ans=0;
    LL t=11;
    for(int i=a[1].size()-1;i>=0;i--){
        LL tmp=0;
        for(int j=1;j<=n;j++){
            tmp+=a[j][i]-'0';
        }
        tmp=tmp*n%mod;
        tmp=tmp*t%mod;
        ans=(ans+tmp)%mod;
        t=(t*100)%mod;
    }
    cout<<ans%mod<<endl;
}


#include <iostream>
#include <cmath>
using namespace std;
typedef long long LL;
const int N = int(1e5) + 10;
const int mod = 998244353;
string a[N];
int main(){
    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    LL ans=0;
    LL t=11;
    for(int i=a[1].size()-1;i>=0;i--){
        LL tmp=0;
        for(int j=1;j<=n;j++){
            tmp+=a[j][i]-'0';
        }
        ans=(ans%mod+(n*t*tmp)%mod)%mod;
        t=(t*100)%mod;
    }
    cout<<ans%mod<<endl;
}


#include <iostream>
#include <cmath>
using namespace std;
typedef long long LL;
const int N = int(1e5) + 10;
const int mod = 998244353;
string a[N];
int main(){
    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    LL ans=0;LL t=11;
    for(int i=a[1].size()-1;i>=0;i--){
        int tmp=0;
        for(int j=1;j<=n;j++){
            tmp+=a[j][i]-'0';
        }
        ans=(ans+n*t*tmp)%mod;
        t=t*100%mod;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define N 500500
#define mod 998244353
using namespace std;
int w,s[N];
int POWER(int m)
{
	int s=1,t=10;
	while(m)
	{
		if(m%2)
		s=s*t;
		t=t*t;
		m=m/2;
	}
	return s;
}
int jiwei(int m)
{
    int cnt=0;
	while(m!=0)
	{
		cnt++;
		m/=10;
	}
	return cnt;
}
int Get(int m,int n)
{
	int ans=0;
	for(int i=1;i<=w;i++)
	{
		int a=s[m]/POWER(w-i)%10;
		int b=s[n]/POWER(w-i)%10;
		ans=(ans*10%mod+b%mod)%mod;
		ans=(ans*10%mod+a%mod)%mod;

	}
	return ans;
}

int main()
{
	int u;
	scanf("%d",&u);
	for(int i=1;i<=u;i++)
	{
		scanf("%d",&s[i]);
		w=jiwei(s[i]);
	}

	int tot=0;
	for(int i=1;i<=u;i++)
	    for(int j=1;j<=u;j++)
	    {
	    	int q=Get(i,j);
	    	tot=(tot%mod+q%mod)%mod;
		}
	printf("%d",tot);
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MXN = 100005;
int N, L;
int ans;
char a[11][MXN];
int len[MXN];
int pt;
const long long MD = 998244353;
int Get(int m, int n)
{
	ll res;
	int ans = 0;
	int tot = 0;
	for (int i = 1; i <= L; i++)
	{
		res = a[i][m];
		while (1)
		{
			if (tot >= 2 * (L - i) + 1)
			{
				tot = 0;
				break;
			}
			res *= 10;
			tot++;
		}
		ans += res % MD;
		ans %= MD;
	}
	tot = 0;
	for (int i = 1; i <= L; i++)
	{
		res = a[i][n];
		while (1)
		{
			if (tot >= 2 * (L - i))
			{
				tot = 0; break;
			}
			res *= 10;
			tot++;
		}
		ans += res % MD;
		ans %= MD;
	}
	return ans;
}
void Solve()
{
	cin >> N;
	char k = 1;
	k = getchar();
	bool s = true;
	for (int aa = 1; aa <= N; aa++)
	{
		while (k != '\n'||s)
		{
			k = getchar();
			s = 0;
			if (k == ' ')break;
			if (k >= '0' && k <= '9')
				a[++pt][aa] = k - '0';
		}
		pt = 0;
	}
	for (int i = 1;; i++)
	{
		if (!a[i][1])
		{
			L = i - 1;
			break;
		}
	}
	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= N; j++)
		{
			ans += Get(i, j);
		}
	}
	cout << ans;
}
int main()
{
	Solve();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const ull MD=998244353;
string s;
int N;
ull ans;
ull a[100050];
ull tonum(string s)
{
	reverse(s.begin(),s.end());
	ull num=0;
	for(int i=0;i<s.size();i++)
	{
		num*=10;
		num+=s[i]-'0';
	}
	return num;
}
string g1t(ull a)
{
	string k="";
	while(a)
	{
		k+=(a%10)+'0';
		k+='0';
		a/=10;
	}
	return k;
}
string g2t(ull a)
{
	string k="";
	while(a)
	{
		k+=(a%10)+'0';
		k+='0';
		a/=10;
	}
	return k.substr(0,k.size()-1);
}
void Solve()
{
	freopen("a.exe","r",stdin);
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=N;i++)
	{
		ans+=(tonum(g1t(a[i]))*10)%MD*N;
		ans%=MD;
		ans+=(tonum(g2t(a[i])))%MD*N;
		ans%=MD;
	}
	cout<<ans;
}
int main()
{
	Solve();
	return 0;
}


#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
const ll mod=998244353;
ll a[500000];
ll w;
ll POWER(int m)
{
	ll s=1,t=10;
	while(m)
	{
		if(m%2)
		s=s*t;
		t=t*t;
		m=m/2;
	}
	return s;
}
ll jiwei(ll m)
{
    ll cnt=0;
	while(m!=0)
	{
		cnt++;
		m/=10;
	}
	return cnt;
}
ll Get(ll m)
{
	ll ans=0;
	for(ll i=1;i<=w;i++)
	{
		ll b=a[m]/POWER(w-i)%10;
		ans=(ans*10%mod+b%mod)%mod;
		ans=ans*10+b;

	}
	return ans%mod;
}
int main()
{
	ll n;
	ll tot=0;
	scanf("%lld",&n);
	scanf("%lld",&a[1]);
	w=jiwei(a[1]);
	for(ll i=2;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}

	for(ll i=1;i<=n;i++)
	{
		tot=(tot+n*Get(i)%mod)%mod;
	}

	printf("%lld",tot);
	return 0;
}


#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
const int Mod=998244353;
long long int calf(string a){
    long long int ans=0;
    for(int i=0;i<a.length();i++){
        ans=(100*ans+11*(a[i]-'0'))%Mod;
    }
    return ans;
}
int main(){
	long long int n,ans=0;
	string a;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		ans=(ans+calf(a))%Mod;
	}
	cout<<(n*ans)%Mod<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long cxk;
cxk a[100005];
const cxk mod=998244353;
cxk ppp(cxk o)
{
	cxk m=0;
	cxk tot=0;
	while(o)
	{
		cxk x=o%10;
		cxk t=(cxk)pow(10,m)%mod;
		tot+=x*11*t%mod;
		m+=2;
		o=o/10;
	}
	return tot;
}
int main()
{
	cxk ans=0;
	cxk cnt=0;
	cxk n;
	cin>>n;
	for(cxk i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	cxk q=a[1];
	while(q!=0)
	{
		q=q/10;
		cnt++;
	}
	for(cxk i=1;i<=n;i++)
	{
		cxk x=ppp(a[i]);
		ans=(ans+x)%mod;
	}
	ans=(ans*n)%mod;
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int mod=998244353;
typedef long long ll;
int n,m,k,l,s,t,r;
int a[maxn];
int len[maxn];
int has[maxn];
ll ans;
int cal(int x,int y)
{
	vector<int>p;
	for(int i=1;i<=10;i++)
		p.push_back(x%10),x/=10;
	vector<int>q;
	for(int i=0;i<10;i++)
		{
			if(y)
				q.push_back(0),y--;
			q.push_back(p[i]);
		}
	ll o=0;
	for(int i=q.size()-1;i>=0;i--)
		o=o*10ll+q[i];
	return o%mod;
}

int cal_2(int x,int y)
{
	vector<int>p;
	for(int i=1;i<=10;i++)
		p.push_back(x%10),x/=10;
	vector<int>q;
	for(int i=0;i<10;i++)
		{
			q.push_back(p[i]);
			if(y)
				q.push_back(0),y--;
		}
	ll o=0;
	for(int i=q.size()-1;i>=0;i--)
		o=o*10+q[i];
	return o%mod;
}

int get_len(int x)
{
	int p=0;
	while(x)
	{
		x/=10;
		p++;
	}
	return p;
}

int main()
{
//	freopen("in.txt","r",stdin);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		len[i]=get_len(a[i]),has[len[i]]++;
//	cout<<has[0]<<" "<<has[1]<<" "<<has[2]<<endl;
//	cout<<cal(12,2)<<endl;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=10;j++)
			ans+=(cal(a[i],j)*(ll)has[j])%mod,ans%=mod;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=10;j++)
			ans+=(cal_2(a[i],j)*(ll)has[j])%mod,ans%=mod;
	}
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int mod=998244353;
typedef long long ll;
int n,m,k,l,s,t,r;
int a[maxn];
int len[maxn];
int has[maxn];
vector<int>p[maxn];

ll ans;
int cal(int x,int y)
{
	ll o=0;
	ll now=1;
	for(int i=0;i<10;i++)
		{
			if(y)
				now*=10,now%=mod,y--;
			o=(o+p[x][i]*now)%mod;
			now*=10,now%=mod;
		}
	return o%mod;
}

int cal_2(int x,int y)
{
	ll o=0;
	ll now=1;
		for(int i=0;i<10;i++)
		{

			o=(o+p[x][i]*now)%mod;
				now*=10,now%=mod;
			if(y)
				now*=10,now%=mod,y--;
		}
	return o%mod;
}

int get_len(int x)
{
	int p=0;
	while(x)
	{
		x/=10;
		p++;
	}
	return p;
}

int main()
{
//	freopen("in.txt","r",stdin);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		len[i]=get_len(a[i]),has[len[i]]++;

	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=10;j++)
			p[i].push_back(a[i]%10),a[i]/=10;
	}

	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=10;j++)
			ans+=(cal(i,j)*(ll)has[j])%mod,ans%=mod;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=10;j++)
			ans+=(cal_2(i,j)*(ll)has[j])%mod,ans%=mod;
	}
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int mod=998244353;
typedef long long ll;
int n,m,k,l,s,t,r;
int a[maxn];
int len[maxn];
int has[maxn];
ll ans;
int cal(int x,int y)
{
	vector<int>p;
	for(int i=1;i<=10;i++)
		p.push_back(x%10),x/=10;
	vector<int>q;
	for(int i=0;i<10;i++)
		{
			if(y)
				q.push_back(0),y--;
			q.push_back(p[i]);
		}
	ll o=0;
	for(int i=q.size()-1;i>=0;i--)
		o=(o*10ll+q[i])%mod;
	return o%mod;
}

int cal_2(int x,int y)
{
	vector<int>p;
	for(int i=1;i<=10;i++)
		p.push_back(x%10),x/=10;
	vector<int>q;
	for(int i=0;i<10;i++)
		{
			q.push_back(p[i]);
			if(y)
				q.push_back(0),y--;
		}
	ll o=0;
	for(int i=q.size()-1;i>=0;i--)
		o=(o*10+q[i])%mod;
	return o%mod;
}

int get_len(int x)
{
	int p=0;
	while(x)
	{
		x/=10;
		p++;
	}
	return p;
}

int main()
{
//	freopen("in.txt","r",stdin);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		len[i]=get_len(a[i]),has[len[i]]++;
//	cout<<has[0]<<" "<<has[1]<<" "<<has[2]<<endl;
//	cout<<cal(12,2)<<endl;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=10;j++)
			ans+=(cal(a[i],j)*(ll)has[j])%mod,ans%=mod;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=10;j++)
			ans+=(cal_2(a[i],j)*(ll)has[j])%mod,ans%=mod;
	}
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const long long int mod = 998244353;

int main()
{
    int n ;
    cin>>n;
    vector<vector<long long int>>digit(n);
    long long int val;
    for(int i=0;i<n;i++)
    {
        cin>>val;
        while(val!=0)
        {
            digit[i].push_back(val%10);
            val=val/10;
        }
    }
    vector<int>arr(digit[0].size());
    for(int i=0;i<arr.size();i++)
    {
        long long int sum =0 ;
        for(int j=0;j<n;j++)
            sum+=digit[j][i];
        sum = sum*n;
        arr[i]=sum%mod;
    }
    long long int ans=0 , idx=1;
    for(int i=0;i<arr.size();i++)
    {
        ans = (ans+(arr[i]*idx)%mod)%mod;
        idx=(idx*10)%mod;
        ans = (ans+(arr[i]*idx)%mod)%mod;
        idx=(idx*10)%mod;
    }
    cout<<ans%mod;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const long long int mod = 998244353;

int main()
{
    int n ;
    cin>>n;
    vector<vector<long long int>>digit(n);
    long long int val;
    for(int i=0;i<n;i++)
    {
        cin>>val;
        while(val!=0)
        {
            digit[i].push_back(val%10);
            val=val/10;
        }
    }
    vector<int>arr(digit[0].size());
    for(int i=0;i<arr.size();i++)
    {
        long long int sum =0 ;
        for(int j=0;j<n;j++)
            sum+=digit[j][i];
        sum = sum*n;
        arr[i]=sum;
    }
    long long int ans=0 , idx=1;
    for(int i=0;i<arr.size();i++)
    {
        ans = (ans+(arr[i]*idx)%mod)%mod;
        idx=(idx*10)%mod;
        ans = (ans+(arr[i]*idx)%mod)%mod;
        idx=(idx*10)%mod;
    }
    cout<<ans%mod;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const long long int mod = 998244353;

int main()
{
    int n ;
    cin>>n;
    vector<vector<long long int>>digit(n);
    long long int val;
    for(int i=0;i<n;i++)
    {
        cin>>val;
        while(val!=0)
        {
            digit[i].push_back(val%10);
            val=val/10;
        }
    }
    vector<int>arr(digit[0].size());
    for(int i=0;i<arr.size();i++)
    {
        long long int sum =0 ;
        for(int j=0;j<n;j++)
            sum+=digit[j][i];
        sum = sum*n;
        arr[i]=sum;
    }
    long long int ans=0 , idx=1;
    for(int i=0;i<arr.size();i++)
    {
        ans = (ans+(arr[i]*idx))%mod;
        idx=(idx*10)%mod;
        ans = (ans+(arr[i]*idx))%mod;
        idx=(idx*10)%mod;
    }
    cout<<ans%mod;
    return 0;
}


//lsroi
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
#define maxn 100005
#define Mod 998244353ll
using namespace std;
ll a[maxn],b[maxn][20],co[maxn],c[19];
int main()
{
	c[0]=1ll;
	for(int i=1;i<=18;i++)c[i]=c[i-1]*10ll;
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%I64d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
	  ll t=a[i];  co[i]=0;
	  while(t){
	    b[i][++co[i]]=t%10;
	    t/=10;
	  }
	}

	ll ans=0;
	for(int i=1;i<=n;i++)
	{
	  ll l=1,r=0;
	  while(l<=n){
	    r=upper_bound(co+l,co+n+1,co[l])-co-1;
		if(co[i]<=co[l]){
		  for(int j=1;j<=co[i];j++){
		    ans+=c[j-1<<1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
		else {
		  for(int j=1;j<=co[l];j++){
		    ans+=c[j-1<<1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		  for(int j=co[l]+1;j<=co[i];j++)
		  {
		    ans+=c[(co[l]-1<<1|1)+j-co[l]]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
	    l=r+1;
	  }
	}
	for(int i=1;i<=n;i++)
	{
	  ll l=1,r=0;
	  while(l<=n){
	    r=upper_bound(co+l,co+n+1,co[l])-co-1;
		if(co[i]<=co[l]){
		  for(int j=1;j<=co[i];j++){
		    ans+=c[j-1<<1|1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
		else {
		  for(int j=1;j<=co[l];j++){
		    ans+=c[j-1<<1|1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		  for(int j=co[l]+1;j<=co[i];j++)
		  {
		    ans+=c[(co[l]-1<<1|1)+j-co[l]]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
	    l=r+1;
	  }
	}

	printf("%I64d\n",ans%Mod);
	return 0;
}


//lsroi
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
#define maxn 100005
#define Mod 998244353ll
using namespace std;
ll a[maxn],b[maxn][20],co[maxn],c[19];
int main()
{
	c[0]=1ll;
	for(int i=1;i<=18;i++)c[i]=c[i-1]*10ll;
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%I64d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
	  ll t=a[i];  co[i]=0;
	  while(t){
	    b[i][++co[i]]=t%10;
	    t/=10;
	  }
	}

	ll ans=0;
	for(int i=1;i<=n;i++)
	{
	  ll l=1,r=0;
	  while(l<=n){
	    r=upper_bound(co+l,co+n+1,co[l])-co-1;
		if(co[i]<=co[l]){
		  for(int j=1;j<=co[i];j++){
		    ans+=c[j-1<<1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
		else {
		  for(int j=1;j<=co[l];j++){
		    ans+=c[j-1<<1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		  for(int j=co[l]+1;j<=co[i];j++)
		  {
		    ans+=c[(co[l]-1<<1|1)+j-co[l]]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
	    l=r+1;
	  }
	}

	printf("%I64d\n",ans*11ll%Mod);
	return 0;
}


//lsroi
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ull unsigned long long
#define maxn 100005
#define Mod 998244353ll
using namespace std;
ull a[maxn],b[maxn][20],co[maxn],c[20];
int main()
{
	c[0]=1ll;
	for(int i=1;i<=19;i++)c[i]=c[i-1]*10ll;
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%I64d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
	  ull t=a[i];  co[i]=0;
	  while(t){
	    b[i][++co[i]]=t%10;
	    t/=10;
	  }
	}

	ull ans=0;
	for(int i=1;i<=n;i++)
	{
	  ull l=1,r=0;
	  while(l<=n){
	    r=upper_bound(co+l,co+n+1,co[l])-co-1;
		if(co[i]<=co[l]){
		  for(int j=1;j<=co[i];j++){
		    ans+=c[j-1<<1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
		else {
		  for(int j=1;j<=co[l];j++){
		    ans+=c[j-1<<1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		  for(int j=co[l]+1;j<=co[i];j++)
		  {
		    ans+=c[(co[l]-1<<1|1)+j-co[l]]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
	    l=r+1;
	  }
	}
	for(int i=1;i<=n;i++)
	{
	  ull l=1,r=0;
	  while(l<=n){
	    r=upper_bound(co+l,co+n+1,co[l])-co-1;
		if(co[i]<=co[l]){
		  for(int j=1;j<=co[i];j++){
		    ans+=c[j-1<<1|1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
		else {
		  for(int j=1;j<=co[l];j++){
		    ans+=c[j-1<<1|1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		  for(int j=co[l]+1;j<=co[i];j++)
		  {
		    ans+=c[(co[l]-1<<1|1)+j-co[l]]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
	    l=r+1;
	  }
	}

	printf("%I64d\n",ans%Mod);
	return 0;
}


//lsroi
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
#define maxn 100005
#define Mod 998244353ll
using namespace std;
ll a[maxn],b[maxn][20],co[maxn];
ll c[19]={1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17,1e18};
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%I64d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
	  ll t=a[i];  co[i]=0;
	  while(t){
	    b[i][++co[i]]=t%10;
	    t/=10;
	  }
	}

	ll ans=0;
	for(int i=1;i<=n;i++)
	{
	  ll l=1,r=0;
	  while(l<=n){
	    r=upper_bound(co+l,co+n+1,co[l])-co-1;
		if(co[i]<=co[l]){
		  for(int j=1;j<=co[i];j++){
		    ans+=c[j-1<<1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
		else {
		  for(int j=1;j<=co[l];j++){
		    ans+=c[j-1<<1]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		  for(int j=co[l]+1;j<=co[i];j++)
		  {
		    ans+=c[(co[l]-1<<1|1)+j-co[l]]*b[i][j]%Mod*(r-l+1)%Mod;
		    if(ans>=Mod)ans-=Mod;
		  }
		}
	    l=r+1;
	  }
	}

	printf("%I64d\n",ans*11ll%Mod);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string str(long long int x)
{
	string s;
	while(x)
	{
		int p=x%10;
		s+=p+'0';
		x/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
long long int integer(string s)
{
	int  n=s.length();
	long long int x=0;
	for(int i=0;i<n;i++)
	{
		int t=s[i]-'0';
		x*=10;
		x+=t;
	}
	return x;
}
long long int con1(long long int x)
{
	string s=str(x);
	int n=s.length();
	string ans;
	for(int i=0;i<n;i++)
	{
		ans+='0';
		ans+=s[i];
	}
	x=integer(ans);
	return x;
}
long long int con2(long long int x)
{
	string s=str(x);
	int n=s.length();
	string ans;
	for(int i=0;i<n;i++)
	{
		ans+=s[i];
		ans+='0';
	}
	x=integer(ans);
	return x;
}
int main()
{
	int n;
	cin>>n;
	long long int a[n];
	long long int m=998244353 ;
	long long int sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		long long int x=a[i];
		long long int p=con1(x)%m;
		long long int q=con2(x)%m;
//		cout<<x<<" "<<p<<" "<<q<<endl;
		sum=sum%m+p;
		sum=sum%m;
		sum=sum%m+q;
		sum=sum%m;
	}
	long long int sum1=sum;
	sum=0;
//	cout<<sum1<<" ";
	for(int i=0;i<n;i++)
	{
		sum=sum%m+sum1%m;
		sum=sum%m;
	}
	cout<<sum;
}


#include<bits/stdc++.h>
using namespace std;
long long int m=998244353 ;
string str(long long int x)
{
	string s;
	while(x)
	{
		int p=x%10;
		s+=p+'0';
		x/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
long long int integer(string s)
{
	int  n=s.length();
	long long int x=0;
	for(int i=0;i<n;i++)
	{
		int t=s[i]-'0';
		x=x%m*10+t;
		x=x%m;
//		x+=t;
	}
	return x;
}
long long int con1(long long int x)
{
	string s=str(x);
	int n=s.length();
// 	cout<<n<<" ";
	string ans;
	for(int i=0;i<n;i++)
	{
		ans+='0';
		ans+=s[i];
	}
	x=integer(ans);
	return x;
}
long long int con2(long long int x)
{
	string s=str(x);
	int n=s.length();
// 	cout<<n<<" ";
	string ans;
	for(int i=0;i<n;i++)
	{
		ans+=s[i];
		ans+='0';
	}
	x=integer(ans);
	return x;
}
int main()
{
	int n;
	cin>>n;
	long long int a[n];
//	long long int m=998244353 ;
	long long int sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		long long int x=a[i];
		long long int p=con1(x)%m;
		long long int q=con2(x)%m;
//		cout<<x<<" "<<p<<" "<<q<<endl;
		sum=sum%m+p;
		sum=sum%m;
		sum=sum%m+q;
		sum=sum%m;
	}
	long long int sum1=sum;
	sum=0;
//	cout<<sum1<<" ";
	for(int i=0;i<n;i++)
	{
		sum=sum%m+sum1%m;
		sum=sum%m;
	}
	cout<<sum;
}


#include<bits/stdc++.h>
using namespace std;
long long int m=998244353 ;
string str(long long int x)
{
	string s;
	while(x)
	{
		int p=x%10;
		s+=p+'0';
		x/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
long long int integer(string s)
{
	int  n=s.length();
	long long int x=0;
	for(int i=0;i<n;i++)
	{
		int t=s[i]-'0';
		x=x%m*10+t;
		x=x%m;
//		x+=t;
	}
	return x;
}
long long int con1(long long int x)
{
	string s=str(x);
	int n=s.length();
	cout<<n<<" ";
	string ans;
	for(int i=0;i<n;i++)
	{
		ans+='0';
		ans+=s[i];
	}
	x=integer(ans);
	return x;
}
long long int con2(long long int x)
{
	string s=str(x);
	int n=s.length();
	cout<<n<<" ";
	string ans;
	for(int i=0;i<n;i++)
	{
		ans+=s[i];
		ans+='0';
	}
	x=integer(ans);
	return x;
}
int main()
{
	int n;
	cin>>n;
	long long int a[n];
//	long long int m=998244353 ;
	long long int sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		long long int x=a[i];
		long long int p=con1(x)%m;
		long long int q=con2(x)%m;
//		cout<<x<<" "<<p<<" "<<q<<endl;
		sum=sum%m+p;
		sum=sum%m;
		sum=sum%m+q;
		sum=sum%m;
	}
	long long int sum1=sum;
	sum=0;
//	cout<<sum1<<" ";
	for(int i=0;i<n;i++)
	{
		sum=sum%m+sum1%m;
		sum=sum%m;
	}
	cout<<sum;
}


#include <iostream>
#include <cstring>
using namespace std;
const int MAXN=100000+100;
int num[MAXN];
int   mark[40];
int main()
{
    int  n;
    while(cin>>n)
    {
        memset(mark,0,sizeof(mark));
        for(int i=0;i<n;i++)
        {
            cin>>num[i];
            int temp=num[i];
            int len=0;
            while(temp)
            {
                int x=temp%10;
                mark[len]=mark[len]+x*n;
                mark[len+1]=mark[len];
                temp/=10;
                len+=2;
            }
        }
        int ans=0;
        for(int i=40;i>=0;i--)
        {
            ans*=10;
            ans+=mark[i];
            ans%=998244353;
        }
        cout<<ans<<"\n";
    }
    return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
const int MAXN=100000+100;
long long  num[MAXN];
long long   mark[100];
int main()
{
    int  n;
    while(cin>>n)
    {
        memset(mark,0,sizeof(mark));
        for(int i=0;i<n;i++)
        {
            cin>>num[i];
            int temp=num[i];
            int len=0;
            while(temp)
            {
                int x=temp%10;
                mark[len]=mark[len]+x*(long long )n;
                mark[len+1]=mark[len];
                temp/=10;
                len+=2;
            }
        }
        long long ans=0;
        int flag=0;
        for(int i=40;i>=0;i--)
        {
            if(mark[i]==0&&flag==0)
            {
                flag=0;continue;
            }
            else{
                flag=1;
            }
            ans*=10;
            ans+=mark[i];
            ans%=998244353;
//            cout<<i<<":"<<mark[i]<<"\n";
        }
        cout<<ans<<"\n";
    }
    return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
const int MAXN=100000+100;
int num[MAXN];
int   mark[100];
int main()
{
    int  n;
    while(cin>>n)
    {
        for(int i=0;i<=100;i++)
        {
            mark[i]=0;
        }
        for(int i=0;i<n;i++)
        {
            cin>>num[i];
            int temp=num[i];
            int len=0;
            while(temp)
            {
                int x=temp%10;
                mark[len]=mark[len]+x*n;
                mark[len+1]=mark[len];
                temp/=10;
                len+=2;
            }
        }
        int ans=0;
        for(int i=50;i>=0;i--)
        {
            ans*=10;
            ans+=mark[i];
            if(ans>998244353)
            ans%=998244353;
            if (ans<0)
            {
                ans+=998244353;
            }
        }
        cout<<ans<<"\n";
    }
    return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
const int MAXN=100000+100;
long long  num[MAXN];
long long   mark[40];
int main()
{
    int  n;
    while(cin>>n)
    {
        memset(mark,0,sizeof(mark));
        for(int i=0;i<n;i++)
        {
            cin>>num[i];
            int temp=num[i];
            int len=0;
            while(temp)
            {
                int x=temp%10;
                mark[len]=mark[len]+x*(long long )n;
                mark[len+1]=mark[len];
                temp/=10;
                len+=2;
            }
        }
        long long ans=0;
        int flag=0;
        for(int i=40;i>=0;i--)
        {
            if(mark[i]==0&&flag==0)
            {
                flag=0;continue;
            }
            else{
                flag=1;
            }
            ans*=10;
            ans+=mark[i];
            ans%=998244353;
//            cout<<i<<":"<<mark[i]<<"\n";
        }
        cout<<ans<<"\n";
    }
    return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
const int MAXN=100000+100;
long long  num[MAXN];
long long   mark[40];
int main()
{
    int  n;
    while(cin>>n)
    {
        memset(mark,0,sizeof(mark));
        for(int i=0;i<n;i++)
        {
            cin>>num[i];
            int temp=num[i];
            int len=0;
            while(temp)
            {
                int x=temp%10;
                mark[len]=mark[len]+x*(long long )n;
                mark[len+1]=mark[len];
                temp/=10;
                len+=2;
            }
        }
        long long ans=0;
        for(int i=40;i>=0;i--)
        {
            ans*=10;
            ans+=mark[i];
            ans%=998244353;
        }
        cout<<ans<<"\n";
    }
    return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
const int MAXN=100000+100;
int num[MAXN];
int   mark[40];
int main()
{
    int  n;
    while(cin>>n)
    {
        memset(mark,0,sizeof(mark));
        for(int i=0;i<n;i++)
        {
            cin>>num[i];
            int temp=num[i];
            int len=0;
            while(temp)
            {
                int x=temp%10;
                mark[len]=mark[len]+x*n;
                mark[len+1]=mark[len];
                temp/=10;
                len+=2;
            }
        }
        int ans=0;
        for(int i=40;i>=0;i--)
        {
            ans*=10;
            ans+=mark[i];
            if(ans>998244353)
            ans%=998244353;
            while(ans<0)
            {
                ans+=998244353;
//                cout<<"ans:"<<ans<<"\n";
            }
        }
        cout<<ans<<"\n";
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<cctype>
#include<map>
#define re register int
#define il inline
#define Te template
#define ll long long
#define elif else if
#define N1 15
#define N2 105
#define N3 1005
#define N4 10005
#define N5 100005
#define N6 1000005
#define N7 10000005
#define N8 100000005

using namespace std;

Te <typename R> R read(R &x){
	x=0;
	char c=getchar();R f=1;
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	return x=x*f;
}

Te <typename W> void write(W x){
	if(x<0)x=(~x)|1,putchar('-');
	if(x>9)write(x/10);
	putchar((x-(x/10)*10)+48);
}

/*Variables*/
int n;
ll a,b[N1],maxw,ans,k;
const ll md=998244353;
/*Functions*/

/*---*/
int main(){
	read(n);
	for(int i=1;i<=n;i++){
		read(a);
		ll cnt=1;
		while(a){
			b[cnt]+=a%10;
			a/=10;
			if(a)cnt++;
		}
		maxw=max(maxw,cnt);
	}
	for(int i=maxw;i>=1;i--){
		ans=((ans%998244353)*10)%md+((b[i]%md)*n)%md;
		ans%=md;
		ans=((ans%998244353)*10)%md+((b[i]%md)*n)%md;
		ans%=md;
	//	printf("%lld\n",ans);
	}
	write(ans);
}
/*
1122
 123
1425
 132
  33
 435
4152
 453
4455
*/


#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<cctype>
#include<map>
#define re register int
#define il inline
#define Te template
#define ll long long
#define elif else if
#define N1 15
#define N2 105
#define N3 1005
#define N4 10005
#define N5 100005
#define N6 1000005
#define N7 10000005
#define N8 100000005

using namespace std;

Te <typename R> R read(R &x){
	x=0;
	char c=getchar();R f=1;
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	return x=x*f;
}

Te <typename W> void write(W x){
	if(x<0)x=(~x)|1,putchar('-');
	if(x>9)write(x/10);
	putchar((x-(x/10)*10)+48);
}

/*Variables*/
int n;
ll a,b[N1],maxw,ans,k;
const ll md=998244353;
/*Functions*/

/*---*/
int main(){
	read(n);
	for(int i=1;i<=n;i++){
		read(a);
		ll cnt=1;
		while(a){
			b[cnt]+=a%10;
			a/=10;
			if(a)cnt++;
		}
		maxw=max(maxw,cnt);
	}
	for(int i=maxw;i>=1;i--){
		ans=((ans%998244353)*10)%md+((b[i]%md)*n)%md;
		ans%=md;
		ans=((ans%998244353)*10)%md+((b[i]%md)*n)%md;
		ans%=md;
		printf("%lld\n",ans);
	}
	write(ans);
}
/*
1122
 123
1425
 132
  33
 435
4152
 453
4455
*/


#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<cctype>
#include<map>
#define re register int
#define il inline
#define Te template
#define ll long long
#define elif else if
#define N1 15
#define N2 105
#define N3 1005
#define N4 10005
#define N5 100005
#define N6 1000005
#define N7 10000005
#define N8 100000005

using namespace std;

Te <typename R> R read(R &x){
	x=0;
	char c=getchar();R f=1;
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	return x=x*f;
}

Te <typename W> void write(W x){
	if(x<0)x=(~x)|1,putchar('-');
	if(x>9)write(x/10);
	putchar((x-(x/10)*10)+48);
}

/*Variables*/
int n;
ll a[N5],b[N5][N1],maxw,ans,k,nw[N1],cnt[N5],nm[N1*2];
ll d[N1];
const ll md=998244353;
/*Functions*/

/*---*/
int main(){
	read(n);
	for(int i=1;i<=n;i++){
		read(a[i]);
		ll aa=a[i];
		cnt[i]=1;
		while(aa){
			b[i][cnt[i]]=aa%10;
			d[cnt[i]]+=aa%10;
			aa/=10;
			if(aa)cnt[i]++;
		}
		nw[cnt[i]]++;
		maxw=max(cnt[i],maxw);
	}
	ll tot=1;
	for(int i=1;i<=n;i++){
		int l=cnt[i]*2+1;
		for(int j=cnt[i];j<=maxw;j++){
			if(nw[j])
				for(int k=1;k<=j;k++){
					if(k<=cnt[i])
						nm[2*k]+=b[i][k]*nw[j],nm[2*k-1]+=b[i][k]*nw[j];
					else{
						nm[l]+=d[k];
						l++;
					}
				}
		}
		for(int j=1;j<=cnt[i]-1;j++){
			int l=2*j+1;
			if(nw[j])
				for(int k=1;k<=cnt[i];k++){
					if(k<=j)nm[2*k]+=b[i][k]*nw[j],nm[2*k-1]+=b[i][k]*nw[j];
					else{
						nm[l]+=b[i][k];
						l++;
					}
				}
		}
	}
//	for(int i=1;i<=maxw*2;i++)printf("%d ",nm[i]);
	for(int i=maxw*2;i>=1;i--){
		ans=(((ans%md)*10)%md+nm[i])%md;
	}
//	puts("");
	write(ans);
}
/*
1122
 123
1425
 132
  33
 435
4152
 453
4455
*/


#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<cctype>
#include<map>
#define re register int
#define il inline
#define Te template
#define ll long long
#define elif else if
#define N1 15
#define N2 105
#define N3 1005
#define N4 10005
#define N5 100005
#define N6 1000005
#define N7 10000005
#define N8 100000005

using namespace std;

Te <typename R> R read(R &x){
	x=0;
	char c=getchar();R f=1;
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	return x=x*f;
}

Te <typename W> void write(W x){
	if(x<0)x=(~x)|1,putchar('-');
	if(x>9)write(x/10);
	putchar((x-(x/10)*10)+48);
}

/*Variables*/
int n;
ll a,b[N1],maxw,ans,k;
const ll md=998244353;
/*Functions*/

/*---*/
int main(){
	read(n);
	for(int i=1;i<=n;i++){
		read(a);
		ll cnt=1;
		while(a){
			b[cnt]+=a%10;
			a/=10;
			if(a)cnt++;
		}
		maxw=max(maxw,cnt);
	}
	for(int i=maxw;i>=1;i--){
		ans=((ans%998244353)*10)%md+((b[i]%md)*n)%md;
		ans%=md;
		ans=((ans%998244353)*10)%md+((b[i]%md)*n)%md;
		ans%=md;
		//printf("%lld\n",ans);
	}
	write(ans);
}
/*
1122
 123
1425
 132
  33
 435
4152
 453
4455
*/


// luogu-judger-enable-o2
#include <cstdio>
#include <cctype>
#include <vector>
typedef long long ll;
template <class _T>
void r(_T &x)
{
    #define gc getchar()
    x = 0;
    int f = 1;
    char c = gc;
    while (!isdigit(c)) {if (c == '-') f = -1; c = gc;}
    while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = gc;
    x *= f;
}
const int N = 1e5 + 5;
const int mod = 998244353;
int a[N];
int thing[N][15];
int count[15];
int n;
int cut(int x, int y)
{
    int cnt = 0;
    while (x)
    {
        thing[y][++cnt] = x % 10;
        x /= 10;
    }
    return cnt;
}
ll ans;
int main()
{
    r(n);
    for (int i = 1;i <= n; i++)
    {
        r(a[i]);
        thing[i][0] = cut(a[i], i);
        count[thing[i][0]]++;
    }
    // for (int i = 1;i <= n; i++)
    // {
    //     for(int j = 1;j <= thing[i][0]; j++)
    //         printf ("%d", thing[i][j]);
    //     puts("");
    // }
    for (int i = 10; i > 0; i--)
        if (count[i])
            for (int j = 1;j <= n; j++)
            {
                int t = thing[j][0];
                if (t <= i)
                {
                    ll tmp = 0, base = 1;
                    for (int k = 1;k <= 2 * t; k++, base *= 10)
                    {
                        tmp = (base * thing[j][(k + 1) / 2] + tmp) % mod;
                        // printf ("%d ", thing[j][(k + 1) / 2]);
                    }
                    // printf ("1 tmp = %lld\n", tmp);
                    ans = (ans + tmp * count[i]) % mod;
                }
                else
                {
                    ll tmp = 0, base = 1;
                    for (int k = 1;k <= 2 * i; k++, base *= 10)
                        tmp = (base * thing[j][(k + 1) / 2] + tmp) % mod;
                    for (int k = i + 1;k <= t;k++, base *= 10)
                        tmp = (base * thing[j][k] + tmp) % mod;
                    // prin
                    // tf ("2 tmp = %lld\n", tmp);
                    ans = (ans + tmp * count[i]) % mod;

                }
            }
    printf ("%lld", ans);
    return 0;
}


// luogu-judger-enable-o2
#include <cstdio>
#include <algorithm>
using namespace std;

#define N 100005
#define ll long long
#define mod 998244353

ll sum[30];
ll fac[30];

ll fun(ll x){
	ll res=0;
	while(x){
		(sum[res]+=x%10)%=mod;
		x/=10;
		++res;
	}
	return res;
}

int n;

ll ans;
ll a[N];

void init(){
	fac[0]=1;
	for(int i=1;i<=20;++i) fac[i]=fac[i-1]*10%mod;
}

int main(){
	init();
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%lld",a+i);
		a[i]=fun(a[i]);
	}
	for(int i=0;i<10;++i){
		for(int j=1;j<=n;++j){
			if(i<=(a[j]-1))   (ans+=1LL*fac[2*i]*11LL%mod*sum[i]%mod)%=mod;
			else              (ans+=2LL*fac[a[j]+i]%mod*sum[i]%mod)%=mod;
		}
	}
	printf("%lld\n",ans);
	return 0;
}


#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
const int Mod=998244353;
int calf(string a){
    int ans=0;
    for(int i=0;i<a.length();i++){
        ans=(100*ans+11*(a[i]-'0'))%Mod;
    }
    return ans;
}
int main(){
	int n,ans=0;
	string a;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		ans=(ans+calf(a))%Mod;
	}
	cout<<(n*ans)%Mod<<endl;
	return 0;
}


#include<map>
#include<list>
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define il inline
#define ll long long
#define rl register ll
#define ri register int
#define rc register char
using namespace std;
il int read(){
	rc c=' ';
	ri v=0,x=1;
	while((c<'0')||(c>'9')){if(c=='-') x=-1;c=getchar();}
	while((c>='0')&&(c<='9')){v=(v<<1)+(v<<3)+(c^48);c=getchar();}
	return v*x;
}
il void write(ri x){
	if(x<0) x=-x,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10^48);
}
const int N=1e5+10,mod=998244353;
int n,x,y,a[N],b[N],c[N][10],t[N],pw[20]={1,1},ans;
int main(){
	n=read();
	for(ri i=2;i<=20;i++)
		pw[i]=1ll*pw[i-1]*10%mod;
	for(ri i=1;i<=n;i++){
		a[i]=x=read();
		while(x) c[i][++b[i]]=x%10,x/=10;
		t[b[i]]++;
	}
	for(ri i=1;i<=n;i++){
		for(ri j=b[i];j<=10;j++)
			for(ri k=1;k<=b[i];k++)
				ans=(ans+11ll*t[j]*c[i][k]*pw[2*k-1])%mod;
		for(ri j=1;j<=b[i]-1;j++){
			ri tmp=0;
			for(ri k=1;k<=j;k++)
				tmp=(tmp+11ll*c[i][k]*pw[2*k-1])%mod;
			for(ri k=j+1;k<=b[i];k++)
				tmp=(tmp+2ll*c[i][k]*pw[k+j])%mod;
			ans=(ans+1ll*tmp*t[j])%mod;
		}
	}
	write(ans);
	return ~~(0-0);
}


#include<bits/stdc++.h>
#define N 500500
using namespace std;
int w,s[N];
int POWER(int m)
{
	int s=1,t=10;
	while(m)
	{
		if(m%2)
		s=s*t;
		t=t*t;
		m=m/2;
	}
	return s;
}
int jiwei(int m)
{
    int cnt=0;
	while(m!=0)
	{
		cnt++;
		m/=10;
	}
	return cnt;
}
int Get(int m,int n)
{
	int ans=0;
	for(int i=1;i<=w;i++)
	{
		int a=s[m]/POWER(w-i)%10;
		int b=s[n]/POWER(w-i)%10;
		ans=ans*10+b;
		ans=ans*10+a;

	}
	return ans;
}

int main()
{
	int u;
	scanf("%d",&u);
	for(int i=1;i<=u;i++)
	{
		scanf("%d",&s[i]);
		w=jiwei(s[i]);
	}

	int tot=0;
	for(int i=1;i<=u;i++)
	    for(int j=1;j<=u;j++)
	    {
	    	int q=Get(i,j);
	    	tot+=q;
		}
	printf("%d",tot);
	return 0;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long cxk;
cxk a[100005];
const cxk mod=998244353;
cxk ppp(cxk o)
{
	cxk m=0;
	cxk tot=0;
	while(o)
	{
		cxk x=o%10;
		cxk t=(cxk)pow(10,m)%mod;
		tot+=x*11*t%mod;
		m+=2;
		o=o/10;
	}
	return tot;
}
int main()
{
	cxk ans=0;
	cxk cnt=0;
	cxk n;
	cin>>n;
	for(cxk i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	cxk q=a[1];
	while(q!=0)
	{
		q=q/10;
		cnt++;
	}
	for(cxk i=1;i<=n;i++)
	{
		cxk x=ppp(a[i])%mod;
		ans=(ans+x)%mod;
	}
	ans=(ans*n)%mod;
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 10, P = 998244353;
int n, len, a[maxn];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  int x = a[1];
  for (; x; x /= 10) len++;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int x = a[i], v = 1;
    for (; x; x /= 10) {
      int s = x % 10;
      ans = (ans + 1ll * s * v) % P;
      v = 10ll * v % P;
      ans = (ans + 1ll * s * v) % P;
      v = 10ll * v % P;
    }
  }
  printf("%d", 1ll * n * ans % P);
  return 0;
}


#include<bits/stdc++.h>
#define N 500500
#define mod 998244353
using namespace std;
int w,s[N];
int POWER(int m)
{
	int s=1,t=10;
	while(m)
	{
		if(m%2)
		s=s*t;
		t=t*t;
		m=m/2;
	}
	return s;
}
int jiwei(int m)
{
    int cnt=0;
	while(m!=0)
	{
		cnt++;
		m/=10;
	}
	return cnt;
}
int Get(int m,int n)
{
	int ans=0;
	for(int i=1;i<=w;i++)
	{
		int a=(s[m]%mod)/POWER(w-i)%10;
		int b=(s[n]%mod)/POWER(w-i)%10;
		ans=(ans*10%mod+b)%mod;
		ans=(ans*10%mod+a)%mod;

	}
	return ans;
}

int main()
{
	int u;
	scanf("%d",&u);
	for(int i=1;i<=u;i++)
	{
		scanf("%d",&s[i]);
		w=jiwei(s[i]);
	}

	int tot=0;
	for(int i=1;i<=u;i++)
	    for(int j=1;j<=u;j++)
	    {
	    	int q=Get(i,j);
	    	tot=(tot+q)%mod;
		}
	printf("%d",tot);
	return 0;

}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long ans=0;
long long f[21],map[100001][11],n,l[100001],mod=998244353,t[11];
int maxlen;
long long ff(long long a)
{
	if(a==0)return 1;
	long long res=1;
	for(int i=1;i<=a;i++)
	{
		res*=10;
		res=res%mod;
	}
	return res%mod;
}
int main()
{
	cin>>n;
	for(int i=0;i<=20;i++)
	f[i]=ff(i);
	for(int i=1;i<=n;i++)
	{
		char a[12];int le;
		cin>>a;
		le=strlen(a);
		for(int j=le-1;j>=0;j--)
		map[i][le-j]=a[j]-48;
		l[i]=le;
		t[le]++;
		maxlen=max(le,maxlen);
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=l[i];j++)
		{
			for(int k=1;k<=maxlen;k++)
			{
				if(j<=k)
				{
					ans+=(map[i][j]*t[k]*f[j*2-1])%mod;
					ans+=(map[i][j]*t[k]*f[j*2-2])%mod;
				}
				else
				{
					ans+=(map[i][j]*t[k]*f[j+k-1])%mod;
					ans+=(map[i][j]*t[k]*f[j+k-1])%mod;
				}
			}
		}
	}
	cout<<ans%mod;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
const int mod = 998244353;
const int N = 100010;
int n,a[N],len[N][11],len1[N],lenn[11],cnt,lenmax;
ll ans,p[N];
void init(){
	p[1]=1;
	for(int i=2;i<=20;i++){
		p[i]=(p[i-1]*10)%mod;
	}
}
int main(){
	scanf("%d",&n);
	init();
	for(int i=1;i<=n;i++){
		len1[i]=0;
		scanf("%d",&a[i]);
		while(a[i]){
			len[i][++len1[i]]=a[i]%10;
			a[i]/=10;
		}
		lenn[len1[i]]++;
	}
/*	for(int i=1;i<=n;i++){
		for(int j=1;j<=10;j++){
			cout<<len[i][j];
		}
		cout<<endl;
	}*/
	for(int i=1;i<=n;i++){
		for(int j=1;j<len1[i];j++){
			if(lenn[j]){
				ll t=0;
				for(int k=1;k<=j;k++){
					t=(t+11ll*len[i][k]*p[2*k-1])%mod;
				}
				for(int k=j+1;k<=len1[i];k++){
					t=(t+2ll*len[i][k]*p[k+j])%mod;
				}
				ans=(ans+1ll*t*lenn[j])%mod;
			}

		}
		for(int j=len1[i];j<=10;j++){
			if(lenn[j])
			for(int k=1;k<=len1[i];k++){
				ans=(ans+11ll*len[i][k]*p[2*k-1]*lenn[j])%mod;
			}
		}
	}
	printf("%lld\n",ans%mod);
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll a[100010];
int cnt;
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
	}
	ll m=a[0];
	while(m>0)
	{
		cnt++;
		m/=10;
	}
	ll rres=0;
	for(int i=0;i<n;i++)
	{
			ll x=a[i],y=a[i];
			ll res=0;
			ll count=1;
			for(int i=0;i<cnt;i++)
			{
				res+=((count)*(y%10))%998244353;
				res=res%998244353;
				count=count%998244353;
				y/=10;
				count*=10;
				count=count%998244353;
				res+=((count)*(x%10))%998244353;
				res=res%998244353;
				x/=10;
				count*=10;
			}
			res=res%998244353;
			res*=n;
			rres+=res;
	}
	rres=rres%998244353;
	cout<<rres<<endl;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll a[100010];
int cnt;
ll f(ll x,ll y)
{
//	cout<<x<<" "<<y<<endl;
	ll res=0;
	ll count=1;
	for(int i=0;i<cnt;i++)
	{
		res+=((count%998244353)*(y%10))%998244353;
		res=res%998244353;
		count=count%998244353;
		y/=10;
		count*=10;
		count=count%998244353;
		res+=((count%998244353)*(x%10))%998244353;
		res=res%998244353;
		x/=10;
		count*=10;
	}
	res=res%998244353;
//	cout<<res<<endl;
	return res;
}
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
	}
	ll m=a[0];
	while(m>0)
	{
		cnt++;
		m/=10;
	}
	ll res=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			ll temp=f(a[i],a[j]);
			res+=temp;
		}
	}
	res=res%998244353;
	cout<<res<<endl;

}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll a[100010];
int cnt;
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
	}
	ll m=a[0];
	while(m>0)
	{
		cnt++;
		m/=10;
	}
	ll rres=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			ll x=a[i],y=a[j];
			ll res=0;
			ll count=1;
			for(int i=0;i<cnt;i++)
			{
				res+=((count)*(y%10))%998244353;
				res=res%998244353;
				count=count%998244353;
				y/=10;
				count*=10;
				count=count%998244353;
				res+=((count)*(x%10))%998244353;
				res=res%998244353;
				x/=10;
				count*=10;
			}
			res=res%998244353;
			rres+=res;
		}
	}
	rres=rres%998244353;
	cout<<rres<<endl;

}


import java.io.*;
import java.util.*;

public class Codeforces
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int n=Integer.parseInt(bu.readLine());
        int i,c[]=new int[12];
        String s[]=bu.readLine().split(" ");
        for(i=0;i<n;i++)
        c[s[i].length()]++;

        long p[]=new long[25],M=998244353;
        p[0]=1;
        for(i=1;i<25;i++)
        p[i]=p[i-1]*10%M;

        long ans=0;
        for(i=0;i<n;i++)
        {
            int j,u;
            for(j=s[i].length()-1,u=0;j>=0;j--,u++)
            {
                long tem=0;
                int k,d=s[i].charAt(u)-'0';
                for(k=1;k<=j;k++)   //numbers ending before that point
                tem=(tem+p[j+k]*d*c[k]*2)%M;
                for(k=j+1;k<12;k++)     //numbers ending at and after that point
                {
                    tem=(tem+p[2*j]*d*c[k])%M;
                    tem=(tem+p[2*j+1]*d*c[k])%M;
                }
                //System.out.println(tem+" "+d);
                ans=(ans+tem)%M;
            }
        }
        System.out.print(ans);
    }
}


//  package com.company;

import java.math.BigInteger;
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main{

    public static void main(String args[]){
        PrintWriter out=new PrintWriter(System.out);
        InputReader in=new InputReader(System.in);
        TASK solver = new TASK();
//        int t = in.nextInt();
        int t=1;
        /*
         ** @author Jigar_Nainuji
         ** SVNIT-SURAT
         */
        for(int i=0;i<t;i++)
        {
            solver.solve(in,out,i);
        }
        out.close();
    }
    static class TASK {
        static int mod = 998244353;
        void solve(InputReader in, PrintWriter out, int testNumber) {
            long aa[] = new long[30];
            aa[1]=1;
            for(int i=2;i<30;i++)
            {
                aa[i]=(10l*aa[i-1])%mod;
//                System.out.println(aa[i]);
            }
            int n = in.nextInt();
            long a[] = new long[n];
            long dp[] = new long[11];
            long ans=0;
            for(int i=0;i<n;i++)
            {
                a[i]=in.nextLong();
                String s = String.valueOf(a[i]);
                dp[s.length()]++;
            }
            for(int i=0;i<n;i++)
            {
//                System.out.println(i);
                long x = a[i];
                int count=1;
                long sum=0;
                while (x>0)
                {
                    long xx = x%10;
                    for(int j=1;j<=10;j++)
                    {
                        long yy = dp[j];
                        long sum1=0;
                        if(yy==0)
                            continue;
                        if(count<=j)
                        {
                            sum1 = (sum1+(xx*aa[2*count])%mod)%mod;
                            sum1 = (sum1+(xx*aa[2*count-1])%mod)%mod;

                        }
                        else
                        {
                            sum1=(sum1+(xx*aa[j+count])%mod)%mod;
                            sum1=(sum1+(xx*aa[j+count])%mod)%mod;
                        }
                        sum = (sum +(sum1 * yy)%mod)%mod;
//                        System.out.println(sum);

                    }
                    count++;
                    x/=10;
                }
               ans =(ans+(sum)%mod)%mod;
            }

            System.out.println(ans);

        }
    }

    static class pair{
        int x;
        int y;
        pair(int x,int y)
        {
            this.x=x;
            this.y=y;
        }

    }
    static class Maths{
        static int gcd(int a, int b) {
            if (a == 0)
                return b;
            return gcd(b % a, a);
        }

        public static long factorial(int n){
            long fact = 1;
            for(int i=1;i<=n;i++){
                fact *= i;
            }
            return fact;
        }
    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}