#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001


int main(){
	
	string N;
	cin>>N;
	
	vector dp(2,vector(2,vector<mint>(1<<10,0)));
	dp[0][0][0] = 1;
	rep(i,N.size()){
		vector ndp(2,vector(2,vector<mint>(1<<10,0)));
		rep(j,2){
			rep(k,2){
				rep(l,1<<10){
					rep(m,10){
						int nj = j,nk = k,nl = l;
						if(m!=0)nk = 1;
						if(nk)nl ^= 1<<m;
						if(j==0 && N[i]-'0' < m)continue;
						if(N[i]-'0'>m)nj = 1;
						ndp[nj][nk][nl] += dp[j][k][l];
					}
				}
			}
		}
		
		swap(dp,ndp);
	}
	
	mint ans = 0;
	ans += dp[0][1][0] + dp[1][1][0];
	cout<<ans.val()<<endl;
	
	return 0;
}