Count Subsequences Problem

please help me to find the mistake in the code.
The link to the code is as follows:-

hello @krikhi
apply mod property.
i.e (a-b)%mod= (a-b + mod )%mod;
this line image
should be
image

thanks a lot for help. All thetestcases are getting passed