<p>You are given two <strong>0-indexed</strong> arrays <code>nums1</code> and <code>nums2</code> and a 2D array <code>queries</code> of queries. There are three types of queries:</p>
<ol>
<li>For a query of type 1, <code>queries[i] = [1, l, r]</code>. Flip the values from <code>0</code> to <code>1</code> and from <code>1</code> to <code>0</code> in <code>nums1</code> from index <code>l</code> to index <code>r</code>. Both <code>l</code> and <code>r</code> are <strong>0-indexed</strong>.</li>
<li>For a query of type 2, <code>queries[i] = [2, p, 0]</code>. For every index <code>0 <= i < n</code>, set <code>nums2[i] = nums2[i] + nums1[i] * p</code>.</li>
<li>For a query of type 3, <code>queries[i] = [3, 0, 0]</code>. Find the sum of the elements in <code>nums2</code>.</li>
</ol>
<p>Return <em>an array containing all the answers to the third type queries.</em></p>
<strong>Explanation:</strong> After the first query nums1 becomes [1,1,1]. After the second query, nums2 becomes [1,1,1], so the answer to the third query is 3. Thus, [3] is returned.