Intermediate Algorithm Scripting - Map the Debris (Help With Calculation)

Please help me calculate this.

I don’t know how to calculate the semi-major axis. Please tell me how to calculate it with the average altitude.

The semi major axis is equivalent to the average distance between the two bodies. The Wikipedia page has a nice diagram.