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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.stream.Collectors;

public class Main {
    static int mod = (int) 1e9 + 7;
    static ArrayList<ArrayList<Pair>> g;

    /* ======================DSU===================== */
    static class dsu {
        static int parent[], n;// min[],value[];
        static long size[];

        dsu(int n) {
            parent = new int[n + 1];
            size = new long[n + 1];
            // min=new int[n+1];
            // value=new int[n+1];
            this.n = n;
            makeSet();
        }

        static void makeSet() {
            for (int i = 1; i <= n; i++) {
                parent[i] = i;
                size[i] = 1;
                // min[i]=i;
            }
        }

        static int find(int a) {
            if (parent[a] == a)
                return a;
            else {
                return parent[a] = find(parent[a]);// Path Compression
            }
        }

        static void union(int a, int b) {
            int setA = find(a);
            int setB = find(b);
            if (setA == setB)
                return;
            if (size[setA] >= size[setB]) {
                parent[setB] = setA;
                size[setA] += size[setB];
            } else {
                parent[setA] = setB;
                size[setB] += size[setA];
            }
        }
    }

    /* ======================================================== */
    static class Pair implements Comparator<Pair> {
        long lx, ly;
        int ix, iy;

        // Constructor
        public Pair(long x, long y) {
            // System.out.println("F1");
            this.lx = x;
            this.ly = y;
            this.ix = (int) x;
            this.iy = (int) y;
        }

        public Pair(int x, int y) {
            // System.out.println("F");
            this.ix = x;
            this.iy = y;
            this.lx = ix;
            this.ly = iy;
            // System.out.println(this.lx);
        }

        public Pair() {
        }

        @Override
        public int compare(Main.Pair o1, Main.Pair o2) {
            // System.out.println( (o1.iy - o2.iy));
            return ((int) (o1.iy - o2.iy));// Ascending Order
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] intArr(int n) {
            int res[] = new int[n];
            for (int i = 0; i < n; i++)
                res[i] = nextInt();
            return res;
        }

        long[] longArr(int n) {
            long res[] = new long[n];
            for (int i = 0; i < n; i++)
                res[i] = nextLong();
            return res;
        }
    }

    static FastReader f = new FastReader();
    static BufferedWriter w = new BufferedWriter(new OutputStreamWriter(System.out));

