David has 36 apple and pear trees in his gardens. If he plant 4 more apple trees, he will have the same amount of apple and pear trees. How many of each tree does David have before planting more apple trees?