This program solves the Drainage Basin problem posed here.