This might be a dumb question but. How do you know whether a reaction undergoes malonic ester substitution or acetoacetic ester substitution? Don't they have the same reagents? How would you know whether you produce a carboxylic acid or a methyl ketone?