import java.util.*;
import java.io.*;

public class Lol22leBS
{
    public static void main (String[] args) throws IOException
    {
	BufferedReader in = new BufferedReader (new FileReader ("DATA5.txt"));
	PrintWriter out = new PrintWriter (new FileWriter ("OUT5.txt"));
	for (int z = 0 ; z < 5 ; z++)
	{
	    String temp = in.readLine ();
	    int one = Integer.parseInt (temp.split (" ") [0]);
	    int two = Integer.parseInt (temp.split (" ") [1]);
	    int wtf = 0;
	    for (int x = 0 ; x < one ; x++)
	    {
		String lol = in.readLine ();
		for (int y = 0 ; y < two ; y++)
		{
		    wtf += Integer.parseInt (lol.split (" ") [y]);
		}
	    }
	    out.println ((int) wtf / (one + two));
	    out.flush ();
	}
	out.close ();
    }
}

