#include <stdio.h> #include <string.h> int main() { int n,n2; while(scanf("%d",&n)!=EOF) { int m1=0,m2=0; n2=n*n; while(n>0) { m1=m1+n%10; n=n/10; } while(n2>0) { m2=m2+n2%10; n2=n2/10; } printf("%d %d\n",m1,m2); } return 0; }