There are 2 closets with 3 shelves. There are 5 backpacks on each shelve. So you would multiply 2x3=6. then you'd multiply 6x5 since there are 6 shelves in total and there are 5 backpacks on each shelve. which gives you 30 backpacks in total.
The word idea starts with a vowel and the adjective needed shouldn't also end with a vowel. And in this case, you can't use a because it's a vowel. So, you use an.