Suppose the factory makes n hard drives, then A makes 80% of n=0.8n (but 10% of 0.8n=0.08n are defective) while B makes 20% of n=0.2n (but 5% of 0.2n=0.01n are defective).
So there are 0.09n defective hard drives. 0.08n of these come from A and just 0.01n from B.