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

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

hide comments
2012-01-28 18:49:04 Abhishek Verma
interesting and easy problem :)
gt ac in first attempt
2012-01-24 14:21:51 (^@_^@)
smallest code i have ever written in spoj
& got accepted
2012-01-03 18:02:16 ramaravind
what is the mistake in my code???i checked the divisibility of
n by 2 and 3 ...


Last edit: 2012-01-03 18:03:47
2011-12-26 15:03:17 xyz
hey i am getting wa .. using logic of odd and even number.. is there more test case..

Last edit: 2011-12-26 15:03:48
2011-12-13 10:55:42 Devil D
Smallest code i have ever written :)
2011-11-20 16:17:41 LeppyR64
Read the problem statement it explains clearly what to do for 0 and 1.
2011-11-19 22:42:12 Gaith Hallak
if (n = 1) or (n = 0) what the answer should be ?
2011-11-19 12:30:19 mukesh tiwari
Nice problem

Last edit: 2011-11-19 16:16:32
2011-11-16 12:07:38 Jeevan K. S. Chalam
easy one.. thanks Krzysztof Lewko
2011-11-15 13:33:55 deepa
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
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.