**Note: This problem is an online version of the original version held at CCO. Differences in the problem statement will be bolded. Note that the specifics of this problem are not set in stone, so constraints/limits/test data may change without notice. Feel free to submit strong test data for this problem if non-intended solutions AC.**

##### Canadian Computing Olympiad: 2018 Day 2, Problem 2

You have a schedule of upcoming lectures that you have the option of attending. The lectures are numbered from to and are in chronological order. From the current schedule, you expect that the lecture will have quality . Since most of the lectures will be boring, you are only willing to attend some group of consecutive lectures. You will skip the remaining lectures so that you can catch up on sleep and participate in programming contests. Since you don't like taking notes, you will only be able to remember the content from of the lectures you attend. You want to choose the lectures you attend and the lectures you remember as to maximize the sum of the lecture qualities of those lectures.

There are changes that will be made to the schedule. The change to the schedule is represented by two values that indicate that the quality of the lecture changes to . For each of the versions of the schedule, find the maximum possible sum of lecture qualities that you can attain.

#### Input Specification

The first line will contain three integers , , and . The second line will contain integers . The next lines each contain two **encoded** integers and . **To decode line of the input, XOR all of the integers in that line with the integer printed in line of the output.**

**For 10 of the 25 available marks, and .**

#### Output Specification

Output lines, each containing a single integer. The line that follows should contain the answer for the schedule obtained after the first changes are made.

#### Sample Input

```
4 3 1
6 1 2 4
9 11
```

#### Output for Sample Input

```
8
6
```

#### Explanation for Output for Sample Input

For the original schedule, it is best to attend the first three lectures and remember the first and third, for an overall value of . After the update, it is best to attend the last three lectures and remember the last two, giving a value of .

**Note that we XOR the integers in line 3 with 8, to get the true values, 1 3.**

## Comments