#include <iostream>
using namespace std;

int ss(long int n)
{
    int f=0;
    int m;
    while (n>=1)
    {
        m=n%10;
        n=n/10;
        f=f+m;
    }
    return f;
}

int main() {
    int a;
    long int b;
    int x,y;
    while (cin >> a) {
        b=a*a;
        x=ss(a);
        y=ss(b);
        cout<<x<<" "<<y<<endl;
        //cout << a + b << endl;
    }
}