```#include <bits/stdtr1c++.h>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef complex<ld> pt;

int a[200][200], dist[200*200];
struct comp {
bool operator()(int u, int v) const {
if (dist[u] == dist[v]) return u < v;
return dist[u] < dist[v];
}
};

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
ios::sync_with_stdio(0);
int n;
while (cin >> n) {
if (!n) break;

static int ca = 0;
cout << "Problem " << ++ca << ": ";

for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
memset(dist, 0x3f, sizeof dist);
set<int, comp> q({0,0});
dist[0] = a[0][0];

while (!q.empty()) {
int u = *q.begin();
q.erase(q.begin());
for (int d = 0; d < 4; d++) {
int nx = u/n + dx[d], ny = u%n + dy[d];
if (nx < 0 || ny < 0 || nx >= n || ny >= n) continue;
if (dist[nx*n + ny] > dist[u] + a[nx][ny]) {
q.erase(nx * n + ny);
dist[nx*n + ny] = dist[u] + a[nx][ny];
q.insert(nx * n + ny);
}
}
}
cout << dist[(n-1)*n + n-1] << endl;
}
return 0;
}```