1 #include <iostream>// 1086
2
3 using namespace std;
4
5 const int N = 2000;
6
7 int main(void)
8 {
9 long long l1;
10 long long l2;
11 long long l3;
12 long long c1;
13 long long c2;
14 long long c3;
15
16 long long a;
17 long long b;
18
19 long long dist[N] = {0};
20 long long n;
21 long long i;
22 long long j;
23
24 long long price[N] ;
25
26
27 while (cin >> l1 >> l2 >> l3 >> c1 >> c2 >> c3)
28 {
29 cin >> a >> b;
30 cin >> n;
31
32 for(i = 2; i <= n; ++i)
33 cin >>dist[i];
34
35 dist[1] = 0;
36 for(i = 1; i < n; ++i)
37 dist[i] = dist[i+1] - dist[i];
38
39 price[a] = 0;
40
41 for(i = a+1; i <= b; ++i)
42 {
43
44 long long s = 0;
45 long long t ;
46 long long mi = price[i-1] + c3;
47
48 for(j = i-1 ; j >= a; --j)
49 {
50 s += dist[j];
51
52 if(s <= l1)
53 t = price[j] + c1;
54
55 if(s <= l2 && s > l1)
56 t = price[j] + c2;
57
58 if(s <= l3 && s > l2)
59 t = price[j] + c3;
60
61 if(mi > t)
62 mi = t;
63 }
64 price[i] = mi;
65 }
66
67 cout<<price[b]<<endl;
68
69
70 }
71 return 0;
72 }
73