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
:-): 2013-04-16 17:56:26

There is a good logic behind this problem

ওয়াসী (Wasi): 2013-04-15 16:17:49

Nice and easy!
I got couple of wrong answers for some stupid mistakes...
Check for 22 it worked for me.

xxx: 2013-04-12 20:54:15

Use Unsigned long long for c/c++ users.....i have changed after 5 wa's...long long did'nt work ....Happy Coding !!

Jagatheesvaran Palanisamy: 2013-03-22 14:31:43

just try this routine for n=0 to 100...u will find the soln

Sivaraman Nagarajan: 2013-02-20 11:59:38

Nothing Big In It

ankitsablok89: 2013-02-07 09:03:19

program culminated in a single line :)

Mukund Kumar: 2013-01-03 07:30:50

my submission id : 8400204
can u plz tell me what z wrong wid my code??it z running till 17th test case

Seshadri R: 2012-12-28 02:52:47

@simon: Operator precedence and order of evaluation

Suyash Garg: 2012-12-17 10:08:56

shortest code ever written :)


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