An equilibrium index of a sequence is an index into the sequence such that the sum of elements at lower indices is equal to the sum of elements at higher indices.



For example, in a sequence   



A


{\displaystyle A}

:

   




A

0


=
−
7


{\displaystyle A_{0}=-7}


   




A

1


=
1


{\displaystyle A_{1}=1}


   




A

2


=
5


{\displaystyle A_{2}=5}


   




A

3


=
2


{\displaystyle A_{3}=2}


   




A

4


=
−
4


{\displaystyle A_{4}=-4}


   




A

5


=
3


{\displaystyle A_{5}=3}


   




A

6


=
0


{\displaystyle A_{6}=0}


3   is an equilibrium index, because:

   




A

0


+

A

1


+

A

2


=

A

4


+

A

5


+

A

6




{\displaystyle A_{0}+A_{1}+A_{2}=A_{4}+A_{5}+A_{6}}


6   is also an equilibrium index, because:

   




A

0


+

A

1


+

A

2


+

A

3


+

A

4


+

A

5


=
0


{\displaystyle A_{0}+A_{1}+A_{2}+A_{3}+A_{4}+A_{5}=0}


(sum of zero elements is zero)

7   is not an equilibrium index, because it is not a valid index of sequence 



A


{\displaystyle A}

.



Task;
Write a function that, given a sequence, returns its equilibrium indices (if any).

Assume that the sequence may be very long.




@echo off
setlocal enabledelayedexpansion
 
call :equilibrium-index "-7 1 5 2 -4 3 0"
call :equilibrium-index "2 4 6"
call :equilibrium-index "2 9 2"
call :equilibrium-index "1 -1 1 -1 1 -1 1"
pause>nul
exit /b
 
	%== The Function ==%
:equilibrium-index <sequence with quotes>
	::Set the pseudo-array sequence...
set "seq=%~1"
set seq.length=0
for %%S in (!seq!) do (
	set seq[!seq.length!]=%%S
	set /a seq.length+=1
)
	::Initialization of other variables...
set "equilms="
set /a last=seq.length - 1
	::The main checking...
for /l %%e in (0,1,!last!) do (
	set left=0
	set right=0
 
	for /l %%i in (0,1,!last!) do (
		if %%i lss %%e (set /a left+=!seq[%%i]!)
		if %%i gtr %%e (set /a right+=!seq[%%i]!)
	)
	if !left!==!right! (
		if defined equilms (
			set "equilms=!equilms! %%e"
		) else (
			set "equilms=%%e"
		)
	)
)
echo [!equilms!]
goto :EOF
	%==/The Function ==%