Problem 42639. Find the Final State of an Abelian Sandpile

Let us define an Abelian sand pile as a matrix that is only in a stable and final state when all of its elements are less than 4. When any of its elements is greater than 4, distribute four sand grains, one each to the elements above, below, to the left, and to the right of the offending element. Continue doing this until the matrix is stable.

So

0 0 0
0 4 1
1 0 0

would become

0 1 0
1 0 2
1 1 0

because the 4 in the middle is unstable and gets distributed.

What makes this process Abelian is that the order in which you distribute the "sand grains" doesn't matter. This gives you considerable algorithmic freedom.