Solve problem with Greedy Dwarf Task

Thanks to Nikolai Nikolov