    static boolean isPrime(long n) {
        if (n <= 1)
            return false;
        if (n <= 3)
            return true;
        if (n % 2 == 0 || n % 3 == 0)
            return false;
        for (long i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;
        return true;
    }

    static int LowerBound(int a[], int x) { // x is the target value or key
        int l = -1, r = a.length;
        while (l + 1 < r) {
            int m = (l + r) >>> 1;
            if (a[m] >= x)
                r = m;
            else
                l = m;
        }
        return r;
    }

    static int UpperBound(int a[], int x) {// x is the key or target value
        int l = -1, r = a.length;
        while (l + 1 < r) {
            int m = (l + r) >>> 1;
            if (a[m] <= x)
                l = m;
            else
                r = m;
        }
        return l + 1;
    }

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

    static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    static long power(long x, long y, long p) {
        long res = 1;
        x = x % p;
        while (y > 0) {
            if (y % 2 == 1)
                res = (res * x) % p;
            y = y >> 1; // y = y/2
            x = (x * x) % p;
        }
        return res;
    }

    static long power(long x, long y) {
        long res = 1;
        // System.out.println("F");
        while (y > 0) {
            if (y % 2 == 1)
                res = (res * x);
            y >>= 1;
            x = (x * x);
        }
        return res;
    }

    static int power(int x, int y) {
        int res = 1;
        while (y > 0) {
            if (y % 2 == 1)
                res = (res * x);
            y >>= 1;
            x = (x * x);
        }
        return res;
    }

    static int ceil(int x, int y) {
        return (x % y == 0 ? x / y : (x / y + 1));
    }

    static long ceil(long x, long y) {
        return (x % y == 0 ? x / y : (x / y + 1));
    }

    /*
     * ===========Modular Operations==================
     */
    static long modInverse(long n, long p) {
        return power(n, p - 2, p);
    }

    static long modAdd(long a, long b) {
        return (a % mod + b % mod) % mod;

    }

    static long modMul(long a, long b) {
        return ((a % mod) * (b % mod)) % mod;
    }

    static long nCrModPFermat(int n, int r) {
        if (r == 0)
            return 1;
        long[] fac = new long[n + 1];
        fac[0] = 1;
        for (int i = 1; i <= n; i++)
            fac[i] = fac[i - 1] * i % mod;
        return (fac[n] * modInverse(fac[r], mod) % mod * modInverse(fac[n - r], mod) % mod) % mod;
    }

    /*
     * ===============================================
     */
    static List<Character> removeDup(ArrayList<Character> list) {
        List<Character> newList = list.stream().distinct().collect(Collectors.toList());
        return newList;
    }

    static void ruffleSort(long[] a) {
        int n = a.length;
        Random r = new Random();
        for (int i = 0; i < a.length; i++) {
            int oi = r.nextInt(n);
            long temp = a[i];
            a[i] = a[oi];
            a[oi] = temp;
        }
        Arrays.sort(a);
    }

    static void ruffleSort(int[] a) {
        int n = a.length;
        Random r = new Random();
        for (int i = 0; i < a.length; i++) {
            int oi = r.nextInt(n);
            int temp = a[i];
            a[i] = a[oi];
            a[oi] = temp;
        }
        Arrays.sort(a);
    }

    static String binString32(int n) {
        StringBuilder str = new StringBuilder("");
        String bin = Integer.toBinaryString(n);
        if (bin.length() != 32) {
            for (int k = 0; k < 32 - bin.length(); k++) {
                str.append("0");
            }
            str.append(bin);
        }
        return str.toString();
    }

    /*
     * ====================================Main=================================
     */
    static int n, m;
    static int hor[][], ver[][];
    static int dp[][][];
    static int solve(int i, int j, int rem) {
        if (rem == 0) {
            return 0;
        }
        if (i < 0 || j < 0 || i >= n || j >= m) {
            return 0;
        }
        if(dp[i][j][rem]!=-1){
            return dp[i][j][rem];
        }
        dp[i][j][rem]= Math.min(j<m-1?(hor[i][j] + solve(i, j + 1, rem - 1)):Integer.MAX_VALUE,
                Math.min(j > 0 ? (hor[i][j - 1] + solve(i, j - 1, rem - 1)) : Integer.MAX_VALUE,
                        Math.min(i<n-1?(ver[i][j] + solve(i + 1, j, rem - 1)):Integer.MAX_VALUE,
                                i > 0 ? (ver[i - 1][j] + solve(i - 1, j, rem - 1)) : Integer.MAX_VALUE)));
        return dp[i][j][rem];
    }

    public static void main(String args[]) throws Exception {
        // File file = new File("D:\\VS Code\\Java\\Output.txt");
        // FileWriter fw = new FileWriter("D:\\VS Code\\Java\\Output.txt");
        Random rand = new Random();
        int t = 1;
        // t = f.nextInt();
        int tc = 1;

        while (t-- != 0) {
            n = f.nextInt();
            m = f.nextInt();
            int k = f.nextInt();
            hor = new int[n][m - 1];
            ver = new int[n - 1][m];
            for (int i = 0; i < n; i++) {
                hor[i] = f.intArr(m - 1);
            }
            for (int i = 0; i < n - 1; i++) {
                ver[i] = f.intArr(m);
            }
            if (k % 2 == 1) {
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < m; j++) {
                        w.write("-1 ");
                    }
                    w.write("\n");
                }
            } else {
                dp=new int[n+1][m+1][k/2+1];
                for(int i=0;i<=n;i++){
                    for(int j=0;j<=m;j++){
                        Arrays.fill(dp[i][j],-1);
                    }
                }
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < m; j++) {
                        w.write(solve(i, j, k / 2) * 2 + " ");
                    }
                    w.write("\n");
                }
            }

        }
        w.flush();
    }
}
/*
 * FLIP IPFL LPFI LPIF LIPF PFLI
 */