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

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
2013-07-05 11:17:49 orange
@ Erti-Chris Eelmaa yes!! there is formula for this.
2013-07-02 13:39:23 fdfdfwgwg
mine shows nzec after 20 cases- http://ideone.com/sKblYc

any suggestions?

Last edit: 2013-07-02 13:41:14
2013-06-29 20:09:39 ganpya
this is the case of repetition..use map and plz use unsigned long long...long long wont work

Got AC

Last edit: 2013-06-29 20:10:03
2013-06-21 21:55:07 « sudipto »
lolzz.. got wa coz of printing NEI in place of NIE... AC;)
2013-06-21 18:56:15 Vipul Pandey
long long int will work, no need of unsigned long long.
2013-06-12 06:47:40 Prikshit Kumar
Easy Problem.
Got AC at first attempt..:)
2013-06-03 08:03:14 Erti-Chris Eelmaa
3 minutes, really easy exercise. though I believe there should be formula that can do this without loop?
2013-05-17 12:27:08 Noob
long long worked for me C/C++
2013-04-16 17:56:26 :-)
There is a good logic behind this problem
2013-04-15 16:17:49 ওয়াসী (Wasi)
Nice and easy!
I got couple of wrong answers for some stupid mistakes...
Check for 22 it worked for me.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.