main = readLn >>= return . dp [] >>= print

dp :: [Int] -> Int -> Int
dp xs x | xs_size == x+1 = head xs
        | xs_size == 0 = dp ([1]++xs) x
        | xs_size < 100 = dp ([0] ++ xs) x
        | xs_size <= 105 = dp ([1] ++ xs) x
        | (xs !! 99 == 1) || (xs !! 100 == 1) ||
          (xs !! 101 == 1) || (xs !! 102 == 1) ||
          (xs !! 103 == 1) || (xs !! 104 == 1) = dp ([1] ++ xs) x
        | otherwise = dp ([0] ++ xs) x
  where xs_size = length xs