import Control.Applicative ((<$>), (<*>))
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B

import Data.Bool (bool)
import Data.List (unfoldr, foldl')
import Data.Char (isSpace)

main :: IO ()
main = solve <$> f <*> f <*> f >>= mapM_ print
  where f = readil B.readInt <$> B.getLine

solve :: [Int] -> [Int] -> [Int] -> [Int]
solve [n, _, _] as qs = let bs = snd $ foldl' f (n, [0 .. n-1]) as
                        in map (bool 0 1 . flip elem bs) qs
  where f (l, xs) a | even a = let (ys, (_:zs)) = splitAt (a `mod` l) xs in (l-1, zs ++ ys)
                    | otherwise = let (ys, (_:zs)) = splitAt ((l - a) `mod` l) xs in (l-1, zs ++ ys)

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr g
  where
    g s = do
      (n, s') <- f s
      return (n, B.dropWhile isSpace s')

