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 and 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 and .
Output:
For each question, print "YES" or "NO", if the number formed by the string between indices and is divisible by 7.
Constraints:
For the first query, number will be which is clearly divisible by 7.