TECHLN3 - The Revelations

The Aliens were able to figure out how our marks are calculated in NSIT. They have decoded the random number generator of our college. Apparently our fate is decided by 3 numbers 5, 6 and 7.

What our college does is, it takes the roll number of the student, let’s say k. Then it finds the total number of numbers that are made of at least two among 5, 6 and 7 and have k digits. Lets say this number is n.

Then our college calculates our marks by taking mod 100 of this number, n.

Now we know why some people always score good, while others no matter how good their paper went perform bad.

Our fates are bound to our roll numbers.

For example, the two digit numbers following this scheme are: 56, 57, 65, 67, 75, and 76, hence the marks obtained by roll number 2 are 6.

Input

First line of input will contain an integer t, the number of test cases. Following t lines will contain an integer k, 1 per line.

Output

For each test case, calculate the marks obtained and print “PASS” followed by the marks obtained if marks are >= 40, else print “BACK” followed by the marks obtained.

Quotes only for clarity.

Constraints

0 < t <= 1000

2 <= k <= 1000

Example

Input:
3
2
4
6

Output:
BACK 6
PASS 78
BACK 26

Added by:Tarun Gehlaut
Date:2013-04-19
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:CSI NSIT

hide comments
2023-08-17 14:31:02
Samples in task incorrect.

[Simes]: the examples are correct.

Last edit: 2023-08-17 17:00:25
2023-08-17 14:30:06
100%
2018-06-04 20:08:08
Good sequence problem for beginners. Build bruteforce and investigate the results, many easy points in classical can be scored for similar problems.
2013-05-02 11:18:55 bekti galan prasetyo
any annoying testcase please? :)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.