#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll getans1(string s)
{
ll tmp=0;
for(auto i:s)
{
tmp+=i-'0';
}
return tmp;
}
ll getans2(string s){
ll tmp;
tmp=atoi(s.c_str());
tmp*=tmp;
s=to_string(tmp);
tmp=0;
for(auto i:s)
{
tmp+=i-'0';
}
return tmp;
}
int main(){
string s;
while(cin>>s)
{
ll ans1,ans2;
cout<<getans1(s)<<" "<<getans2(s)<<endl;
}
return 0;
}