#include <iostream>
#include <string>

using namespace std;

int main(int argc, char* argv[])
{
    string line;
    getline(cin, line);

    int length = line.size();

    int* forest = new int[length*length];
    int in_y = 0;
    do
    {
        for(int i = 0; i < length; i++)
        {
            forest[i+in_y*length] = line[i]-'0';
        }
        ++in_y;
    } while(getline(cin, line));

    int best_vis = 0;
    for(int y = 0; y < length; y++)
    {
        for(int x = 0; x < length; x++)
        {
            int north_vis = 0;
            int south_vis = 0;
            int west_vis = 0;
            int east_vis = 0;
            int cur_vis = forest[x+y*length];;

            for(int j = y-1; j >= 0; j--)
            {
                north_vis++;
                if (forest[x+j*length] >= cur_vis)
                {
                    break;
                }
            }

            for(int j = y+1; j < length; j++)
            {
                south_vis++;
                if (forest[x+j*length] >= cur_vis)
                {
                    break;
                }
            }

            for(int i = x-1; i >= 0; i--)
            {
                west_vis++;
                if (forest[i+y*length] >= cur_vis)
                {
                    break;
                }
            }

            for(int i = x+1; i<length; i++)
            {
                east_vis++;
                if(forest[i+y*length] >= cur_vis)
                {
                    break;
                }
            }

            int total_vis = north_vis*south_vis*east_vis*west_vis;

            if (total_vis > best_vis)
            {
                best_vis = total_vis;
            }
        }
    }

    cout << best_vis << endl;

    delete[] forest;
}