The system of partial differential equationsarises in the analysis of mathematical models for sandpile growth and in the context of the Monge-Kantorovich optimal mass transport theory. A representation formula for the solutions of a related boundary value problem is here obtained, extending the previous two-dimensional result of the first two authors to arbitrary space dimension. An application to the minimization of integral functionals of the formwith f ≥ 0, and h ≥ 0 possibly non-convex, is also included.