TD1:=C;
TD2:=IF(TD1=1 AND REF(TD1,-1)=1 AND REF(TD1,-2)=1 AND REF(TD1,-3)=1 AND
REF(TD1,-4)=1 AND REF(TD1,-5)=1 AND REF(TD1,-6)=1 AND REF(TD1,-7)=1 AND
REF(TD1,-8)=1, 1,0);
TD3:=IF(REF(C,-9)>=REF(C,-13),1,0);
TD4:=IF(TD2=1 AND TD3=1,1,0);
TD5:=IF(H>=REF(LLV(L,5),-3),1,0);
D8:=IF(REF(TD4,1)=1 AND TD5=1,1,0);
D9:=IF(TD4=1 AND TD5=1 AND REF(D8,-1)<>1,1,0);
D10:=IF(REF(TD4,-1)=1 AND TD5=1 AND REF(D8,-2)<>1 AND REF(D9,-1)<>1,1,0);
D11:=IF(REF(TD4,-2)=1 AND TD5=1 AND REF(D8,-3)<>1 AND REF(D9,-2)<>1 AND
REF(D10,-1)<>1,1,0);
D12:=IF(REF(TD4,-3)=1 AND TD5=1 AND REF(D8,-4)<>1 AND REF(D9,-3)<>1 AND
REF(D10,-2)<>1 AND REF(D11,-1)<>1,1,0);
D13:=IF(REF(TD4,-4)=1 AND TD5=1 AND REF(D8,-5)<>1 AND REF(D9,-4)<>1 AND
REF(D10,-3)<>1 AND REF(D11,-2)<>1 AND REF(D12,-1)<>1,1,0);
D14:=IF(REF(TD4,-5)=1 AND TD5=1 AND REF(D8,-6)<>1 AND REF(D9,-5)<>1 AND
REF(D10,-4)<>1 AND REF(D11,-3)<>1 AND REF(D12,-2)<>1 AND REF(D13,-1)<>1,1,0);
D15:=IF(REF(TD4,-6)=1 AND TD5=1 AND REF(D8,-7)<>1 AND REF(D9,-6)<>1 AND
REF(D10,-5)<>1 AND REF(D11,-4)<>1 AND REF(D12,-3)<>1 AND REF(D13,-2)<>1 AND
REF(D14,-1)<>1,1,0);
D16:=IF(REF(TD4,-7)=1 AND TD5=1 AND REF(D8,-8)<>1 AND REF(D9,-7)<>1 AND
REF(D10,-6)<>1 AND REF(D11,-5)<>1 AND REF(D12,-4)<>1 AND REF(D13,-3)<>1 AND
REF(D14,-2)<>1 AND REF(D15,-1)<>1,1,0);
D17:=IF(REF(TD4,-8)=1 AND TD5=1 AND REF(D8,-9)<>1 AND REF(D9,-8)<>1 AND
REF(D10,-7)<>1 AND REF(D11,-6)<>1 AND REF(D12,-5)<>1 AND REF(D13,-4)<>1 AND
REF(D14,-3)<>1 AND REF(D15,-2)<>1 AND REF(D16,-1)<>1,1,0);
SETUP:=D8+D9+D10+D11+D12+D13+D14+D15+D16+D17;
TD1:=C;
TD2:=IF(TD1=1 AND REF(TD1,-1)=1 AND REF(TD1,-2)=1 AND REF(TD1,-3)=1 AND
REF(TD1,-4)=1 AND REF(TD1,-5)=1 AND REF(TD1,-6)=1 AND REF(TD1,-7)=1 AND
REF(TD1,-8)=1, 1,0);
TD3:=IF(REF(C,-9)>=REF(C,-13),1,0);
TD4:=IF(TD2=1 AND TD3=1,1,0);
TD5:=IF(H>=REF(LLV(L,5),-3),1,0);
D8:=IF(REF(TD4,1)=1 AND TD5=1,1,0);
D9:=IF(TD4=1 AND TD5=1 AND REF(D8,-1)<>1,1,0);
D10:=IF(REF(TD4,-1)=1 AND TD5=1 AND REF(D8,-2)<>1 AND REF(D9,-1)<>1,1,0);
D11:=IF(REF(TD4,-2)=1 AND TD5=1 AND REF(D8,-3)<>1 AND REF(D9,-2)<>1 AND
REF(D10,-1)<>1,1,0);
D12:=IF(REF(TD4,-3)=1 AND TD5=1 AND REF(D8,-4)<>1 AND REF(D9,-3)<>1 AND
REF(D10,-2)<>1 AND REF(D11,-1)<>1,1,0);
D13:=IF(REF(TD4,-4)=1 AND TD5=1 AND REF(D8,-5)<>1 AND REF(D9,-4)<>1 AND
REF(D10,-3)<>1 AND REF(D11,-2)<>1 AND REF(D12,-1)<>1,1,0);
D14:=IF(REF(TD4,-5)=1 AND TD5=1 AND REF(D8,-6)<>1 AND REF(D9,-5)<>1 AND
REF(D10,-4)<>1 AND REF(D11,-3)<>1 AND REF(D12,-2)<>1 AND REF(D13,-1)<>1,1,0);
D15:=IF(REF(TD4,-6)=1 AND TD5=1 AND REF(D8,-7)<>1 AND REF(D9,-6)<>1 AND
REF(D10,-5)<>1 AND REF(D11,-4)<>1 AND REF(D12,-3)<>1 AND REF(D13,-2)<>1 AND
REF(D14,-1)<>1,1,0);
D16:=IF(REF(TD4,-7)=1 AND TD5=1 AND REF(D8,-8)<>1 AND REF(D9,-7)<>1 AND
REF(D10,-6)<>1 AND REF(D11,-5)<>1 AND REF(D12,-4)<>1 AND REF(D13,-3)<>1 AND
REF(D14,-2)<>1 AND REF(D15,-1)<>1,1,0);
D17:=IF(REF(TD4,-8)=1 AND TD5=1 AND REF(D8,-9)<>1 AND REF(D9,-8)<>1 AND
REF(D10,-7)<>1 AND REF(D11,-6)<>1 AND REF(D12,-5)<>1 AND REF(D13,-4)<>1 AND
REF(D14,-3)<>1 AND REF(D15,-2)<>1 AND REF(D16,-1)<>1,1,0);
SETUP:=D8+D9+D10+D11+D12+D13+D14+D15+D16+D17;