Gamma-ray Excess from a Stacked Sample of High- and Intermediate-frequency Peaked Blazars Observed with the MAGIC Telescope