say there's 4 different books (n), and there are 3 copies of each book (p).
then there's 4 x 3 books in total
and so you are arranging 12 books in a line (np)!, however to account for overcounting divide by 3! for each type of book. (so (p!)^n)
for part 2, each book can either be borrowed, with p possibilities for which book to be borrowed, or not borrowed (1 possibility) so each book there is (p+1) ways to select a book. this is multiplied together n times for each different book, however subtract 1 for the possibility that no books are borrowed