Why my code is not working?

https://www.codepile.net/raw/37wabGYP.js

$submatrix sum sub Query