from functools import lru_cache from itertools import product MOD = 998244353 @lru_cache(None) def solve(L, R, A, B, C): if L + max(A + B, C) > R: return 0 if L >= R: return int(L == R and A == 0 and B == 0 and C == 0) res = 0 for (x0, y0, z0) in product(range(10), repeat=3): # L<=x nL, L0 = divmod(L, 10) nL += L0 > x0 # x+A<=y nA, A0 = divmod(x0 + A, 10) nA += A0 > y0 # y+B<=z nB, B0 = divmod(y0 + B, 10) nB += B0 > z0 # x+C<=z nC, C0 = divmod(x0 + C, 10) nC += C0 > z0 # z<=R nR, R0 = divmod(R, 10) nR -= z0 > R0 res += solve(nL, nR, nA, nB, nC) return res % MOD def main(): L, R = map(int, input().split()) A, B, C = map(int, input().split()) print(solve(L, R, A, B, C)) if __name__ == "__main__": main()