#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int solve(const string& s, int mod)
{
    int n = s.size();

    long long ans = 0;
    long long tmp = 9;
    for(int i=1; i<n; ++i){
        ans += tmp;
        ans %= mod;
        if(i % 2 == 0){
            tmp *= 10;
            tmp %= mod;
        }
    }

    vector<int> dp(4, 0);
    dp[2] = 1;
    for(int i=0; i<(n+1)/2; ++i){
        vector<int> nextDp(4, 0);
        for(int a=0; a<4; ++a){
            for(int x=0; x<=9; ++x){
                if(i == 0 && x == 0)
                    continue;
                if((a & 2) && x > s[i] - '0')
                    continue;

                int b = a;
                if(x < s[i] - '0')
                    b &= ~2;
                if(x < s[n-1-i] - '0')
                    b &= ~1;
                else if(x > s[n-1-i] - '0')
                    b |= 1;
                nextDp[b] += dp[a];
                nextDp[b] %= mod;
            }
        }
        dp.swap(nextDp);
    }

    for(int i=0; i<3; ++i){
        ans += dp[i];
        ans %= mod;
    }
    return ans;
}

int solve(int n)
{
    int ans = 0;
    for(int i=1; i<=n; ++i){
        string s = to_string(i);
        string t = s;
        reverse(t.begin(), t.end());
        if(s == t)
            ++ ans;
    }
    return ans;
}

int main()
{
    string s;
    cin >> s;

    cout << solve(s, 1000000000) << endl
         << solve(s, 1000000007) << endl;

    return 0;
}