Pooja's special Cupcake

0

0 votes
Medium
Problem

Pooja wants to buy cupcakes such that the number of cupcakes are divisible by 47 and consists "47" as sub-string, in its decimal representation .

Guess the number of cupcakes upto given N(including N ).

Input Format:

The first line of input consists of an integer T , indicating the number of test cases.
For each test case, there will be an integer N as the description.

Output Format:

For each test case, output an integer indicating number of cupcakes upto given N(including N).

Constraints:

1T104
1N2641

Sample Input
2
123
1234
Sample Output
1
2
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For Test Case 1 : n = 123 , there is only 47 which satisfies the condition.

For Test Case 2 : n = 1234, there are 2 such numbers : 47 , 470

Editor Image

?