import java.util.*;

class Solution
{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    for (int I = 1; I <= N; ++I) {

      int r = sc.nextInt(), c = sc.nextInt();
      int[][] f = new int[r][c];
      for (int j = 0; j < r; ++j)
        for (int i = 0; i < c; ++i)
          f[j][i] = sc.nextInt();

      for (int j = 1; j < r; ++j) f[j][0] += f[j-1][0];
      for (int i = 1; i < c; ++i) f[0][i] += f[0][i-1];

      for (int j = 1; j < r; ++j)
        for (int i = 1; i < c; ++i)
          f[j][i] += Math.max(f[j-1][i], f[j][i-1]);

      System.out.println("Scenario #" + I + ":");
      System.out.println(f[r-1][c-1]);
      System.out.println();
    }
  }
}

