School Olympiad

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

School olympiad in informatics will take place in the capital of Lineland tomorrow.

All houses in the capital are located at integer points along the straight Main street. The Olympiad will take place at three locations at the Main street. Every location has a limit on the maximum number of participants.

The first location is at the point with coordinate aa, it's limit is n_an\_a participants. The second location is at the point with coordinate bb, it's limit is n_bn\_b participants. The third location is at the point with coordinate cc, it's limit is n_cn\_c participants.

There are nn students that are going to participate in the Olympiad, the ii-th of them lives in the house that is located at the point with coordinate x_ix\_i. Organizers need to choose a participation location for each student. It's forbidden to exceed the limit of a location. It's guaranteed that the total limit is enough for all students to participate.

If a student lives at a point with coordinate pp, and a location that he would participate at is at a point with coordinate qq, they must walk a distance of pq|p - q| before the Olympiad. Help organizers to find the minimum total distance that the students would have to walk before the Olympiad in case of optimal assignment of students to the three locations.

입력

The first line contains two integers aa and n_an\_a --- the coordinate of the first location and its participation limit, the second line contains two integers bb and n_bn\_b --- the coordinate of the second location and its participation limit, the third line contains two integers cc and n_cn\_c --- the coordinate of the third location and its participation limit (109a,b,c109-10^9 \le a, b, c \le 10^9; 1n_a,n_b,n_c100,0001 \le n\_a, n\_b, n\_c \le 100\\,000).

The fourth line contains an integer nn --- the number of students (1n100,0001 \le n \le 100\\,000, nn_a+n_b+n_cn \le n\_a + n\_b + n\_c).

The next line contains nn integers x_ix\_i --- the coordinates of the students' houses (109x_i109-10^9 \le x\_i \le 10^9).

출력

Output one integer --- the minimum possible total distance that the students would have to walk before the Olympiad.