Rhezo is obsessed with the number 7 and likes numbers that are divisible by 7.
He has a big number of N digits and Q questions. In each of the question, he wants to find if the number formed by the string between indices Li and Ri is divisible by 7 or not. As he is very weak at programming, you should help him in this task.
Input:
First line contains the number consisting of N digits. Next line contains Q, denoting the number of questions. Each of the next Q lines contains 2 integers Li and Ri.
Output:
For each question, print "YES" or "NO", if the number formed by the string between indices Li and Ri is divisible by 7.
Constraints:
1≤N≤105
1≤Q≤105
1≤Li,Ri≤N
For the first query, number will be 35 which is clearly divisible by 7.