#include <iostream>
using namespace std;

int SUM(int n)
{
    int sum = 0;
    while(n != 0)
    {
        //取模、取整
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
    int a;
    while (cin >> a) { // 注意 while 处理多个 case
       cout << SUM(a) << " " << SUM(a*a) <<endl;
    }
    return 0;
}
// 64 位输出请用 printf("%lld")