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.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class D1517 {

    static BufferedReader br;
    static long mod = 1000000000 + 7;
    static HashSet<Integer> p = new HashSet<>();

    public static void main(String[] args) throws Exception {
        br = new BufferedReader(new InputStreamReader(System.in));
        int tc = 1;
       int[] nmk = readArray(3,0,0);
       int n = nmk[0];int m  =nmk[1];int k = nmk[2];

       int[][] Horizontal  =new int[n][m];

       for(int i=0;i<n;i++){
           for(int j=0;j<m;j++){
               Horizontal[i][j]=Integer.MAX_VALUE;
           }
       }

       for(int i=0;i<n;i++){
           int[] ar= readArray(m-1,0,0);
           for(int j=0;j<m-1;j++){
               Horizontal[i][j]=ar[j];
           }
       }
        int[][] Vertical  =new int[n][m];

        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                Vertical[i][j]=Integer.MAX_VALUE;
            }
        }

       for(int i=0;i<n-1;i++){

           int[] ar =readArray(m,0,0);
           for(int j=0;j<m;j++){
               Vertical[i][j]=ar[j];
           }
       }

       if(k==1){
           StringBuilder ob =new StringBuilder();
           for(int i=0;i<n;i++){
               for(int j=0;j<m;j++){
                     ob.append("-1"+" ");
                   // System.out.println("-1 "+);
               }
               ob.append("\n");
           }
           System.out.println(ob.toString());
           System.exit(0);
       }
       long[][][] dp = new long[n][m][k+1];

       for(int i=0;i<n;i++){

           for(int j=0;j<m;j++){
                   for(int l=0;l<=k;l++){
                       dp[i][j][l]=Integer.MAX_VALUE;
                   }
           }
       }

       for(int i=0;i<n;i++){
           for(int j=0;j<m;j++){
               //System.out.println("i j"+" "+i+" "+j);
               if(j-1>=0){
                   if(Horizontal[i][j-1]!=Integer.MAX_VALUE) {
                       dp[i][j][2] = Math.min(dp[i][j][2], 2 * Horizontal[i][j-1]);
                       //System.out.println(2*Horizontal[i][j-1]+ " "+dp[i][j][2]);
                   }
                  // System.out.println(i+" "+j+" "+dp[i][j][2]+" "+(2*Horizontal[i][j-1])+" "+Horizontal[i][j-1]);
               }

               if(j+1<m){
                   if(Horizontal[i][j]!=Integer.MAX_VALUE) {
                       dp[i][j][2] = Math.min(dp[i][j][2], 2 * Horizontal[i][j]);
                      // System.out.println(2*Horizontal[i][j]+" "+dp[i][j][2]);

                   }
                  // System.out.println(i+" "+j+" "+dp[i][j][2]+" "+(2*Horizontal[i][j+1])+ Horizontal[i][j+1]);
               }

               if(i-1>=0){
                   if(Vertical[i-1][j]!=Integer.MAX_VALUE) {
                       dp[i][j][2] = Math.min(dp[i][j][2], 2 * Vertical[i - 1][j]);
                  //     System.out.println(2 * Vertical[i-1][j] + " " + dp[i][j][2]);
                   }
                   //System.out.println(i+" "+j+" "+dp[i][j][2]+" "+(2*Vertical[i-1][j]));
               }

               if(i+1<n){
                   if(Vertical[i][j]!=Integer.MAX_VALUE) {
                       dp[i][j][2] = Math.min(dp[i][j][2], 2 * Vertical[i][j]);
                      // System.out.println(2*Vertical[i][j]+" "+dp[i+1][j][2]);

                   }
                   //System.out.println(i+" "+j+" "+dp[i][j][2]+" "+(2*Vertical[i+1][j]));

               }
           }
       }
