Answer: According to the first 2 formulas, we calculate 1 branch with 5 leaves = 5, 1 worm = 3.
In the third formula, there is 1 worm crawling on the apple, so we have: 3 apples + 1 worm = 30 => 1 apple = 9.
In the last formula, there is a worm crawling on the apple, the tree branch has 6 leaves and also a worm, so the correct answer is: (9 + 3) + (6 + 3) x 3 = 39.