#include <stdio.h>

void func(long x){
    char remain[10] = "0";
    int i = 0;
    while (x != 0){
        remain[i] = x % 10;
        i++;
        x /= 10;
    }
    int sum = 0;
    for (int j = 0; j < 10; ++j) {
        sum += remain[j];
    }
    printf("%d ", sum);
}

int main(){
    long num;
    while(scanf("%ld", &num) != EOF){
        func(num);
        func(num * num);
        printf("\n");
    }
    return 0;
}