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
2016-10-12 13:37:44
long long won't be enough. use unsigned long long. very simple logic
2016-10-11 09:07:35
FORGOT LONG LONG MISSED AC IN ONE :(
2016-09-30 11:10:24 hacker_sk
n will be given always greater than 1 i.e. n >1, No need to worry about this. It's very easy of O(1) :)
2016-09-15 00:19:30
changed long long to unsigned long long ..2 WA for taking long long ..:P
2016-09-14 18:52:40
simple logic
AC in one go :)
2016-09-04 00:42:23
DO NOT LOOK AT COMMENT . THEY ONLY MAKE IT TOUGH FOR YOU. JUST USE YOUR OWN APPROACH AND SOLVE IT. THINK AND YOU WILL THEN FIND THE ANSWER. BUT IF YOU LOOK AT COMMENT . IT WOULD LOOK HARD.
2016-08-25 18:14:44
AC in one go.....
2016-08-13 09:02:54
use n>>=1 and go
2016-08-04 19:08:01
long long int is enough..really very simple logic...use your pen n paper...AC in one go...
2016-07-31 07:48:01
AC in one go!!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.