#include #include #include #include #include #include #include using namespace std; string S; long long power[100009]; long long solve(long long mod) { power[1] = 9; for (int i = 2; i < 100009; i++)power[i] = (power[i - 1] * 10) % mod; long long ret = 0; for (int i = 1; i < S.size(); i++)ret += power[(i + 1) / 2]; string T = S.substr(0, ((int)S.size() + 1) / 2); string U = T; reverse(T.begin(), T.end()); if (S.size() % 2 == 1)T = T.substr(1, T.size() - 1); U += T; T = S.substr(0, ((int)S.size() + 1) / 2); ret %= mod; power[0] = 1; for (int i = 1; i < 100009; i++)power[i] = (power[i - 1] * 10) % mod; for (int i = 0; i < T.size(); i++) { long long B = (T[i] - '0'); if (i == 0)B--; ret += power[T.size() - 1 - i] * B; ret %= mod; } if (S >= U)ret++; return ret; } int main() { cin >> S; cout << solve(1000000000) << endl << solve(1000000007) << endl; return 0; }