Sale of Rental Property

I sold a rental property in 2019. Sales price was $40,000. Purchase price was $22617 with $5400 allocated to the land.  We made improvements (assests) while owning in the amount of $17,306. How do I calculate the amount of gain to allocate to Structure, land and improvement assests?