Let $a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8$ be real numbers which satisfy
\[ S_3=S_{11}=1, \quad S_7=S_{15}=-1, \quad\text{and}\quad
S_5 = S_9 = S_{13} = 0, \quad \text{where}\quad S_n = \sum_{\substack{1 \le i < j \le 8 \\ i+j = n}} a_ia_j. \]
(For example, $S_5 = a_1a_4 + a_2a_3$.)
Assuming $|a_1|=|a_2|=1$, the maximum possible value of $a_1^2 + a_2^2 + \dots + a_8^2$ can be written as $a+\sqrt{b}$ for integers $a$ and $b$. Compute $a+b$.

[i]Based on a proposal by Nathan Soedjak[/i]
Given the conditions:
\[ S_3 = S_{11} = 1, \quad S_7 = S_{15} = -1, \quad S_5 = S_9 = S_{13} = 0, \]
where \( S_n = \sum_{\substack{1 \le i < j \le 8 \\ i+j = n}} a_i a_j \).

We need to find the maximum possible value of \( a_1^2 + a_2^2 + \dots + a_8^2 \) given that \( |a_1| = |a_2| = 1 \).

1. **Express the sums \( S_n \) in terms of \( a_i \):**
   - \( S_3 = a_1 a_2 \)
   - \( S_5 = a_1 a_4 + a_2 a_3 \)
   - \( S_7 = a_1 a_6 + a_2 a_5 + a_3 a_4 \)
   - \( S_9 = a_1 a_8 + a_2 a_7 + a_3 a_6 + a_4 a_5 \)
   - \( S_{11} = a_3 a_8 + a_4 a_7 + a_5 a_6 \)
   - \( S_{13} = a_5 a_8 + a_6 a_7 \)
   - \( S_{15} = a_7 a_8 \)

2. **Substitute the given values:**
   - \( S_3 = 1 \implies a_1 a_2 = 1 \)
   - \( S_5 = 0 \implies a_1 a_4 + a_2 a_3 = 0 \)
   - \( S_7 = -1 \implies a_1 a_6 + a_2 a_5 + a_3 a_4 = -1 \)
   - \( S_9 = 0 \implies a_1 a_8 + a_2 a_7 + a_3 a_6 + a_4 a_5 = 0 \)
   - \( S_{11} = 1 \implies a_3 a_8 + a_4 a_7 + a_5 a_6 = 1 \)
   - \( S_{13} = 0 \implies a_5 a_8 + a_6 a_7 = 0 \)
   - \( S_{15} = -1 \implies a_7 a_8 = -1 \)

3. **Analyze the conditions:**
   - From \( a_1 a_2 = 1 \) and \( |a_1| = |a_2| = 1 \), we have \( a_1 = a_2 = \pm 1 \).
   - From \( a_7 a_8 = -1 \), we have \( a_7 = \pm 1 \) and \( a_8 = \mp 1 \).

4. **Simplify the problem:**
   - Assume \( a_1 = 1 \) and \( a_2 = 1 \) (the other case \( a_1 = -1 \) and \( a_2 = -1 \) is symmetric).
   - Then \( a_1 a_4 + a_2 a_3 = 0 \implies a_4 + a_3 = 0 \implies a_4 = -a_3 \).
   - \( a_1 a_6 + a_2 a_5 + a_3 a_4 = -1 \implies a_6 + a_5 - a_3^2 = -1 \).
   - \( a_1 a_8 + a_2 a_7 + a_3 a_6 + a_4 a_5 = 0 \implies -1 + 1 + a_3 a_6 - a_3 a_5 = 0 \implies a_3 (a_6 - a_5) = 0 \).

5. **Solve for \( a_3, a_5, a_6 \):**
   - If \( a_3 = 0 \), then \( a_6 + a_5 = -1 \) and \( a_5 a_6 = 1 \).
   - Solving \( t^2 + t - 1 = 0 \) gives \( t = \frac{-1 \pm \sqrt{5}}{2} \).
   - Thus, \( a_5 = \frac{-1 + \sqrt{5}}{2} \) and \( a_6 = \frac{-1 - \sqrt{5}}{2} \) (or vice versa).

6. **Calculate \( a_1^2 + a_2^2 + \dots + a_8^2 \):**
   - \( a_1^2 + a_2^2 + a_3^2 + a_4^2 + a_5^2 + a_6^2 + a_7^2 + a_8^2 \)
   - \( = 1 + 1 + 0 + 0 + \left( \frac{-1 + \sqrt{5}}{2} \right)^2 + \left( \frac{-1 - \sqrt{5}}{2} \right)^2 + 1 + 1 \)
   - \( = 1 + 1 + 0 + 0 + \frac{6 - 2\sqrt{5}}{4} + \frac{6 + 2\sqrt{5}}{4} + 1 + 1 \)
   - \( = 1 + 1 + 0 + 0 + \frac{3 - \sqrt{5}}{2} + \frac{3 + \sqrt{5}}{2} + 1 + 1 \)
   - \( = 1 + 1 + 0 + 0 + 3 + 1 + 1 \)
   - \( = 7 \).

The final answer is \( \boxed{ 7 } \).