p01722 Fast Division_28497
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
# 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)
0 1 2 3 001 000 6 4 10 5 7 17 11 12 18 9 35 15 8 29 14 41 27 62 30 25 42 58 21 83 98 178 209 375 51 79 65 28 16 22 20 36 13 43 45 26 56 38 39 24 61 37 112 32 34 67 76 143 93 277 164 177 50 127 44 84 19 31 63 53 49 48 57 198 52 40 81 126 152 104 388 69 89 99 71 66 23 33 148 85 86 82 60 90 135 46 102 186 205 134 75 119 97
1 2 1 0
 2
 1
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
