Classic Quotation

각 질의 (L, R)에서 가능한 모든 접두사와 접미사 분할에 대해 T가 나타나는 횟수를 세고, 기댓값에 L과 (n-R+1)을 곱해 출력한다.

어려움8문자열 매칭누적 합해시맵아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

When chatting online, we can save what somebody said to form his classic quotation. Little Q does this, too. And what's more, he can even change the original words. Formally, assume somebody said a string SS of length nn. Little Q will choose a continuous substring of SS (possibly empty) and remove it, then concatenate the two remaining parts, obtaining a new string SS'. For example, he might remove "not " from the string "I am not SB", so that the new string SS' will be "I am SB".

After doing lots of such things, Little Q finds out that string TT occurs as a continuous substring of SS' very often.

Now given strings SS and TT, Little Q has kk queries.  Each query has the following format: given LL and RR, Little Q will remove a substring so that the two remaining parts are S\[1..i]S\[1..i] and S\[j..n]S\[j..n] where the pair of integers (i,j)(i, j) is chosen equiprobably among all pairs where 1iL1 \leq i \leq L and RjnR \leq j \leq n. Your goal is to find EE, the expected number of occurrences of TT in the resulting string, and print the value EL(nR+1)E \cdot L \cdot (n - R + 1).

All occurrences of TT must taken into account even if they overlap. The queries are independent: the string SS actually does not transform into SS' and is the same for all queries.

입력

The first line of the input contains three integers nn, mm and kk denoting the length of SS, the length of TT and the number of queries (1n51041 \leq n \leq 5 \cdot 10^4, 1m1001 \le m \leq 100, 1k51041 \le k \le 5 \cdot 10^4).

The next line contains a string SS consisting of nn lowercase English letters. The following line contains a string TT consisting of mm lowercase English letters.  Each of the remaining kk lines contains a query consisting of two integers LL and RR (1L<Rn1 \leq L < R \leq n).

출력

For each query, print a single line containing a single integer: the answer to the query.