You are given a string of length N consisting of only lowercase alphabets and two alphabets x and y.
There are Q queries given and each query will be specified by two integers l and r. You have to consider the sub string of the given string and count the total number of distinct sub sequences of the sub string which starts with x and ends with y.
Note:
We consider two sub strings to be different if they start or end at different indices of the given string.
As the count can be very large, so you have print it modulo with .
Input format:
First line contains a integer N representing the length of string.
Second line contains a string of length N.
Third line contains two space separated alphabets x and y.
Fourth line contains the number of queries Q.
Each of the next Q lines contains two space separated integers l and r.
Input Constraints:
Output format:
Output Q lines, each containing a single integer representing the number of sub-sequences modulo for each query.
For Query 1 : String will be .
Required Subsequences are: (using index 0,2), (using index 1,2), .
For Query 2 : String will be .
Required Subsequences are: (using index 1,2), (using index 1,3), .
For Query 3 : String will be .
No subsequence ends with b.
For Query 4 : String will be .
Required Subsequences are: (using index 0,2), (using index 0,3), (using index 1,2), (using index 1,3), (using index 0,1,2), (using index 0,1,3), (using index 0,2,3), (using index 1,2,3), .