cls :locate 10,5
input zz
290: for i=1 to n
if a(i)<100 then t(b(i)-100)=hi(a(i))+h(i):goto 340
if b(i)<100 then t(a(i)-100)=hi(b(i))-h(i):goto 340
if t(a(i)-100)<>0 then t(b(i)-100)=t(a(i)-100)+h(i):goto 340
if t(b(i)-100)<>0 then t(a(i)-100)=t(b(i)-100)-h(i):goto 340
s=1
340: next i
if s=1 then s=0: goto 290
for i=1 to nj:if t(i)=0 then print "T("i")=0":stop
next i