finished max path sum problem