It is not clear for me:
x*y*z<10000
OR
abs (matrix[x][y][z])<10000
?
This one correct:abs (matrix[x][y][z])<10000