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-05-29 02:41:15 Vrian7
very smallest code my code of resolution is 9 lines... :)
2012-05-29 02:39:17 Vrian7
You idea is wrong, for example for 144 is NIE
2012-05-14 12:09:52 Naveen Agarwal


Last edit: 2012-05-19 18:00:28
2012-04-12 22:10:50 *tazo*
It's really easy, but I am still getting the wrong answer :?
"n" is integer right?
2012-04-10 10:11:19 Alex
Easy problem. Took some time until i got it because i did not read the description clearly :)
2012-03-30 08:17:08 motive
can Input be float ???
2012-03-09 09:02:09 Shreya Inamdar
my solution runs fine till 16th test case...but then wa.?!?

changed my algo now.
if you are using python, try to avoid using floating point numbers in the program...they violate some testcases...

Last edit: 2012-03-19 05:47:29
2012-03-04 16:54:55 CryptoViral
easy but see the input size and inputs being given carefully

2012-02-16 20:57:07 Nirwan Dogra
wat to with 0 and 1?
2012-01-28 18:49:04 Abhishek Verma
interesting and easy problem :)
gt ac in first attempt
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.