Exact solution of a stochastic directed sandpile model