We have $2022$ $1s$ written on a board in a line. We randomly choose a strictly increasing sequence from ${1, 2, . . . , 2022}$ such that the last term is $2022$. If the chosen sequence is $a_1, a_2, ..., a_k$ ($k$ is not fixed), then at the $i^{th}$ step, we choose the first a$_i$ numbers on the line and change the 1s to 0s and 0s to 1s. After $k$ steps are over, we calculate the sum of the numbers on the board, say $S$. The expected value of $S$ is $\frac{a}{b}$ where $a, b$ are relatively prime positive integers. Find $a + b.$
1. **Understanding the Problem:**
   We start with a sequence of 2022 ones. We randomly choose a strictly increasing sequence from the set \(\{1, 2, \ldots, 2022\}\) such that the last term is 2022. For each chosen index \(a_i\), we flip the first \(a_i\) numbers on the board (changing 1s to 0s and 0s to 1s). We need to find the expected value of the sum \(S\) of the numbers on the board after all flips.

2. **Initial Setup:**
   Let \(X_i\) be the indicator variable that is 1 if the \(i\)-th position is flipped an odd number of times and 0 if it is flipped an even number of times. The sum \(S\) is then given by:
   \[
   S = \sum_{i=1}^{2022} X_i
   \]

3. **Probability Calculation:**
   Each position \(i\) is flipped if and only if it is included in the sequence \(a_1, a_2, \ldots, a_k\). The probability that a specific position \(i\) is included in the sequence is \(\frac{2022 - i + 1}{2022}\) because there are \(2022 - i + 1\) choices for the last term of the sequence starting from \(i\).

4. **Expected Value of \(X_i\):**
   The expected value of \(X_i\) is the probability that \(i\) is flipped an odd number of times. Since each position is flipped independently, the expected value of \(X_i\) is:
   \[
   \mathbb{E}[X_i] = \frac{1}{2}
   \]

5. **Expected Value of \(S\):**
   The expected value of the sum \(S\) is the sum of the expected values of \(X_i\):
   \[
   \mathbb{E}[S] = \sum_{i=1}^{2022} \mathbb{E}[X_i] = \sum_{i=1}^{2022} \frac{1}{2} = 2022 \cdot \frac{1}{2} = 1011
   \]

6. **Simplifying the Fraction:**
   The expected value \(\mathbb{E}[S]\) is \(\frac{1011}{1}\), where \(a = 1011\) and \(b = 1\). Since \(a\) and \(b\) are relatively prime, we have \(a + b = 1011 + 1 = 1012\).

The final answer is \(\boxed{1012}\)