Count subsequence problem from dp section

https://ide.codingblocks.com/s/220546.
the code is failing 4 test cases,what’s wrong with the code

udpated the code had to add mod
since the value can become -ve line 16