#include <iostream>
using namespace std;

int normalSum(int n){
    int sum = 0;
    while(n > 0){
        sum += n % 10;
        n = n /10;
    }
    return sum;
}

int main() {
    int n;
    while(cin >> n){
        cout << normalSum(n) << " " << normalSum(n*n) << endl;
    }

    return 0;
}