#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <cstring>
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
    int n;
    while (scanf("%d", &n) != EOF) {
        int temp_1 = n;
        int temp_2 = n * n;
        int sum_1 = 0;
        int sum_2 = 0;
        while (temp_1 > 0) {
            sum_1 += temp_1 % 10;
            temp_1 = temp_1 / 10;
        }
        while (temp_2 > 0) {
            sum_2 += temp_2 % 10;
            temp_2 = temp_2 / 10;
        }
        printf("%d %d\n", sum_1, sum_2);
        break;
    }
    return 0;
}