var a:array[1..2000,1..2000]of integer;n,m,k,n1,m1,i,j,s:integer;
begin
 assign(input,'display.in');
 assign(output,'display.out');
 reset(input); rewrite(output);
 readln(n,m);
 readln(n1,m1);
 readln(k); s:=0;
 for i:=1 to n do begin
  for j:=1 to m-1 do begin read(a[i,j]);if a[i,j]<>0 then s:=s+k-a[i,j];end;
   readln(a[i,m]);if a[i,m]<>0 then s:=s+k-a[i,m];end;
 if (n1=1)and(m1=1)then writeln(s)
 else writeln('impossible');
end.
