Suppose that I have an unlimited supply of identical math books, history books, and physics books.  All are the same size, and I have room on a shelf for 8 books.  In how many ways can I arrange eight books on the shelf if no two books of the same type can be adjacent?

Let's think step by step and output the final answer within \boxed{}.
user