#include using namespace std; typedef long long ll; ll modpow(ll x, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % mod; x = x * x % mod; n >>= 1; } return res; } ll solve(string n, ll mod) { int sz = n.length(); int m = (sz + 1) / 2; vector dp[2]; for (int i = 0; i < 2; i++) dp[i].resize(m + 1, 0); dp[0][0] = 1; for (int i = 0; i < m; i++) { for (int j = 0; j < 2; j++) { int lim = j ? 9 : n[i] - '0'; for (int d = 0; d <= lim; d++) { (dp[j || d < lim][i + 1] += dp[j][i]) %= mod; } } } ll ans = dp[1][m] - 1; (ans += (modpow(10, m - sz % 2, mod) + mod - 1) % mod) %= mod; string s1 = n.substr(0, sz / 2); reverse(s1.begin(), s1.end()); string s2 = n.substr(m); if (s1 <= s2) (ans += dp[0][m]) %= mod; return ans; } int main() { cin.tie(0); ios::sync_with_stdio(false); string n; cin >> n; cout << solve(n, 1e9) << endl; cout << solve(n, 1e9 + 7) << endl; return 0; }