#P11856. Miraculous Poetry

    ID: 13956 Type: Default 1000ms 256MiB

Miraculous Poetry

Miraculous Poetry

Given an integer N and three positive integers \(X, Y, Z\) with constraints \(1\le X\le7\), \(1\le Y\le5\) and \(1\le Z\le5\), consider an N-character poem where each character is represented by an integer between 1 and 10 (inclusive). A poem is said to exhibit a miracle if there exist indices \(1\le i<j<k<l\le N\) such that the sum over the first contiguous segment \(a_i+a_{i+1}+\cdots+a_{j-1}\) equals \(X\), the sum over the next segment \(a_j+a_{j+1}+\cdots+a_{k-1}\) equals \(Y\), and the sum over the third segment \(a_k+a_{k+1}+\cdots+a_{l-1}\) equals \(Z\). Note that the three segments occur one right after the other.

There are a total of \(10^N\) possible poems. Your task is to compute the number of poems that contain a miracle. Since the answer can be very large, output it modulo \(998244353\).

inputFormat

The input consists of a single line containing four space‐separated integers: \(N, X, Y, Z\).

outputFormat

Output a single integer — the number of poems that contain a miracle, modulo \(998244353\).

sample

2 1 1 1
0