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
d_pawan_kumar: 2016-10-17 09:32:37

use unsigned long long ,long int costed me two WA..simple logic..;)

sam_b: 2016-10-12 13:37:44

long long won't be enough. use unsigned long long. very simple logic

ani_geek9654: 2016-10-11 09:07:35

FORGOT LONG LONG MISSED AC IN ONE :(

hacker_sk: 2016-09-30 11:10:24

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) :)

sas1905: 2016-09-15 00:19:30

changed long long to unsigned long long ..2 WA for taking long long ..:P

pavan507: 2016-09-14 18:52:40

simple logic
AC in one go :)

narutohokage_1: 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.

suraj_: 2016-08-25 18:14:44

AC in one go.....

luc815689327: 2016-08-13 09:02:54

use n>>=1 and go

mishra_sharad: 2016-08-04 19:08:01

long long int is enough..really very simple logic...use your pen n paper...AC in one go...


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