#include <stdio.h>

int main() {
   int n,sum1,sum2,sqr;
   while(scanf("%d",&n)!=EOF){
        sum1=0,sum2=0;
        sqr=n*n;
        while(n>0){
            sum1+=n%10;
            n=n/10;
        }
         while(sqr>0){
            sum2+=sqr%10;
            sqr=sqr/10;
        }
        printf("%d %d\n",sum1,sum2);

   }
    return 0;
}