A regularity result for the solution of the dam problem