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
gourav: 2012-10-17 14:42:19

18th :)

rathor ashu: 2012-10-02 20:48:19

Same Algo c => NZEC. C++ => AC

Vikas Kushwaha: 2012-09-27 18:25:03

easy one :)

Omar Simón Francisco Prieto Chacón - osfprieto: 2012-09-17 22:16:48

Is it just one input number or several test cases?

Vrian7: 2012-09-08 10:18:29

@:) It is pascal, this is not c++ or java..

code warrior: 2012-09-07 18:23:44

how to operate on such a large numbers.
declaring string of such length is not allowed..
suggesstions r welcomed

piyush agarwal: 2012-08-15 15:18:14

any hint please..i m getting wa again n again...or any tricky case!!

Broken_Sword: 2012-07-19 07:42:31

whats the output for 0 and 1 ?

Aditya: 2012-07-07 21:00:25

HInt is, if 3 is muliplied to any number , can it be then expressed in the form 2^k ?no..


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