Let $M$ be the maximum possible value of $x_1x_2+x_2x_3+\cdots +x_5x_1$ where $x_1, x_2, \dots, x_5$ is a permutation of $(1,2,3,4,5)$ and let $N$ be the number of permutations for which this maximum is attained. Evaluate $M+N$.
What's a permutation? A permutation is a way of arranging a number of objects without regard to the order. So there are 5 objects, the numbers 1, 2, 3, 4, and 5, and we can arrange them in $5!$ ways. Right, but that's not what the question is asking. The question is asking us to look at all of the different sums we can make by multiplying the numbers in a certain order and then add them all up. Oh, so we can take the sum of the first two, then the sum of the next two, and then the sum of the last two. Right. And for example, if we had the arrangement $1, 2, 3, 4, 5$, then the sum would be $1 \cdot 2 + 2 \cdot 3 + 3 \cdot 4 + 4 \cdot 5 + 5 \cdot 1$. So we just need to try all of the different arrangements and see which one has the biggest sum. Right, so we want to find the maximum of all those possible sums. But how do we do that? There are a lot of different sums. Well, let's think about it. Which arrangements will give us the biggest sum? Yeah, so we want 5 and 4 to be multiplied with each other. So we want to arrange the numbers so that 3 is next to 5. So we want to arrange the numbers so that 2 is next to 4. So we have $(2,4,5,3)$. But we could also arrange them as $(2,5,4,3)$. So we want to arrange the numbers so that 1 is next to 3. Then we have $(1,3,5,4,2)$. So the maximum possible value is $1 \cdot 3 + 3 \cdot 5 + 5 \cdot 4 + 4 \cdot 2 + 2 \cdot 1 = 3 + 15 + 20 + 8 + 2 = 48$. Right, so $M = 48$. But how do we find $N$? Well, how many ways can we arrange the numbers so that 1 is next to 3, 3 is next to 5, and 2 is next to 4? So we have 5 ways to arrange the numbers so that the sum is 48. So $N = 5$. So for $(1,3,5,4,2)$, we also have $(2,4,5,3,1)$ Right, so we actually have 10 ways to arrange the numbers so that the sum is 48. So $N = 10$. So $M+N = 48 + 10 = 58$.

