var
a:Array[1..11,1..11] of longint;
f:Array[0..101] of longint;
t,tt,n,i,j,k:longint;
begin
readln(t,n,tt);
for i:=1 to n do
for j:=1 to t do read(a[i,j]);
for i:=1 to n do
for j:=t downto 1 do
for k:=1 to t do
if k+tt<=j then
if f[j-k-tt]+a[i,k]>f[j] then f[j]:=f[j-k-tt]+a[i,k];
writeln(f[t]);
end.
var
w,c:array[0..10,1..100] of longint;
t0,t,i,j,k,m,n,l,tm:longint;
ans:array[0..100] of longint;
begin
readln(tm,n,t0);
for i:=1 to n do
for j:=1 to tm do
begin
read(c[i,j]);
w[i,j]:=j+t0;
end;
for i:=1 to n do
for j:=tm downto 0 do
for k:=1 to tm do
if j>=w[i,k] then
if ans[j]<ans[j-w[i,k]]+c[i,k] then
ans[j]:=ans[j-w[i,k]]+c[i,k];
writeln(ans[tm]);
end.
Var t,n,nam,i,j,k:longint;
a:array[0..100,0..100]of longint;
f:array[0..100]of longint;
Begin
Readln(t,n,nam);
For i:=1 To n Do
For j:=1 To t Do
Read(a[i,j]);
For i:=1 To n Do
For j:=t Downto 1 Do
For k:=j Downto 1 Do
If (j-k-nam>=0) and (f[j]<f[j-k-nam]+a[i,k]) Then f[j]:=f[j-k-nam]+a[i,k];
writeln(f[t]);
End.