Please understand direct cost is cost which is directly related to production process. Since the Advertisement cost is incurred after production stage and it is not direclty related to production and hence classified as indirect cost.
If expenditure incurred only on product A is given in the question then it does not mean that the cost is a direct cost. It is just for apportionment of such cost to Product A only.