#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "math.h" #include "utility" #include "string" #include "map" #include "unordered_map" #include "iomanip" #include "random" using namespace std; const long long int MOD = 1000000007; list Prime(int M) { listP; P.push_back(2); P.push_back(3); for (int i = 5; i <= M; i += 6) { bool flag = true; for (auto j : P) { if (i%j == 0) { flag = false; break; } } if (flag)P.push_back(i); flag = true; for (auto j : P) { if ((i + 2) % j == 0) { flag = false; break; } } if (flag)P.push_back(i + 2); } return P; } long long int N, K, Q; string s; long long int num[100001]; long long int box[100001]; long long int s_num[100001]; long long int s_box[100001]; long long int t_num[100001]; long long int t_box[100001]; int main() { ios::sync_with_stdio(false); cin >> s; num[1] = 9; num[2] = 9; box[1] = 9; box[2] = 9; t_num[0] = 1; t_box[0] = 1; for (int i = 3; i <= 100000; i++) { num[i] = num[i - 2] * 10; num[i] %= MOD; box[i] = box[i - 2] * 10; box[i] %= 1000000000; } for (int i = 1; i <= 100000; i++) { s_num[i] = s_num[i - 1] + num[i]; s_num[i] %= MOD; s_box[i] = s_box[i - 1] + box[i]; s_box[i] %= 1000000000; t_num[i] = t_num[i - 1] * 10; t_num[i] %= MOD; t_box[i] = t_box[i - 1] * 10; t_box[i] %= 1000000000; } long long int ans_box = s_box[s.size() - 1]; long long int ans_num = s_num[s.size() - 1]; ans_box += (s[0] - '1')*t_box[(s.size()-1) / 2]; ans_num += (s[0] - '1')*t_num[(s.size()-1) / 2]; bool flag = true; for (int i = 0; i < s.size()/2; i++) { if (s[i] > s[s.size() - i - 1]) { flag = false; break; } if (s[i] < s[s.size() - i - 1]) { break; } } for (int i = 1; i < s.size() / 2; i++) { ans_box += (s[i] - '0')*t_box[(s.size() - 1) / 2 - i]; ans_num += (s[i] - '0')*t_num[(s.size() - 1) / 2 - i]; } if (flag) { ans_box++; ans_num++; } ans_box %= 1000000000; ans_num %= MOD; cout << ans_box << endl << ans_num << endl; return 0; }