Problem Description

Read a string s (lowercase) and q queries l r (1-based). Use helper function to build prefix hashes and answer hash values mod 1000000007.

Input Format

Line1: s. Line2: q. Next q lines: l r.

Output Format

q lines hash.

Sample Test Case

Input:
abcd 2 1 2 2 4
Output:
404084813 756964949

Constraints

len(s),q

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next