read N
read A

for ((i=1; i<=${N}; i++)); do
    echo $A | sed -e "s/[-]*[0-9]\+//$i" -e "s/[-]*[0-9]\+/\0)) \$((\0 -/g" -e "s/^/echo \$((0 - /" -e "s/$/ 0))/" | sh | sed -e "s/-//g" -e "s/ /\+/g" -e "s/^/echo \$((/" -e "s/$/))/" | sh
done
