#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;
int W,H,m,f,MAP[15][15];
int DP[11][11][55][11][11];
struct state{
	int x,y,s,e,o,f;
	state(int xx,int yy,int oo,int ss,int ee,int ff){
		x=xx;y=yy;s=ss;e=ee;o=oo;f=ff;
	}
	state(){}
};
bool operator>(state a,state b){return a.f>b.f;}
int solve(int o){
	memset(DP,0x10,sizeof(DP));
	if(o<=1)return -1;

	priority_queue<state,vector<state>,greater<state> > que;
	for(int i=0;i<W;i++){
		int no=o-1;int now=0;
		if(MAP[i][0]>0){
			no+=MAP[i][0];if(no>m)no=m;
		}else{
			now-=MAP[i][0];
		}
		DP[i][0][no][i][i]=now;
		que.push(state(i,0,no,i,i,now));
	}
	state temp;
	while(!que.empty()){
		temp=que.top();que.pop();
		temp.o--;
		state nstate=temp;
		if(nstate.y==H-1){
			return nstate.f;
		}
		if(nstate.o==0)continue;

		nstate.y+=1;
		nstate.s=nstate.x;nstate.e=nstate.x;
		if(MAP[nstate.x][nstate.y]>0){
			nstate.o+=MAP[nstate.x][nstate.y];if(nstate.o>m)nstate.o=m;
		}else{
			nstate.f-=MAP[nstate.x][nstate.y];
		}
		if(DP[nstate.x][nstate.y][nstate.o][nstate.s][nstate.e]>nstate.f){
			DP[nstate.x][nstate.y][nstate.o][nstate.s][nstate.e]=nstate.f;
			que.push(nstate);
		}

		nstate=temp;
		nstate.x+=1;
		if(nstate.x<W){
			if(nstate.e<nstate.x){
				nstate.e=nstate.x;
				if(MAP[nstate.x][nstate.y]>0){
					nstate.o+=MAP[nstate.x][nstate.y];if(nstate.o>m)nstate.o=m;
				}else{
					nstate.f-=MAP[nstate.x][nstate.y];
				}
			}
			if(DP[nstate.x][nstate.y][nstate.o][nstate.s][nstate.e]>nstate.f){
				DP[nstate.x][nstate.y][nstate.o][nstate.s][nstate.e]=nstate.f;
				que.push(nstate);
			}
		}
		nstate=temp;
		nstate.x-=1;
		if(nstate.x>=0){
			if(nstate.s>nstate.x){
				nstate.s=nstate.x;
				if(MAP[nstate.x][nstate.y]>0){
					nstate.o+=MAP[nstate.x][nstate.y];if(nstate.o>m)nstate.o=m;
				}else{
					nstate.f-=MAP[nstate.x][nstate.y];
				}
			}
			if(DP[nstate.x][nstate.y][nstate.o][nstate.s][nstate.e]>nstate.f){
				DP[nstate.x][nstate.y][nstate.o][nstate.s][nstate.e]=nstate.f;
				que.push(nstate);
			}
		}
	}
	return -1;
}

int main(){
	for(;scanf("%d%d",&W,&H),W;){
		int o=0;
		scanf("%d%d%d",&f,&m,&o);

		for(int y=0;y<H;y++)
			for(int x=0;x<W;x++)
				scanf("%d",&MAP[x][y]);
		int res=solve(o);
		if(res==-1||res>f){
			puts("NA");
		}else{
			printf("%d\n",res);
		}
	}
	return 0;
}