You have to pay attention to whether or not the balloons are going up or down.
The first balloon
The first balloon is going down. You have to subtract the speed times the number of minutes (m)
speed = 40 feet / minute
time = m minutes.
Starting position: 3000 feet
equation h = 3000 - 40 * m
Second balloon
The second balloon is going up.
speed 50 feet / minute The sign of this speed must be + if the other speed is minus
time: m minutes
starting position: 1200 feet
Formula
h = 12 + 50 m
You can read which system of equations gives the results I've given you.