I hope you do not intend some sort of compounding.
Basically, 3000 per month for 40 years can be calculated by doing some simple maths. So 3000 x 12 to get for a complete year. Which is 36000. NOw we can multiply this value by 40 to get the correct amount. So that is 1440000.
Now five percent of this amount is 5 / 100 x 1440000 = 72000. So the final answer after adding 5 % would be 1512000.