class Shield:

  def __init__(self):
    self.s2 = 0
    self.s1 = 0
    self.s0 = 0

  def tick(self, inputs):
    sensor_right = inputs[0]
    sensor_down = inputs[1]
    sensor_left = inputs[2]
    sensor_up = inputs[3]
    b = inputs[4]
    o3_1 = inputs[5]
    o2_1 = inputs[6]
    o1_1 = inputs[7]
    s2 = self.s2
    s1 = self.s1
    s0 = self.s0

    tmp9 = (1 - (1 if o1_1 else 0))
    tmp8 = (1 if o3_1 else tmp9)
    tmp7 = (tmp8 if sensor_up else 0)
    tmp13 = (1 if o1_1 else 0)
    tmp12 = (1 - (tmp13 if o2_1 else 0))
    tmp11 = (1 if o3_1 else tmp12)
    tmp10 = (1 if sensor_up else tmp11)
    tmp6 = (tmp7 if sensor_right else tmp10)
    tmp5 = (tmp6 if sensor_left else tmp10)
    tmp18 = (1 if o2_1 else tmp9)
    tmp17 = (1 if o3_1 else tmp18)
    tmp16 = (1 - (tmp17 if sensor_up else tmp8))
    tmp15 = (1 if sensor_right else tmp16)
    tmp14 = (1 - (tmp15 if sensor_left else tmp16))
    tmp4 = (tmp5 if sensor_down else tmp14)
    tmp22 = (tmp8 if sensor_up else tmp11)
    tmp21 = (tmp22 if sensor_right else tmp10)
    tmp20 = (tmp21 if sensor_left else tmp10)
    tmp23 = (tmp17 if sensor_up else tmp8)
    tmp19 = (tmp20 if sensor_down else tmp23)
    tmp3 = (tmp4 if b else tmp19)
    tmp2 = (1 if s0 else tmp3)
    tmp1 = (1 - (tmp2 if s1 else tmp19))
    o1__s = tmp1
    tmp30 = (1 if o2_1 else 0)
    tmp29 = (tmp30 if sensor_up else 1)
    tmp34 = (1 if o1_1 else 0)
    tmp33 = (1 - (tmp34 if o2_1 else 0))
    tmp32 = (1 if o3_1 else tmp33)
    tmp31 = (1 - (1 if sensor_up else tmp32))
    tmp28 = (tmp29 if sensor_right else tmp31)
    tmp35 = (1 if sensor_right else tmp30)
    tmp27 = (tmp28 if sensor_left else tmp35)
    tmp37 = (1 if sensor_up else tmp32)
    tmp41 = (1 - (1 if o1_1 else 0))
    tmp40 = (1 if o2_1 else tmp41)
    tmp39 = (1 if o3_1 else tmp40)
    tmp38 = (1 - (tmp39 if sensor_right else tmp30))
    tmp36 = (1 - (tmp37 if sensor_left else tmp38))
    tmp26 = (tmp27 if sensor_down else tmp36)
    tmp47 = (1 - (1 if o2_1 else 0))
    tmp46 = (1 if o3_1 else tmp47)
    tmp45 = (tmp46 if sensor_up else tmp32)
    tmp44 = (tmp45 if sensor_right else tmp37)
    tmp43 = (tmp44 if sensor_left else tmp46)
    tmp48 = (tmp37 if sensor_left else tmp46)
    tmp42 = (1 - (tmp43 if sensor_down else tmp48))
    tmp25 = (tmp26 if b else tmp42)
    tmp24 = (tmp25 if s1 else tmp42)
    o2__s = tmp24
    tmp55 = (1 if o3_1 else 0)
    tmp58 = (1 if o1_1 else 0)
    tmp57 = (1 - (tmp58 if o2_1 else 0))
    tmp56 = (1 if o3_1 else tmp57)
    tmp54 = (tmp55 if sensor_up else tmp56)
    tmp53 = (tmp54 if sensor_right else tmp55)
    tmp61 = (1 - (1 if o2_1 else 0))
    tmp60 = (1 if o3_1 else tmp61)
    tmp59 = (tmp60 if sensor_right else tmp55)
    tmp52 = (tmp53 if sensor_left else tmp59)
    tmp67 = (1 - (1 if o1_1 else 0))
    tmp66 = (1 if o2_1 else tmp67)
    tmp65 = (1 if o3_1 else tmp66)
    tmp68 = (1 if o3_1 else tmp67)
    tmp64 = (tmp65 if sensor_up else tmp68)
    tmp63 = (tmp64 if sensor_right else tmp55)
    tmp71 = (1 - (1 if o2_1 else tmp58))
    tmp70 = (1 if o3_1 else tmp71)
    tmp69 = (tmp70 if sensor_right else tmp55)
    tmp62 = (tmp63 if sensor_left else tmp69)
    tmp51 = (1 - (tmp52 if sensor_down else tmp62))
    tmp50 = (1 if b else tmp51)
    tmp49 = (1 - (tmp50 if s1 else tmp51))
    o3__s = tmp49
    recovery__s = 0
    tmp79 = (1 if o3_1 else 0)
    tmp82 = (1 if o1_1 else 0)
    tmp81 = (1 - (tmp82 if o2_1 else 0))
    tmp80 = (1 if o3_1 else tmp81)
    tmp78 = (tmp79 if sensor_up else tmp80)
    tmp85 = (1 if o2_1 else tmp82)
    tmp84 = (1 if o3_1 else tmp85)
    tmp88 = (1 - (1 if o1_1 else 0))
    tmp87 = (1 - (tmp82 if o2_1 else tmp88))
    tmp86 = (1 if o3_1 else tmp87)
    tmp83 = (tmp84 if sensor_up else tmp86)
    tmp77 = (tmp78 if sensor_right else tmp83)
    tmp92 = (tmp82 if o2_1 else 1)
    tmp91 = (1 if o3_1 else tmp92)
    tmp94 = (1 - (1 if o2_1 else 0))
    tmp93 = (1 if o3_1 else tmp94)
    tmp90 = (tmp91 if sensor_up else tmp93)
    tmp96 = (1 if o3_1 else tmp82)
    tmp98 = (1 - (1 if o2_1 else tmp88))
    tmp97 = (1 if o3_1 else tmp98)
    tmp95 = (tmp96 if sensor_up else tmp97)
    tmp89 = (tmp90 if sensor_right else tmp95)
    tmp76 = (tmp77 if sensor_left else tmp89)
    tmp103 = (1 if o2_1 else tmp88)
    tmp102 = (1 if o3_1 else tmp103)
    tmp104 = (1 if o3_1 else tmp88)
    tmp101 = (tmp102 if sensor_up else tmp104)
    tmp107 = (1 if o2_1 else 0)
    tmp106 = (1 if o3_1 else tmp107)
    tmp109 = (1 - (tmp82 if o2_1 else 1))
    tmp108 = (1 if o3_1 else tmp109)
    tmp105 = (tmp106 if sensor_up else tmp108)
    tmp100 = (tmp101 if sensor_right else tmp105)
    tmp113 = (tmp82 if o2_1 else tmp88)
    tmp112 = (1 if o3_1 else tmp113)
    tmp115 = (1 - (1 if o2_1 else tmp82))
    tmp114 = (1 if o3_1 else tmp115)
    tmp111 = (tmp112 if sensor_up else tmp114)
    tmp118 = (tmp82 if o2_1 else 0)
    tmp117 = (1 if o3_1 else tmp118)
    tmp116 = (tmp117 if sensor_up else tmp79)
    tmp110 = (tmp111 if sensor_right else tmp116)
    tmp99 = (tmp100 if sensor_left else tmp110)
    tmp75 = (tmp76 if sensor_down else tmp99)
    tmp123 = (tmp85 if o3_1 else 0)
    tmp124 = (tmp85 if o3_1 else tmp81)
    tmp122 = (tmp123 if sensor_up else tmp124)
    tmp126 = (tmp85 if o3_1 else tmp87)
    tmp125 = (tmp85 if sensor_up else tmp126)
    tmp121 = (tmp122 if sensor_right else tmp125)
    tmp129 = (tmp85 if o3_1 else tmp92)
    tmp130 = (tmp85 if o3_1 else tmp94)
    tmp128 = (tmp129 if sensor_up else tmp130)
    tmp132 = (tmp85 if o3_1 else tmp82)
    tmp133 = (tmp85 if o3_1 else tmp98)
    tmp131 = (tmp132 if sensor_up else tmp133)
    tmp127 = (tmp128 if sensor_right else tmp131)
    tmp120 = (tmp121 if sensor_left else tmp127)
    tmp137 = (tmp85 if o3_1 else tmp103)
    tmp138 = (tmp85 if o3_1 else tmp88)
    tmp136 = (tmp137 if sensor_up else tmp138)
    tmp140 = (tmp85 if o3_1 else tmp107)
    tmp141 = (tmp85 if o3_1 else tmp109)
    tmp139 = (tmp140 if sensor_up else tmp141)
    tmp135 = (tmp136 if sensor_right else tmp139)
    tmp144 = (tmp85 if o3_1 else tmp113)
    tmp145 = (tmp85 if o3_1 else tmp115)
    tmp143 = (tmp144 if sensor_up else tmp145)
    tmp147 = (tmp85 if o3_1 else tmp118)
    tmp146 = (tmp147 if sensor_up else tmp123)
    tmp142 = (tmp143 if sensor_right else tmp146)
    tmp134 = (tmp135 if sensor_left else tmp142)
    tmp119 = (tmp120 if sensor_down else tmp134)
    tmp74 = (tmp75 if b else tmp119)
    tmp73 = (1 - (tmp74 if s1 else tmp119))
    tmp72 = (1 - (1 if s2 else tmp73))
    s2n = tmp72
    tmp155 = (1 if o3_1 else 0)
    tmp158 = (1 if o1_1 else 0)
    tmp157 = (1 - (tmp158 if o2_1 else 0))
    tmp156 = (1 if o3_1 else tmp157)
    tmp154 = (tmp155 if sensor_up else tmp156)
    tmp153 = (tmp154 if sensor_right else tmp155)
    tmp161 = (1 - (1 if o2_1 else 0))
    tmp160 = (1 if o3_1 else tmp161)
    tmp159 = (tmp160 if sensor_right else tmp155)
    tmp152 = (tmp153 if sensor_left else tmp159)
    tmp167 = (1 - (1 if o1_1 else 0))
    tmp166 = (1 if o2_1 else tmp167)
    tmp165 = (1 if o3_1 else tmp166)
    tmp168 = (1 if o3_1 else tmp167)
    tmp164 = (tmp165 if sensor_up else tmp168)
    tmp163 = (tmp164 if sensor_right else tmp155)
    tmp171 = (1 - (1 if o2_1 else tmp158))
    tmp170 = (1 if o3_1 else tmp171)
    tmp169 = (tmp170 if sensor_right else tmp155)
    tmp162 = (tmp163 if sensor_left else tmp169)
    tmp151 = (tmp152 if sensor_down else tmp162)
    tmp150 = (tmp151 if b else 0)
    tmp149 = (1 - (tmp150 if s0 else 0))
    tmp148 = (1 - (1 if s1 else tmp149))
    s1n = tmp148
    tmp179 = (1 if o3_1 else 0)
    tmp182 = (1 if o1_1 else 0)
    tmp181 = (1 - (tmp182 if o2_1 else 0))
    tmp180 = (1 if o3_1 else tmp181)
    tmp178 = (tmp179 if sensor_up else tmp180)
    tmp177 = (tmp178 if sensor_right else tmp179)
    tmp185 = (1 - (1 if o2_1 else 0))
    tmp184 = (1 if o3_1 else tmp185)
    tmp183 = (tmp184 if sensor_right else tmp179)
    tmp176 = (tmp177 if sensor_left else tmp183)
    tmp191 = (1 - (1 if o1_1 else 0))
    tmp190 = (1 if o2_1 else tmp191)
    tmp189 = (1 if o3_1 else tmp190)
    tmp192 = (1 if o3_1 else tmp191)
    tmp188 = (tmp189 if sensor_up else tmp192)
    tmp187 = (tmp188 if sensor_right else tmp179)
    tmp195 = (1 - (1 if o2_1 else tmp182))
    tmp194 = (1 if o3_1 else tmp195)
    tmp193 = (tmp194 if sensor_right else tmp179)
    tmp186 = (tmp187 if sensor_left else tmp193)
    tmp175 = (tmp176 if sensor_down else tmp186)
    tmp174 = (1 - (tmp175 if b else 0))
    tmp173 = (1 if s0 else tmp174)
    tmp172 = (1 - (1 if s1 else tmp173))
    s0n = tmp172

    self.s2 = s2n
    self.s1 = s1n
    self.s0 = s0n

    return [ o3__s, o2__s, o1__s, recovery__s]
