#include <iostream>
int func(int x) {
    int res = 0;
    while (x != 0) {
        res += x % 10;
        x /= 10;
    }
    return res;
}

int main() {
    int n;
    while (scanf("%d", &n) == 1)
        printf("%d %d\n", func(n), func(n * n));
    return 0;
}