Equal substrings#755

Equal substrings

1 second
128 megabytes
Medium (≈1350)

Given a string S = s[1]s[2]...s[n] and a set of queries like (l[1], r[1], l[2], r[2]).

For each query answer whether the substrings s[l1]...s[r1] and s[l2]...s[r2] are equal.

Input

The first line contains the string S, consisting of lowercase Latin letters. This string is non-empty and has a maximum length of 10^5 characters. The second line contains an integer q (1 ≤ q ≤ 50000) - the number of queries. Each of the following q lines contains the numbers l[1], r[1], l[2], r[2] (1 ≤ l[1 ] ≤ r[1] ≤ |S|, 1 ≤ l[2] ≤ r[2] ≤ |S|).

Output

For each query print "+" if the corresponding substrings are equal, and "-" otherwise.

Examples

Example 1

Loading
Loading