A Permutation problem with sum restrictions In how many permutations of digits 1, 2, 3,...,9 are the following two conditions satisfied:


*

*Sum of digits between 1 and 2 (including both) is 12.

*Sum of digits between 2 and 3 (including both) is 23.


My Attempt
Clearly 3 cannot lie between 1 and 2. So the sequence will be 1..2..3 or 3..2..1
or 2..1..3 or 3..1..2.
For case 1, I started counting the possible sub cases.
Similarly, I might count all cases, but I am sure there is a more elegant way.
Just a hint would suffice.

Properly between $1$ and $2$ we need a total of $9$.
As we cannot use $1,2,3$ to produce this $9$, we find thet the $9$ can only be the digit $9$ itself or $4+5$.
If $1$ is between $2$ and $3$, we need a total of $23-3-12=8$ between $2$ and $3$. This can only be $8$ itself (as $1,2,3$ are already used). This gives us $(2,9,1,8,3)$ or reversed as possibilities; or we have $(2,4,5,1,8,3)$ or the latter with $4,5$ swapped or either reversed. In the first cases, this block and the remaining four digits can occur in $5!$ orders, in the  second case, the block and remaining three digits can occur in $4!$ orders. This gives us $2\cdot 5!+4\cdot 4!=336$ possibilities.
If $1$ is not between $2$ and $3$, we need a total of $18$ between $2$ and $3$, where we must avoid $1,2,3$. Note that
$$18=9+5+4=8+6+4=7+6+5$$
are the only possibilities we have. However, we have used either $9$ or $4$ and $5$ between $1$ and $2$. This strikes out the first sum and allows only $9$ between $1$ and $2$ in the other two cases.
The three summands between $2$ and $3$ can occur in $3!$ orders. The whole block $(1,9,2,?,?,?,3)$ can be flipped and the block and the remaining  two digits can occur in $3!$ orders. This gives us $2\cdot3!\cdot 3!=72$ possibilities.
In total we count $336+72=408$ possibilities.
