- 开心农场(HOI)
- 2009-08-30 16:44:02 @
program p2(input,output);
var g:array[1..3000,1..2] of longint;
tt:array[1..3000]of longint;
f:array[0..3000,0..500]of longint;
n,m,t,k:longint;
max:longint;
procedure init;
var i,l:longint;
x,y,z:longint;
begin
readln(n,m,t,k);
l:=0;
for i:=1 to m do
begin
readln(x,y,z);
if z-x>0 then
begin
inc(l);
g[l,1]:=z-x;
g[l,2]:=y;
end;
end;
m:=l;
for i:=1 to k do read(tt[i]);
end;
procedure qsort(l,r:longint);
var i,j:longint;
temp:longint;
begin
i:=l; j:=r; temp:=tt[i];
repeat
while (itemp) do dec(j);
if (j>i) then begin tt[i]:=tt[j]; inc(i); end;
while (i=j;
tt[i]:=temp;
if lf[x,j]) then f[x,j]:=f[k1,m]+g[j,1];
end;
for k2:=x+1 to tt do f[k2,m]:=f[x,m];
end;
end;
procedure print;
var i,j:longint;
begin
writeln(f[t,m]*n);
end;
begin
init;
qsort(1,k);
dp;
print;
end.