P11856 [CSP-J 2022 Shandong] Reciting Poetry

Background

Due to the impact of the pandemic, Shandong Province canceled the CSP-J 2022 certification event, and set a new problem in March of the next year to hold a make-up contest within the province.

Description

"Articles are naturally formed; a wonderful touch is gained by chance." Reciting poetry is a common way to express feelings. After the war ended, years of military life made Xiaoxiami like the bold style of poetry. One day, Xiaoxiami suddenly wanted to recite poetry. The famous bold-style poet Su Shi had the boldness of “老夫聊发少年狂,左牵黄,右擎苍。”, and also the sorrow of “十年生死两茫茫,不思量,自难忘。”. Xiaoxiami longed for this, so he also wanted to write a poem using the tune pattern name "Jiangchengzi". Xiaoxiami wants to write a poem that can be passed down through the ages. Based on experience, if a poem contains a "wonderful touch" (miaoshou), it can be passed down through the ages. More specifically, for a poem of $N$ characters, each character can be represented by an integer between **$1$ and $10$**. There are also three positive integers $X,Y,Z\left(1\le X\le7,1\le Y\le5,1\le Z\le5\right)$. If the poem contains three consecutive segments such that the sum of the first segment is $X$, the sum of the second segment is $Y$, and the sum of the third segment is $Z$, then Xiaoxiami thinks this poem has a **wonderful touch**. That is, for a sequence of length $n$, $a_{1},a_{2},\dots a_{n} \left(1\le a_{i}\le10\right)$, if there exist $i,j,k,l\left(1\le i

Input Format

One line with 4 positive integers $N,X,Y,Z$ separated by spaces, representing the sequence length and the values of $X,Y,Z$ in the problem.

Output Format

One line with one integer, representing the answer modulo **$998244353$**.

Explanation/Hint

### Explanation for Sample 1 Among all possible sequences, only one sequence $\left[2,3,3\right]$ can be constructed to satisfy the requirement, so the answer is $1$. ### Constraints For $30\%$ of the testdata, $3\le N\le5$. For $60\%$ of the testdata, $3\le N\le20$. For $100\%$ of the testdata, $3\le N\le40,1\le X\le7,1\le Y\le5,1\le Z\le5$. Translated by ChatGPT 5