#include <stdio.h>
int main(){
    int n,t,a,b;
    while(scanf("%d",&n)!=EOF){
        t=n*n;
        a=0;b=0;
        while(n!=0)
        {
            a+=n%10;
            n/=10;
        }
        while(t!=0)
        {
            b+=t%10;
            t/=10;            
        }
        printf("%d %d\n",a,b);
    }
}
(•̀ᴗ•́)و