main :: IO ()
main = do
  ls <- getLine
  print $ solve (map read (words ls))

solve :: [Int] -> Int
solve [c1,c5,c10,c50,c100,c500]
  | c1 + 5*c5 + 10*c10 + 50*c50 + 100*c100 + 500*c500 >= 1000 = 1
  | otherwise = 0