p01722 Fast Division
Ikta loves fast programs. Recently, I'm trying to speed up the division program. However, it doesn't get much faster, so I thought it would be better to make it faster only for "common sense and typical" inputs. The problem Ikta is trying to solve is as follows.

For a given non-negative integer n, divide p (n) − 1-digit positive integer 11 ... 1 by p (n) in decimal notation. However, p (n) represents the smallest prime number larger than 22 {... 2} (n 2). Let p (0) = 2.

Your job is to complete the program faster than Ikta.



Input

The input is given in the following format.


n


Given the non-negative integer n of the input in question.

Constraints

Each variable being input satisfies the following constraints.

* 0 ≤ n <1000

Output

Print the solution to the problem on one line.

Examples

Input

0


Output

1


Input

1


Output

2


Input

2


Output

1
```python
# p(n) = 2^^n より大きい最小の素数 (ただし^^はクヌースの二重矢印記号) と定義したとき、
# x = (10^(p(n)-1)-1)/9 (mod p(n)) を求めよ
# 「フェルマーの小定理」
# pが素数ならば、a^p == a (mod p(n))
# とくに、aとpが互いに素 (gcd(a,p)=1) のとき
# a^p * a^-1 == a * a^-1 (mod p(n))
# a^(p-1) == 1 (mod p)
#
# 9とp(n)が互いに素ならば
# x * 9^-1 = 10^(p(n)-1)-1 (mod p(n))
# 10とp(n)が互いに素ならば
# 10^(p(n)-1) = 1 (mod p(n))
# ゆえに
# x * 9^-1 = 0 (mod p(n))
# p(n)は素数であるから、p(n)>10のとき9とp(n)および10とp(n)は互いに素でありx=0
n = int(input())
if n == 0:
    # 1 mod 2
    print(1)
elif n == 1:
    # 11 mod 3
    print(2)
elif n == 2:
    # 111 mod 5
    print(1)
else:
    print(0)
```