#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e6 + 10;
int t, n, m, k, l, r, op, x, y, cnt;
int f[N];
void solve() {
cin >> n;
while (true) {
t = n;
k = 0;
while (t) {
k = k * 10 + t % 10;
t /= 10;
}
if (k == n) {
cout << cnt << " " << n << "\n";
return;
}
cnt++;
n = k + n;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}