OpenKattis
popup15 problemsession 1

#### Start

2015-09-25 03:15 AKDT

## popup15 problemsession 1

#### End

2015-09-25 07:45 AKDT
The end is near!
Session is over.
Not yet started.
Session is starting in -1939 days 22:47:32

4:30:00

0:00:00

# Problem ACantor

Georg Cantor (public domain)

The ternary expansion of a number is that number written in base $3$. A number can have more than one ternary expansion. A ternary expansion is indicated with a subscript $3$. For example, $1 = 1_{3} = 0.222\ldots _{3}$, and $0.875 = 0.212121\ldots _{3}$.

The Cantor set is defined as the real numbers between $0$ and $1$ inclusive that have a ternary expansion that does not contain a $1$. If a number has more than one ternary expansion, it is enough for a single one to not contain a $1$.

For example, $0 = 0.000\ldots _{3}$ and $1 = 0.222\ldots _{3}$, so they are in the Cantor set. But $0.875 = 0.212121\ldots _{3}$ and this is its only ternary expansion, so it is not in the Cantor set.

Your task is to determine whether a given number is in the Cantor set.

## Input

The input consists of several test cases, at most $10$.

Each test case consists of a single line containing a number $x$ written in decimal notation, with $0 \le x \le 1$, and having at most $6$ digits after the decimal point.

The last line of input is END. This is not a test case.

## Output

For each test case, output MEMBER if $x$ is in the Cantor set, and NON-MEMBER if $x$ is not in the Cantor set.

Sample Input 1 Sample Output 1
0
1
0.875
END

MEMBER
MEMBER
NON-MEMBER