CHNSMKR - Chain Smoker

no tags 

Sam is a chain smoker. But he has his own rules (!) of smoking. He doesn’t smoke less than 24 cigarette a day but not more than 30. The number of cigarette he buys he smokes all of them. And he doesn’t smoke the cigarettes whose price is less than a certain amount. Now his father doesn’t give him lots of money. So he is in financial problem, But a good news for him is if he buys 5 cigarette he will get 1 free. Now he wants to know what is the minimum cost of a cigarette he can smoke. He comes to you and requests to help him.

He gives you the minimum price of a cigarette he smoke ‘X’ and his budget ‘Y’. Now you have to find the minimum price of a cigarette he can smoke by following his own rules(!) and rest money. His concentration is smoke cigarette as many as possible between 24 to 30 in price not less then X. Can you help him?

Input

Input file contains several test cases. Each contains two positive integers X and Y separated by a space (0 < X ≤ 100, 0 < Y ≤ 1000). Input terminates by entering one of any input is zero that should not be processed.

Output

For each line of input print two integer A and B. Where ‘A’(A≥X) is the price of cigarette he can smoke and ‘B’ is the rest money. If it is not possible to fulfil the condition, print “Not Possible”.

Example

Input:
5 201
10 505
50 999
20 999
0 0

Output:
8 1
20 5
Not Possible
39 24

hide comments
Piyush Kumar: 2016-06-22 09:04:55

The description is awful!

Last edit: 2016-06-22 09:05:09
azam_9: 2016-05-25 07:25:16

tutorial stuff...!!isn't it??

fly_sky12: 2016-05-23 08:12:30

thanks for your comment @mehmetin :)

Jitesh: 2016-05-21 21:34:48

shouldn't it be a tutorial ?

Siddharth Singh: 2016-05-17 10:20:06

dont refer to spojtoolkit, the outputs given there are wrong.
and it will lead u to think in the wrong way.!
follow what mehmetin said
Spojtoolkit outputs costed me 1 WA :|

abhi2296: 2016-05-07 13:09:24

Test cases in the spoj toolkit are wrong. Mehmetinal's comment helped!!

naruto09: 2016-05-01 22:47:26

what is the o/p for 10 1000 ?? and why...?

EDIT: finally AC..!! mehmetinal's comment helped a lot..;)

Last edit: 2016-05-03 07:37:04
mehmetin: 2016-05-01 20:31:46

Problem description not good, I solved with :
1. He wants to smoke as many cigarettes as possible (24<=n<= 30).
2. On tie, he wants best quality cigarettes (maximum price).


Added by:Roxy
Date:2016-04-28
Time limit:1s
Source limit:5000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY
Resource:Own