# Piecewise Functions - 7

**Algebra**Level 4

\[f(x) = \begin{cases} x^4 + 6x^3 -5x^2 -42x+40 & \text{if } x \leq a

\\ \\ \frac{x}{2\pi} + \sin x& \text{if } x > a \end{cases}\]

Let a function \(f : \mathbb{R} \rightarrow \mathbb{R}\) be defined as above. As \(a\) varies over all real numbers, the maximum number of distinct real roots of \(f(x) = 0\) are \(N\).

Let \(a_1, a_2, a_3, \ldots a_n\) be the integer values of \(a\) for which \(f(x) = 0\) has \(N\) distinct real roots.

Evaluate \(\displaystyle\sum_{i=1} ^{n} a_i\).

Note: If you think there are no values of \(a\) satisfying the conditions, enter your answer as 999.

This problem is part of the set - Piecewise-defined Functions