using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var list = new int[n + 1]; for (var i = 1; i < list.Length; ++i) list[i] = i - i.ToString().Length; var mod = 998_244_353; var dp = new long[n + 1]; dp[0] = 1; for (var i = 0; i < n; ++i) { var ndp = new long[n + 1]; for (var j = 0; j < n; ++j) for (var k = 1; k < list.Length; ++k) if (j + list[k] < ndp.Length) ndp[j + list[k]] = (ndp[j + list[k]] + dp[j]) % mod; dp = ndp; } WriteLine(dp[n - 1]); } }