#include <iostream>
bool palindrom(const int n)
{
int N = 0, t = n;
do{
N = N * 10 + t % 10;
t /= 10;
} while(t);
return n == N;
}
int main(){
int n, t, p = 1;
std::cin >> n;
for(int j, i = 0; i < n; ++i)
for(j = 0; j < n; ++j){
std::cin >> t;
if(j == i && palindrom(t))
p *= t;
}
std::cout << "Produsul: " << p;
return 0;
}