
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
There are 8 different books, including 3 math books, 3 foreign language books, and 2 literature books. If these books are arranged in a row on a bookshelf, in how many ways can the arrangement be made such that all math books are together and all foreign language books are also together?

Present the answer in LaTex format: \boxed{Your answer}
user