when the constraints are in the range, try to use generating functions
How many digits = $\color{red}7$ ===> X$_1$ + X$_2$ + X$_3$ + X$_4$ + X$_5$ + X$_6$ + X$_7$
for each digit we will assign a number with in the range, $\color{green}1$ ≤ X$_i$ ≤ $\color{blue}3$
then generating function will be like (X$\color{green}{^1}$+X$^2$+X$\color{blue}{^3}$)$\large\color{red}{^7}$
What is the sum we require ? 11.
∴ the required value is coefficient of X$\large\color{magenta}{^{11}}$ in the generating function (X$\color{green}{^1}$+X$^2$+X$\color{blue}{^3}$)$\large\color{red}{^7}$
coefficient of X$\large\color{magenta}{^{11}}$ in the generating function (X$\color{green}{^1}$+X$^2$+X$\color{blue}{^3}$)$\large\color{red}{^7}$ = (X(X$\color{green}{^0}$+X$^1$+X$\color{blue}{^2}$))$\large\color{red}{^7}$ = X$\color{red}{^7}$(X$\color{green}{^0}$+X$^1$+X$\color{blue}{^2}$)$\large\color{red}{^7}$
coefficient of X$\large\color{magenta}{^{11}}$ in the generating function (X$\color{green}{^1}$+X$^2$+X$\color{blue}{^3}$)$\large\color{red}{^7}$ = coefficient of X$\large\color{magenta}{^{11-\color{red}7}}$ in the generating function (X$\color{green}{^0}$+X$^1$+X$\color{blue}{^2}$)$\large\color{red}{^7}$
coefficient of X$\large\color{magenta}{^{4}}$ in the generating function (X$\color{green}{^0}$+X$^1$+X$\color{blue}{^2}$)$\large\color{red}{^7}$ = ${(\frac{1-x^3}{1-x})}^\color{red}7 = \underbrace{(1-x^3)^\color{red}7} . \underbrace{(1-x)^\color{red}{-7}} $
if you take $\binom{7}{0}$ in first part, then you require $\binom{-7}{4}$ to make X$\large\color{magenta}{^{4}}$.
if you take $\binom{7}{1}$ in first part, then you require $\binom{-7}{1}$ to make X$\large\color{magenta}{^{4}}$.
if you take $\binom{7}{2}$ in first part, then it produce X$\large\color{magenta}{^{6}}$, it is more than required, Hence stop.
coefficient of X$\large\color{magenta}{^{4}}$ in the generating function (X$\color{green}{^0}$+X$^1$+X$\color{blue}{^2}$)$\large\color{red}{^7}$ = $\binom{7}{0}.(-1)^0.\binom{-7}{4}$ + $\binom{7}{1}.(-1)^1.\binom{-7}{1}$
= $\binom{7}{0}.(1) \binom{10}{4}$ + $\binom{7}{1}.(-1).\binom{7}{1}$ = 210-49 = 161
the best tutorial for generating functions ( from 11$^{th}$ video )
https://www.youtube.com/playlist?list=PLDDGPdw7e6Aj0amDsYInT_8p6xTSTGEi2