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
2015-03-03 10:20:57 Bala Vignesh [Inactive]
very funny!
2015-03-01 13:45:16 :.Mohib.:
lolzzz....!!!
2015-02-10 10:29:34 Priyansh Saxena
BITWISE does the trick in O(1).
2014-08-19 15:27:53 Richa Jain
changed long long to unsigned long long and got AC :)
2014-06-27 04:27:24 santhosh reddy
Nice problem!!
2013-08-06 17:33:15 VIVEK GARG
ha....easy problem......but shd use long long int.
2013-07-20 18:50:31 pika_pika
instead of using math functions use simple loop to avoid any floating point calculations as stated previously
2013-07-10 17:49:11 priyanghadevi
just a simple twist..:-)
really nyc qn


Last edit: 2013-07-10 17:49:58
2013-07-05 11:23:12 orange
tricky input
0 and 1
2013-07-05 11:20:58 orange
used loop >>ac
then for fun
used ceil>>wa 6 times
ridiculous!!!!! wasted my time for fun !!
then
used floor >>ac again



Last edit: 2013-07-05 11:25:29
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.