How is the G-cost and F-cost generated in A*

Solution 1:

The G-cost and the H-cost should be set to the maximum value of nodes that can be presented in a grid where the path would be walked through, for example, if we have a 2D Grid which is created by a 2D Array, 50 rows and 50 columns, that would be equal to 2500. So the H-cost and the G-cost should be set to 2500 because that would be the maximum largest path the nodes can walkthrough, this is how I understood it at least. Hope I am correct!