#include using namespace std; #define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++) template bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; } template bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; } typedef long long ll; int N; const int MAX_N = 100001; string S; const ll mod1 = 1e9,mod2 = 1e9 + 7; ll dp1 [MAX_N + 1] [2] [2],dp2 [MAX_N + 1] [2] [2]; ll mod_pow(ll x,ll y,ll mod) { ll res = 1; while(y){ if(y & 1) (res *= x) %= mod; (x *= x) %= mod; y >>= 1; } return res; } int main() { cin >> S; N = S.size(); ll ans1 = 0,ans2 = 0; FOR(i,0,N - 1){ (ans1 += mod_pow(10,i / 2,mod1) * 9) %= mod1; (ans2 += mod_pow(10,i / 2,mod2) * 9) %= mod2; } FOR(i,1,10){ int f = S.front() - '0',b = S.back() - '0'; if(i > f) continue; dp1 [1] [i < f] [i > b]++; dp2 [1] [i < f] [i > b]++; } FOR(i,1,(N + 1) / 2){ int f = S [i] - '0',b = S [N - 1 - i] - '0'; FOR(nxt,0,f){ (dp1 [i + 1] [1] [nxt > b] += dp1 [i] [0] [0]) %= mod1; (dp2 [i + 1] [1] [nxt > b] += dp2 [i] [0] [0]) %= mod2; (dp1 [i + 1] [1] [nxt >= b] += dp1 [i] [0] [1]) %= mod1; (dp2 [i + 1] [1] [nxt >= b] += dp2 [i] [0] [1]) %= mod2; } (dp1 [i + 1] [0] [f > b] += dp1 [i] [0] [0]) %= mod1; (dp2 [i + 1] [0] [f > b] += dp2 [i] [0] [0]) %= mod2; (dp1 [i + 1] [0] [f >= b] += dp1 [i] [0] [1]) %= mod1; (dp2 [i + 1] [0] [f >= b] += dp2 [i] [0] [1]) %= mod2; FOR(nxt,0,10){ (dp1 [i + 1] [1] [nxt > b] += dp1 [i] [1] [0]) %= mod1; (dp2 [i + 1] [1] [nxt > b] += dp2 [i] [1] [0]) %= mod2; (dp1 [i + 1] [1] [nxt >= b] += dp1 [i] [1] [1]) %= mod1; (dp2 [i + 1] [1] [nxt >= b] += dp2 [i] [1] [1]) %= mod2; } } (ans1 += dp1 [(N + 1) / 2] [0] [0] + dp1 [(N + 1) / 2] [1] [0] + dp1 [(N + 1) / 2] [1] [1]) %= mod1; (ans2 += dp2 [(N + 1) / 2] [0] [0] + dp2 [(N + 1) / 2] [1] [0] + dp2 [(N + 1) / 2] [1] [1]) %= mod2; printf("%lld\n%lld\n",ans1,ans2); return 0; }