C# Solution
\npublic class Solution \n{\n    public int DieSimulator(int n, int[] rollMax)\n    {\n        var dp = new int[6, 16];\n        dp[0, 1] = 1; dp[1, 1] = 1; dp[
```\npublic class Solution \n{\n    public int DieSimulator(int n, int[] rollMax)\n    {\n        var dp = new int[6, 16];\n        dp[0, 1] = 1; dp[1, 1] = 1; dp[2, 1] = 1;\n        dp[3, 1] = 1; dp[4, 1] = 1; dp[5, 1] = 1;\n        int mod = 1_000_000_007, result = 0;\n        for(int count = 1; count < n; count++)\n        {\n            var dpTemp = new int[6, 16];\n            for(int i = 0; i < 6; i++)\n            {\n                if(rollMax[i] > 0)\n                {\n                    for(int j = 0; j < 6; j++) \n                        if(i != j)\n                            for(int k = 1; k < 16; k++)\n                                 dpTemp[i, 1] =  (dpTemp[i, 1] + dp[j, k]) % mod;\n                    \n                    for(int j = 1; j < rollMax[i]; j++)\n                        dpTemp[i, j + 1] = (dp[i, j] + dpTemp[i, j + 1]) % mod;\n                }\n            }\n            \n            dp = dpTemp;\n        }\n        \n        for(int i = 0; i < 6; i++)\n            for(int j = 1; j < 16; j++)\n                result = (result + dp[i, j]) % mod;\n        return result;\n    }\n}\n```
[]