Competitions

# Cafe

Today n students came to the New University Cafe. Each of them wants to drink a cup of coffee and to eat one cake (none of them does not agree only on coffee or just a cake - in this case the student leaves). The café serves m kinds of coffees and k kinds of cakes. For each type of coffee and pastry it is known how many cups or servings of this type is available.

In addition, each student has his own taste preferences. It is known for each student what kinds of coffee and cakes he loves. None of the students do not agree to eat or drink something other that he does not like.

The owner of the cafe is thinking: what is the maximum number of students can he serve? And can you find this number?

#### Input

First line contains integers n, m, k (1n, m, k500).

Second line contains m integers C1, C2, ..., Cm (1Ci500) - the number of available cups of coffee for each type.

Third line contains k integers P1, P2, ..., Pk (1Pi500) - the number of available cakes for each type.

Next n lines give the information what kind of coffee likes each student. i-th line (1in) contains number Xi, followed by different numbers A1, A2, ..., AXi - the kinds of coffee that likes i-th student.

Next n lines give the information what kind of cakes likes each student. i-th line (1in) contains number Yi, followed by different numbers B1, B2, ..., BYi - the kinds of cakes that likes i-th student.

#### Output

Print the maximum number of students that can be served in cafe.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2 3 1
5 1 3
2
3 1 2 3
1 2
1 1
1 1

Output example #1
2

Source 2015 Казахстан, 4-й этап Республиканской олимпиады по информатике, Уральск, 13-18 марта, Задача B