#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include using namespace std; using i32 = int; using i64 = long long int; using f64 = double; using str = string; template using vec = vector; template using heap = priority_queue; void in() {}; template void in(T &&x, TS &&...xs) { cin>>x; in(move(xs)...); }; template void _out(const char *sep, const char *end, T &&x) { cout< void _out(const char *sep, const char *end, T &&x, TS &&...xs) { cout<> _; return _; }() #define put(...) _out("", "", __VA_ARGS__) #define out(...) _out(" ", "\n", __VA_ARGS__) #define times(n, i) for (i32 i = 0 ; i < (n); ++i) #define range(a, b, i) for (i32 i = (a); i < (b); ++i) #define upto(a, b, i) for (i32 i = (a); i <= (b); ++i) #define downto(a, b, i) for (i32 i = (a); i >= (b); --i) #define all(xs) (xs).begin(), (xs).end() #define sortall(xs) sort(all(xs)) #define reverseall(xs) reverse(all(xs)) #define even(x) (((x) & 1) == 0) #define odd(x) (((x) & 1) == 1) #define append emplace_back #define findge lower_bound #define findgt upper_bound const i64 MOD = 1000000007; const f64 EPS = 1e-10; template T prevpow(T a, T x) { if (a <= 1 || x < 1) throw domain_error(NULL); auto n = floor(log(double(x)) / log(double(a))); auto p = pow(a, n + 1); return p <= x ? p : pow(a, n); } template tuple gcdext(T a, T b) { T s0 = 1, s1 = 0; T t0 = 0, t1 = 1; T q = 1; while (b != 0) { q = a / b; swap(a, b); b = b % a; swap(s0, s1); s1 = s1 - q*s0; swap(t0, t1); t1 = t1 - q*t0; } return a < 0 ? make_tuple(-a, -s0, -t0) : make_tuple(a, s0, t0); } template T invmod(T n, T m) { auto gxy = gcdext(n, m); T g, x, y; tie(g, x, y) = gxy; if (g != 1 || m == 0) throw domain_error(NULL); return (x+m)%m; } template T powmod(T x, T p, T m) { if (p < 0) return powmod(invmod(x, m), -p, m); if (p == 0) return 1 % m; if (m == 1 || m == -1) return 0; T b = x % m; T t = prevpow(T(2), p); T r = 1; while (true) { if (p >= t) { r = (r*b) % m; p -= t; } t >>= 1; if (t <= 0) break; r = (r*r) % m; } return r; } const i64 mod0 = 10e9; const i64 mod7 = 10e9+7; str s; i64 solve(str s, i64 m) { i64 ans0 = 0, ans7 = 0; upto(1, s.size()-1, li) { i64 p = powmod(10ll, i64(li+1) / 2, m); p -= powmod(10ll, i64(li+1) / 2 - 1, m); while (p < 0) p += m; ans0 = (ans0 + p) % m; } { i64 l = (s.size()+1)/2; str s1 = ""; str s2 = ""; times(l, li) { s1 += s[li]; s2 += s[s.size()/2+li]; } str ss = s1; times(l, li) { if (s1[s1.size()-1-li] > s2[li]) { downto(ss.size()-1, 0, si) { if (ss[si] > '0') { ss[si]--; break; } ss[si] = '9'; } if (ss[0] == '0') { return ans0; } break; } if (s1[s1.size()-1-li] < s2[li]) { break; } } i64 t = 0; times(ss.size(), si) { t = (t + (ss[si]-'0') * powmod(10ll, i64(ss.size()-1-si), m)) % m; } i64 u = 0; range(1, ss.size(), si) { u = (u + 9 * powmod(10ll, i64(ss.size()-1-si), m)) % m; } i64 p = t - u; while (p < 0) p += m; ans0 = (ans0 + p) % m; } return ans0; } i32 main() { in(s); out(solve(s, mod0)); out(solve(s, mod7)); return 0; }