Alice is starting a new hobby! She has friends who are stamp-collectors, and she's going to try it too. There are different types of stamps and the stamp type costs . Alice knows each of her friends' collections. She wants to build her collection so that the following odd condition is held for any of her friends: Between her collection and that friend's collection, there are an **odd number of stamp types which appear in exactly one of the two collections**. What is the minimum cost of a collection which satisfies Alice's condition? The cost of a collection is the sum of the costs of the stamp types in the collection. **Alice's collection must have at least one stamp.**

**A collection will not contain multiple of a single type of stamp. The collection will either have it or it will not.**

#### Constraints

#### Input Specification

The first line contains two space-separated integers, and .

The second line contains space-separated integers, .

The next lines contain space-separated integers, either `0`

or `1`

. Each line represents the collection of one of Alice's friends. If the number is `0`

, the stamp type is not in this collection. If the number is `1`

, the stamp type is in the collection.

#### Output Specification

Output `-1`

if it is not possible for Alice to build such a collection. Otherwise, output the minimum cost of such a collection.

#### Sample Input 1

```
3 2
2 3
1 0
0 1
1 0
```

#### Sample Output 1

`5`

#### Explanation for Sample 1

Alice should purchase both stamp types.

Between her first friend and this collection, only stamp type appears exactly once. So there is one stamp type appearing exactly once, which is odd.

Between her second friend and this collection, only stamp type appears exactly once. So there is one stamp type appearing exactly once, which is odd.

Between her third friend and this collection, only stamp type appears exactly once. So there is one stamp type appearing exactly once, which is odd.

#### Sample Input 2

```
4 3
1 2 3
1 1 1
1 1 0
1 0 1
0 1 1
```

#### Sample Output 2

`-1`

#### Explanation for Sample 2

Purchasing only the first stamp type satisfies the condition for the second, third, and fourth friend, but it does not satisfy the condition for the first friend. There is no collection of stamp types which satisfies the condition for all four friends.

## Comments