#include <bits/stdtr1c++.h>
using namespace std;

#define mp3(a,b,c) make_pair(a,make_pair(b,c))

typedef pair<int,int> pii;
typedef pair<int,pii> p3i;

const int dx[4] = {1,-1,0,0};
const int dy[4] = {0,0,1,-1};

int mn[125][125], c[125][125];
bool vis[125][125];

int main() {
  ios::sync_with_stdio(0);
  int n, T = 1;
  while (cin >> n && n) {
    memset(vis, 0, sizeof vis);
    cout << "Problem " << T++ << ": ";
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cin >> c[i][j];
        mn[i][j] = 0x3f3f3f3f;
      }
    }
    mn[0][0] = c[0][0];
    priority_queue<p3i> pq;
    pq.push(mp3(-c[0][0],0,0));
    while (pq.size()) {
      p3i t = pq.top();
      pq.pop();
      int C = t.first, x = t.second.first, y = t.second.second;
      if (vis[x][y])
        continue;
      for (int i = 0; i < 4; i++) {
        int X = x+dx[i], Y = y+dy[i];
        if (0 <= X && X < n && 0 <= Y && Y < n && !vis[X][Y] && mn[X][Y] > -C+c[X][Y]) {
          mn[X][Y] = -C+c[X][Y];
          pq.push(mp3(-mn[X][Y],X,Y));
        }
      }
    }
    cout << mn[n-1][n-1] << "\n";
  }
  return 0;
}