unsigned int sumOfDigits(unsigned int n)
{
unsigned int sum = 0;
while(n!=0)
{
sum += n%10;
n/=10;
}
return sum;
}
int main()
{
FINPUT("in.txt");
FOUTPUT("out.txt");
unsigned int n;
while(cin>>n && n)
{
int sum = sumOfDigits(n);
unsigned int m = n*n;
int mult = sumOfDigits(m);
cout<<sum<<" "<<mult<<endl;
}
return 0;
}