while input = STDIN.gets
   coins = input.split

   c1   = coins[0].to_i
   c5   = coins[1].to_i * 5
   c10  = coins[2].to_i * 10
   c50  = coins[3].to_i * 50
   c100 = coins[4].to_i * 100
   c500 = coins[5].to_i * 500

   goukei = c1 + c5 + c10 + c50 + c100 + c500

   if goukei >= 1000
     print "1\n"
   else
     print "0\n"
   end
end