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
blackhorse21: 2015-06-06 14:07:32

i submitted a solution it seems correct but gives runtime error (NZEC) Can one check why?
https://ideone.com/tTP6BW

Aadil Shaharyar Ahmed: 2015-05-26 20:04:17

n:=n/2 what does this mean...... plz nyone explain term by term .....dont really know the use of colon ( ; )

Kushagra Sinha: 2015-05-13 14:20:08

Sometimes ignorance is bliss. Knowing http://en.wikipedia.org/wiki/Collatz_conjecture made me think that the problem is more difficult than it is.

Mayank: 2015-05-06 13:52:10

Same logic but wrong answer in Python and accepted in C..why??

scyth3r: 2015-05-05 21:49:01

2 lines of code....PYTHON_/\_

Deepak sharma: 2015-05-01 00:28:35

easy problem AC in first attempt............

Arpan Mukherjee: 2015-04-28 21:09:03

When I submitted the code I was damn confident It's not the right logic,just let's see what happens. I was just playing.And It got me AC :D
Awesome problem

Abhishek Naik: 2015-04-26 07:41:56

What does NIE and TAK represent? I know it doesn't matter, but still.

ashoka: 2015-04-05 13:22:04

O(1) :D

sarkarshuvojit: 2015-04-01 15:59:53

AC in first attempt :D O(1)


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