//       StringBuilder ob1 = new StringBuilder();
//       boolean neg1 =false;
//        for(int i=0;i<n;i++){
//            for(int j=0;j<m;j++){
//
//                if(neg1){
//                    ob1.append("-1"+" ");
//                    continue;
//                }
//                ob1.append(dp[i][j][2]+" ");
//            }
//            ob1.append("\n");
//        }
//
//        System.out.println(ob1.toString().trim());
//        System.out.println("hhhhh");
        for(int l=4;l<=k;l+=2){
           // System.out.println(l);
       for(int i=0;i<n;i++){
           for(int j=0;j<m;j++){


                   if(j-1>=0){
                       if(Horizontal[i][j-1]!=Integer.MAX_VALUE)
                       dp[i][j][l]=Math.min(dp[i][j][l],2*Horizontal[i][j-1]+dp[i][j-1][l-2]);
                   }

                   if(j+1<m){
                       if(Horizontal[i][j]!=Integer.MAX_VALUE)
                           dp[i][j][l]=Math.min(dp[i][j][l],2*Horizontal[i][j]+dp[i][j+1][l-2]);
                   }

                   if(i-1>=0){
                       if(Vertical[i-1][j]!=Integer.MAX_VALUE)
                           dp[i][j][l]=Math.min(dp[i][j][l],2*Vertical[i-1][j]+dp[i-1][j][l-2]);
                   }

                   if(i+1<n){
                       if(Vertical[i][j]!=Integer.MAX_VALUE)

                           dp[i][j][l]=Math.min(dp[i][j][l],2*Vertical[i][j]+dp[i+1][j][l-2]);
                   }
               //System.out.print(dp[i][j][l]);

               }
           //System.out.println();
           }
       }

       StringBuilder ob = new StringBuilder();
       boolean neg=false;
       if(k%2!=0){
           neg=true;
       }
       for(int i=0;i<n;i++){
           for(int j=0;j<m;j++){

               if(neg){
                   ob.append("-1"+" ");
                   continue;
               }
               ob.append(dp[i][j][k]+" ");
           }
           ob.append("\n");
       }
        System.out.println(ob.toString().trim());

    }


    private static int dfs(TreeMap<Integer, HashSet<Integer>> graph, boolean[] vis, Integer key, Stack<Integer> st) {
        if (st.size() == 0) {
            return 0;
        }
        int par = st.pop();

        HashSet<Integer> child = graph.get(par);
        vis[par] = true;
        int nodes = 1;
        for (int c : child) {
            if (vis[c] == false) {
                st.add(c);
                nodes += dfs(graph, vis, c, st);
            }
        }
        return nodes;
    }


    public static boolean isSorted(int[] arr) {

        for (int i = 0; i < arr.length - 1; i++) {
            if (arr[i] > arr[i + 1]) {
                return false;
            }
        }
        return true;
    }


    private static long gcd(long a, long b) {
        if (a == 0)
            return b;
        if (b == 0)
            return a;

        // base case
        if (a == b)
            return a;

        // a is greater
        if (a > b)
            return gcd(a % b, b);
        return gcd(a, b % a);
    }


    public static long min(long a, long b) {
        return Math.min(a, b);
    }

    public static int min(int a, int b) {
        return Math.min(a, b);
    }


    public static void sieve() {
        int[] pf = new int[100000000 + 1];
        //0 prime //1 not prime
        pf[0] = 1;
        pf[1] = 1;
        for (int j = 2; j <= 10000; j++) {

            if (pf[j] == 0) {
                p.add(j);
                for (int k = j * j; k < pf.length; k += j) {
                    pf[k] = 1;
                }
            }
        }

    }


    public static int[] readArray(int n, int x, int z) throws Exception {
        int[] arr = new int[n];
        String[] ar = cinA();
        for (int i = x; i < n + x; i++) {
            arr[i] = getI(ar[i - x]);
        }
        return arr;
    }

    public static long[] readArray(int n, int x) throws Exception {
        long[] arr = new long[n];
        String[] ar = cinA();
        for (int i = x; i < n + x; i++) {
            arr[i] = getL(ar[i - x]);
        }
        return arr;
    }

    public static void arrinit(String[] a, long[] b) throws Exception {
        for (int i = 0; i < a.length; i++) {
            b[i] = Long.parseLong(a[i]);
        }
    }

    public static HashSet<Integer>[] Graph(int n, int edge, int directed) throws Exception {
        HashSet<Integer>[] tree = new HashSet[n];

        for (int j = 0; j < edge; j++) {

            String[] uv = cinA();
            int u = getI(uv[0]);
            int v = getI(uv[1]);
            if (directed == 0) {

                tree[v].add(u);
            }
            tree[u].add(v);
        }
        return tree;
    }

    public static void arrinit(String[] a, int[] b) throws Exception {
        for (int i = 0; i < a.length; i++) {
            b[i] = Integer.parseInt(a[i]);
        }
    }


    static double findRoots(int a, int b, int c) {
        // If a is 0, then equation is not
        //quadratic, but linear


        int d = b * b - 4 * a * c;
        double sqrt_val = Math.sqrt(Math.abs(d));


        // System.out.println("Roots are real and different \n");

        return Math.max((double) (-b + sqrt_val) / (2 * a),
                (double) (-b - sqrt_val) / (2 * a));


    }

    public static String cin() throws Exception {
        return br.readLine();
    }

    public static String[] cinA() throws Exception {
        return br.readLine().split(" ");
    }

    public static String[] cinA(int x) throws Exception {
        return br.readLine().split("");
    }

    public static String ToString(Long x) {
        return Long.toBinaryString(x);
    }

    public static void cout(String s) {
        System.out.println(s);
    }

    public static Integer cinI() throws Exception {
        return Integer.parseInt(br.readLine());
    }

    public static int getI(String s) throws Exception {
        return Integer.parseInt(s);
    }

    public static long getL(String s) throws Exception {
        return Long.parseLong(s);
    }

    public static long max(long a, long b) {
        return Math.max(a, b);
    }

    public static int max(int a, int b) {
        return Math.max(a, b);
    }

    public static void coutI(int x) {
        System.out.println(String.valueOf(x));
    }

    public static void coutI(long x) {
        System.out.println(String.valueOf(x));
    }

    public static Long cinL() throws Exception {
        return Long.parseLong(br.readLine());
    }

    public static void arrInit(String[] arr, int[] arr1) throws Exception {
        for (int i = 0; i < arr.length; i++) {
            arr1[i] = getI(arr[i]);
        }

    }
}