#include <iostream> #include <string> using namespace std; int posSum(int n) { string str = to_string(n); int sum = 0; for (int i = 0; i < str.size(); ++i) { sum += str[i] - '0'; } return sum; } int powerSum(int n) { string str = to_string(n * n); int sum = 0; for (int i = 0; i < str.size(); ++i) { sum += str[i] - '0'; } return sum; } int main() { int n; while (cin >> n) { cout << posSum(n) << " " << powerSum(n) << endl; } }