Let  $B_n$ be the set of all sequences of length $n$, consisting of zeros and ones. For every two sequences  $a,b \in B_n$ (not necessarily different) we define strings  $\varepsilon_0\varepsilon_1\varepsilon_2 \dots \varepsilon_n$ and $\delta_0\delta_1\delta_2 \dots \delta_n$ such that $\varepsilon_0=\delta_0=0$ and $$
 \varepsilon_{i+1}=(\delta_i-a_{i+1})(\delta_i-b_{i+1}), \quad \delta_{i+1}=\delta_i+(-1)^{\delta_i}\varepsilon_{i+1} \quad (0 \leq i \leq n-1). 
$$. Let $w(a,b)=\varepsilon_0+\varepsilon_1+\varepsilon_2+\dots +\varepsilon_n$ . Find  $f(n)=\sum\limits_{a,b \in {B_n}} {w(a,b)} $.
. 
1. **Define the sequences and initial conditions:**
   Let \( B_n \) be the set of all sequences of length \( n \), consisting of zeros and ones. For every two sequences \( a, b \in B_n \), we define strings \( \varepsilon_0, \varepsilon_1, \varepsilon_2, \dots, \varepsilon_n \) and \( \delta_0, \delta_1, \delta_2, \dots, \delta_n \) such that:
   \[
   \varepsilon_0 = \delta_0 = 0
   \]
   and for \( 0 \leq i \leq n-1 \):
   \[
   \varepsilon_{i+1} = (\delta_i - a_{i+1})(\delta_i - b_{i+1})
   \]
   \[
   \delta_{i+1} = \delta_i + (-1)^{\delta_i} \varepsilon_{i+1}
   \]

2. **Interpret the conditions:**
   - If \( \delta_i = 1 \), then:
     \[
     \varepsilon_{i+1} = \text{NOR}(a_{i+1}, b_{i+1})
     \]
   - If \( \delta_i = 0 \), then:
     \[
     \varepsilon_{i+1} = \text{AND}(a_{i+1}, b_{i+1})
     \]

3. **Analyze the transitions:**
   - If \( \varepsilon_{i+1} = 1 \), then \( \delta_{i+1} = 1 - \delta_i \).
   - If \( \varepsilon_{i+1} = 0 \), then \( \delta_{i+1} = \delta_i \).

4. **Rephrase the transitions:**
   - If \( a_{i+1} = b_{i+1} = \text{NOT}(\delta_i) \), then \( \delta_{i+1} = 1 - \delta_i \).
   - Otherwise, \( \delta_{i+1} = \delta_i \).

5. **Count the transitions:**
   - \( w(a, b) \) is the total number of times \( \delta_i \) changes from 0 to 1 or from 1 to 0.
   - At any given position, exactly a quarter of all the string-pairs \( (a, b) \) will cause \( \delta_i \) to switch (increment \( \varepsilon \)).

6. **Calculate the sum \( f(n) \):**
   - There are \( 4^n \) pairs of sequences \( (a, b) \) in \( B_n \).
   - Each position \( i \) (from 0 to \( n-1 \)) contributes \( \frac{1}{4} \times 4^n = 4^{n-1} \) to the sum \( f(n) \).
   - Summing over all \( n \) positions, we get:
     \[
     f(n) = n \times 4^{n-1}
     \]

The final answer is \( \boxed{n \cdot 4^{n-1}} \).