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 ≤ 1014.

Output

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

Example

Input:
4

Output:
TAK

hide comments
Devil D: 2011-12-13 10:55:42

Smallest code i have ever written :)

LeppyR64: 2011-11-20 16:17:41

Read the problem statement it explains clearly what to do for 0 and 1.

Gaith Hallak: 2011-11-19 22:42:12

if (n = 1) or (n = 0) what the answer should be ?

mukesh tiwari: 2011-11-19 12:30:19

Nice problem

Last edit: 2011-11-19 16:16:32
Jeevan K. S. Chalam: 2011-11-16 12:07:38

easy one.. thanks Krzysztof Lewko

deepa: 2011-11-15 13:33:55

help me out!!! i have a logic anyone tell me whether it is correct or not...

Yes Your Logic is Correct...

Last edit: 2011-11-16 08:30:57
Krzysztof Lewko: 2011-11-14 23:19:59

There's only one number, please read input statement.

Supan Shah: 2011-11-13 05:15:29

i am getting WA .are there any special cases to be considered ?
and there will be only one number or its till EOF ??


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