시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 0 0 0 0.000%

## 문제

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 $a$, it's limit is $n_a$ participants. The second location is at the point with coordinate $b$, it's limit is $n_b$ participants. The third location is at the point with coordinate $c$, it's limit is $n_c$ participants.

There are $n$ students that are going to participate in the Olympiad, the $i$-th of them lives in the house that is located at the point with coordinate $x_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 $p$, and a location that he would participate at is at a point with coordinate $q$, they must walk a distance of $|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 $a$ and $n_a$ --- the coordinate of the first location and its participation limit, the second line contains two integers $b$ and $n_b$ --- the coordinate of the second location and its participation limit, the third line contains two integers $c$ and $n_c$ --- the coordinate of the third location and its participation limit ($-10^9 \le a, b, c \le 10^9$; $1 \le n_a, n_b, n_c \le 100\,000$).

The fourth line contains an integer $n$ --- the number of students ($1 \le n \le 100\,000$, $n \le n_a + n_b + n_c$).

The next line contains $n$ integers $x_i$ --- the coordinates of the students' houses ($-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.

## 예제 입력 1

0 1
3 2
6 3
4
-2 1 3 2


## 예제 출력 1

8