Construct N solution codechef

Construct N solution codechef

You are given an integer NN. Find if it is possible to represent NN as the sum of several(possibly zero) 22‘s and several(possibly zero) 77‘s.

Formally, find if there exist two integers X,Y (X,Y0)X,Y (X,Y≥0) such that 2X+7Y=N2⋅X+7⋅Y=N.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of a single line containing an integer NN.

Output Format

For each test case, print on a new line YES if it is possible to represent NN as the sum of several(possibly zero) 22‘s and several(possibly zero) 77‘s and NO otherwise.

You may print each character of the string in either uppercase or lowercase (for example, the strings yEsyesYes, and YES will all be treated as identical).

Constraints

  • 1T10001≤T≤1000
  • 1N1081≤N≤108

Sample Input 1 

4
2
5
7
11

Sample Output 1 

YES
NO
YES
YES

Explanation

Test case 11: 21+70=22⋅1+7⋅0=2.

Test case 22: It is impossible to express 55 as a sum of several 22‘s and 77‘s.

Test case 33: 20+71=72⋅0+7⋅1=7.

Test case 44: 22+71=112⋅2+7⋅1=11.

Leave a Comment

Your email address will not be published.