#include <stdio.h>
#include <string.h>

typedef long long ll;
int count(char *s,int sum){
	int length=strlen(s);
	for(int i=0; i<length; i++) {
		sum+=(s[i]-'0');
	}
	return sum;
}

int main(){
	char a[6],b[20];
	ll temp,power;
	while(scanf("%s",&a)!=EOF) {
		sscanf(a,"%d",&temp);//将字符串转为int型
		power=temp*temp;
		sprintf(b,"%lld",power);//将平方后的数值转为字符串
		printf("%d %d\n",count(a,0),count(b,0));
	}
	return 0;
}