#include #include #include

using namespace std;

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

int main() { int n; while (cin >> n) { int sq = n * n; n = sum(n); sq = sum(sq); cout << n << ' ' << sq << endl; } return 0; }