Maximum cost of a path in a triangle