WILLITST - Will it ever stop


When Bob was in library in University of Warsaw he saw on one of facades caption :"Will it ever stop?" and below some mysterious code:

while n > 1
  if n mod 2 = 0 then
    n:=n/2
  else
    n:=3*n+3

Help him finding it out !

Input

In first line one number n<=10^14.

Output

Print "TAK" if program will stop, otherwise print "NIE"

Example

Input:
4

Output:
TAK

hide comments
jeet9: 2018-06-18 15:16:04

Solved at first attempt. There are over 20 test cases!

Marcin: 2018-06-10 07:57:53

What is SIGABRT ? I did not add any abort method to the code.

vritta: 2018-05-31 18:07:48

I honestly believe SPOJ should make the their test cases public. There is very little space for real learning. We should be able to know our mistakes. I believe SPOJ team can do much better.

aman9598: 2018-05-22 16:18:45

only check power of 2 or not

anushka_ahuja: 2018-05-18 08:17:26

use long long int and mod basic maths
ac in one go !!

sharmajatin741: 2018-05-14 16:40:53

bit manipulation...... :)

aakash2509: 2018-05-14 15:18:13

print carefully that TAK and NIE -__- NEI gave me an unnecessarily wrong answer -_-

le9018468: 2018-03-22 03:56:08

Completed in 6 lines of C++ code XD

kamesh11: 2018-03-15 15:05:34

AC in one go!!!

rv111: 2018-03-14 11:51:58

successfully wasted an hour by using NIL against of NIE; but learned a new thing that some people says that their code fails at that test case etc.. so guys it's not that if u get wrong answer after any test case than it might be wrong, it may be your first test case, mine always fails at 20 so it's not that mine first 19 are all correct,


Added by:Krzysztof Lewko
Date:2011-11-09
Time limit:0.906s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:AMPPZ 2011