#include using namespace std; typedef long long int64; string S; int64 dp[1000001][2]; int64 dp2[1000001]; int64 rec2(int idx, const int mod) { if(idx <= 0) return (1); if(idx % 2 == 1) return (rec2(idx - 1, mod) * 10 % mod); if(~dp2[idx]) return (dp2[idx]); return (dp2[idx] = rec2(idx - 2, mod) * 10 % mod); } int64 rec(int idx, bool free, const int mod) { if(~dp[idx][free]) return (dp[idx][free]); if(S.size() / 2 == idx) { if(idx == 0) return (9); if(S.size() % 2 == 1) return (free ? 10 : S[idx] - '0' + 1); else return (1); } int64 ret = 0; int end = free ? 9 : S[idx] - '0'; for(int i = 0; i <= end; i++) { if(idx == 0 && i == 0) continue; bool nt = free | (i != end); if(!nt && S[S.size() - idx - 1] - '0' < i) continue; (ret += rec(idx + 1, free | (i != end), mod)) %= mod; } return (dp[idx][free] = ret); } int64 ct(int mod) { memset(dp, -1, sizeof(dp)); memset(dp2, -1, sizeof(dp2)); int64 ret = 0; for(int i = 0; i < S.size() - 1; i++) { ret += rec2(i - 1, mod) * 9; ret %= mod; } return ((ret + rec(0, 0, mod)) % mod); } int main() { cin >> S; cout << ct(1e9) << endl; cout << ct(1e9 + 7) << endl; }