#include <stdio.h>

static int n = 25;

int main ()
{
    double u[n*n];
    double stencil_values[9];
    int stencil_shift[9] = {-n-1, -1, n-1, -n, 0, n, -n+1, 1, n+1};

    for (int i=0; i<9; i++)
        stencil_values[i] = -1.0/3.0;
    stencil_values[4] = 8.0/3.0;
    
    for (int i=0; i<n*n; i++)
        u[i] = 1.0;
    
    for (int i=0; i<100000000/(n*n); i++)
        for (int pos1=n; pos1<(n-1)*n; pos1+=n)
            for (int pos2=pos1+1; pos2<pos1+n-1; pos2++)
            {
                double s = u[pos2];
                for (int k=0; k<9; k++)
                    s += stencil_values[k]*u[pos2+stencil_shift[k]];
                u[pos2] = s;
            }
    printf("%f", u[n+1]);
    
    return 0;
}

