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

int main(){
	int n;
	while(cin>>n){
		long pf = n*n;
		int sum1 = 0,sum2 = 0;
		while(n){
			sum1 += n % 10;
			n /= 10;
		}
		cout<<sum1<<" ";
		while(pf){
			sum2 += pf % 10;
			 pf /= 10;
		}
		cout<<sum2<<endl;
	} 

}