let () =
  let f c1 c2 c3 c4 c5 c6 = c1 + c2*5 + c3*10 + c4*50 + c5*100 + c6*500 in
  let total = Scanf.scanf " %d %d %d %d %d %d\n" f in
  if total >= 1000 then Printf.printf "1\n"
  else Printf.printf "0\n"
;;