You are wandering in the explorer space of the 2050 Conference.

The explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \{(i, j)|1≤ i≤ n, 1≤ j≤ m\}. Two vertices (i_1,j_1) and (i_2, j_2) are connected by an edge if and only if |i_1-i_2|+|j_1-j_2|=1.

At each step, you can walk to any vertex connected by an edge with your current vertex. On each edge, there are some number of exhibits. Since you already know all the exhibits, whenever you go through an edge containing x exhibits, your boredness increases by x.

For each starting vertex (i, j), please answer the following question: What is the minimum possible boredness if you walk from (i, j) and go back to it after exactly k steps?

You can use any edge for multiple times but the boredness on those edges are also counted for multiple times. At each step, you cannot stay on your current vertex. You also cannot change direction while going through an edge. Before going back to your starting vertex (i, j) after k steps, you can visit (i, j) (or not) freely.

Input

The first line contains three integers n, m and k (2≤ n, m≤ 500, 1≤ k≤ 20).

The j-th number (1≤ j ≤ m - 1) in the i-th line of the following n lines is the number of exibits on the edge between vertex (i, j) and vertex (i, j+1). 

The j-th number (1≤ j≤ m) in the i-th line of the following n-1 lines is the number of exibits on the edge between vertex (i, j) and vertex (i+1, j). 

The number of exhibits on each edge is an integer between 1 and 10^6.

Output

Output n lines with m numbers each. The j-th number in the i-th line, answer_{ij}, should be the minimum possible boredness if you walk from (i, j) and go back to it after exactly k steps.

If you cannot go back to vertex (i, j) after exactly k steps, answer_{ij} should be -1. 

Examples

Input


3 3 10
1 1
1 1
1 1
1 1 1
1 1 1


Output


10 10 10
10 10 10
10 10 10


Input


2 2 4
1
3
4 2


Output


4 4
10 6


Input


2 2 3
1
2
3 4


Output


-1 -1
-1 -1

Note

In the first example, the answer is always 10 no matter how you walk.

In the second example, answer_{21} = 10, the path is (2,1) → (1,1) → (1,2) → (2,2) → (2,1), the boredness is 4 + 1 + 2 + 3 = 10.
import java.util.*;
import java.io.*;

public class D {
	public static int dir[][]={{-1,0},{1,0},{0,-1},{0,1}};
	public static void main(String[] args) {
//		Scanner sc=new Scanner(System.in);
		FastScanner sc = new FastScanner();
		FastOutput out = new FastOutput(System.out);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int k=sc.nextInt();
		int ans[][][]=new int[n][m][11];
		int arr[][]=new int[n*m][4];
		for(int i=0;i<n;i++){
			for(int j=0;j<m-1;j++){
				int x=sc.nextInt();
				arr[i*m+j][3]=x;
				arr[i*m+j+1][2]=x;
			}
		}
		for(int i=0;i<n-1;i++){
			for(int j=0;j<m;j++){
				int x=sc.nextInt();
				arr[i*m+j][1]=x;
				arr[(i+1)*m+j][0]=x;
			}
		}
		if(k%2==1){
			for(int i=0;i<n;i++){
				StringBuilder sb=new StringBuilder("");
				for(int j=0;j<m;j++){
					ans[i][j][10]=-1;
					sb.append(ans[i][j][10]+" ");
				}
				out.println(sb.toString());
			}
		}else{
			
			for(int ceng=1;ceng<=k/2;ceng++){
				for(int i=0;i<n;i++){
					for(int j=0;j<m;j++){
						ans[i][j][ceng]=Integer.MAX_VALUE/3;
						for(int dr=0;dr<4;dr++){
							int nx=i+dir[dr][0];
							int ny=j+dir[dr][1];
							if(nx<n&&ny<m&&nx>=0&&ny>=0){
								ans[i][j][ceng]=Math.min(ans[i][j][ceng], ans[nx][ny][ceng-1]+arr[i*m+j][dr]);
							}
						}
					}
				}
			}
			for(int i=0;i<n;i++){
				StringBuilder sb=new StringBuilder("");
				for(int j=0;j<m;j++){
					sb.append(ans[i][j][k/2]*2+" ");
				}
				out.println(sb.toString());
			}
		}
		out.close();
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readIntArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long[] readLongArray(int n) {
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
	static class FastOutput implements AutoCloseable, Closeable, Appendable {
		private static final int THRESHOLD = 1 << 13;
		private final Writer os;
		private StringBuilder cache = new StringBuilder(THRESHOLD * 2);

		public FastOutput append(CharSequence csq) {
			cache.append(csq);
			return this;
		}

		public FastOutput append(CharSequence csq, int start, int end) {
			cache.append(csq, start, end);
			return this;
		}

		private void afterWrite() {
			if (cache.length() < THRESHOLD) {
				return;
			}
			flush();
		}

		public FastOutput(Writer os) {
			this.os = os;
		}

		public FastOutput(OutputStream os) {
			this(new OutputStreamWriter(os));
		}

		public FastOutput append(char c) {
			cache.append(c);
			afterWrite();
			return this;
		}

		public FastOutput append(int c) {
			cache.append(c);
			afterWrite();
			return this;
		}

		public FastOutput append(String c) {
			cache.append(c);
			afterWrite();
			return this;
		}

		public FastOutput println(String c) {
			return append(c).println();
		}

		public FastOutput println() {
			return append(System.lineSeparator());
		}

		public FastOutput flush() {
			try {
				os.append(cache);
				os.flush();
				cache.setLength(0);
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
			return this;
		}

		public void close() {
			flush();
			try {
				os.close();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
		public String toString() {
			return cache.toString();
		}
	}
}
